子窗体使用整个客户区?
我想显示一个 MDI 子窗口,它将使用整个客户区,即。 灰色部分没有任务窗格的右侧,并让子窗口显示其标题栏和边框:
http://img149.imageshack.us/img149/3204/delphimdichildwindowwit.jpg
这是代码,它无法按计划工作:
procedure TForm1.RzGroup1Items0Click(Sender: TObject);
var
Form2 : TForm2;
begin
Form2 := TForm2.Create(Application);
//BAD : doesn't start at 0,0, and triggers horizontal scrollbar
Form2.Align := alClient;
//BAD : doesn't show titlebar and borders
Form2.WindowState := wsMaximized;
//BAD : window exceeds width -> horizontal scrollbar shown
Form2.top := 0;
Form2.Left := 0;
Form2.Width := Self.ClientWidth;
Form2.Height := Self.ClientHeight;
end;
除了自己计算坐标之外,还有其他方法可以做到这一点(例如客户端宽度等)?
谢谢。
I'd like to show an MDI child window that will use the whole client area, ie. the grey part no the right-side of the taskpane, and have the child window show its titlebar and borders:
http://img149.imageshack.us/img149/3204/delphimdichildwindowwit.jpg
Here's the code, which doesn't work as planned:
procedure TForm1.RzGroup1Items0Click(Sender: TObject);
var
Form2 : TForm2;
begin
Form2 := TForm2.Create(Application);
//BAD : doesn't start at 0,0, and triggers horizontal scrollbar
Form2.Align := alClient;
//BAD : doesn't show titlebar and borders
Form2.WindowState := wsMaximized;
//BAD : window exceeds width -> horizontal scrollbar shown
Form2.top := 0;
Form2.Left := 0;
Form2.Width := Self.ClientWidth;
Form2.Height := Self.ClientHeight;
end;
Is there a way to do this, besides computing the coordinates myself (eg. ClientWidth, etc.)?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最快的方法是使用 TILE 命令。
TILE 是 TForm 的一种方法,如果您只有 1 个 MDI 子窗口,它将完全按照您的要求执行。 如果超过 1,它将排列所有可见的子窗口以适应类似的布局。
瑞安.
The quickest way to do that would be the TILE command.
TILE is a method of TForm and if you only have 1 MDI child window it will do exactly what you want. With more that 1 it will then arrange all the visible child windows to fit in a similar layout.
Ryan.
以下代码将为您提供 MDI 客户区的矩形。 请注意,对抗 MDI 是很困难的。
The following code will give you the rect of the MDI client area. Please note that fighting MDI is hard.