2013-08-19 49 views
-1

我有一个C#窗体窗体应用程序,显示一个覆盖窗体与不透明度显示“请稍等......”从服务器获取数据时。c#windows窗体覆盖大小,但显示背景形式controlbox

覆盖窗体的宽度和高度与主窗体相同,但我想知道如何让叠加窗体仅显示顶部标题主窗体,以便可以单击ControlBox(关闭,最小化等)按钮。

我需要的是知道主窗体标题栏的高度属性。

欣赏任何指南。

感谢

+0

检查答案:[如何获取Winforms表单标题栏高度的大小?](http://stackoverflow.com/a/2022684/69809)。 – Groo

+0

我很难理解你想要做什么。也许这会对你的问题有帮助,包括一些示例代码和截图。 –

回答

0

假设你的覆盖形式是splash

splash.StartPosition = FormStartPosition.Manual;//This is important to inialially position the splash correctly (at starting). 
splash.Location = mainForm.PointToScreen(Point.Empty); 

然而,使其正常工作,你需要更多的代码:

//LocationChanged event handler for your mainForm 
private void mainForm_LocationChanged(object sender, EventArgs e){ 
    splash.Location = mainForm.PointToScreen(Point.Empty); 
} 

,并显示您的splash时,你需要这样的事情:

splash.Show(mainForm); 
//if you call it in your mainForm class, just use the keyword this 
splash.Show(this);