English 中文(简体)
如何达到Winforms制成物的高度?
原标题:How to get the size of a Winforms Form titlebar height?

因此,如果它的工具wind缩或一种可尽量减少的形式,我就希望能够以方案方式达到其高度。

这是可能的吗? 如果是这样的话?

最佳回答

可以通过使用:

Rectangle screenRectangle = this.RectangleToScreen(this.ClientRectangle);

int titleHeight = screenRectangle.Top - this.Top;

如果是你的话。

客户实体将客户领域的门槛值归为贵方。 Rectangle ToScreen将这一系统转换成像表格筛选地点一样的坐标系统。

问题回答

如果在一次多指标类集调查申请中看到你的形式的话,就会有另一个小幅。 在该案中,Rectangle ToScreen(ClientRectangle)返回坐标不是表格本身(可能预期),而是主要表格的主角。

页: 1

Point pnt = new Point(0, 0);
Point corner = this.PointToScreen(pnt); // upper left in MainFrame coordinates
Point origin = this.Parent.PointToScreen(pnt); // MDIClient upperleft in MainFrame coordinates
int titleBarHeight = corner.Y - origin.Y - this.Location.Y;

这将使你能够胜任:

form.ClientRectangle.Height - form.Height;

就我而言,我不得不改变表格的高度,使之略低于控制之一。

  int titleHeight = this.Height - screenRectangle.Height;

<<>39>, 接受回答:

  int titleHeight =  screenRectangle.Top - this.Top;

可能是因为形成了底层边界。

为了确定S. Norman的回答,他干 minu和潜水器开关,下面是最简单的答复:

Int HeightOfTheTitle Bar_of this = 。 Height - this. 客户重新组合。 重量;

BTW, 标准硬编码所有权条形为25台,是最低高度,可改为最高50台。

OK ...... 是,在技术上是不正确的 正如科迪·格雷所说,它运作,应当得到与接受的答复相同的答案。 无需 create。





相关问题
Bring window to foreground after Mutex fails

I was wondering if someone can tell me what would be the best way to bring my application to the foreground if a mutex was not able to be created for a new instance. E.g.: Application X is running ...

How to start WinForm app minimized to tray?

I ve successfully created an app that minimizes to the tray using a NotifyIcon. When the form is manually closed it is successfully hidden from the desktop, taskbar, and alt-tab. The problem occurs ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

Handle DataTable.DataRow cell change event

I have a DataTable that has several DataColumns and DataRow. Now i would like to handle an event when cell of this DataRow is changed. How to do this in c#?

Apparent Memory Leak in DataGridView

How do you force a DataGridView to release its reference to a bound DataSet? We have a rather large dataset being displayed in a DataGridView and noticed that resources were not being freed after the ...

ALT Key Shortcuts Hidden

I am using VS2008 and creating forms. By default, the underscore of the character in a textbox when using an ampersand is not shown when I run the application. ex. "&Goto Here" is not ...

WPF-XAML window in Winforms Application

I have a Winforms application coded in VS C# 2008 and want to insert a WPF window into the window pane of Winforms application. Could you explain me how this is done.

热门标签