-1

I have a C# windows form application that shows an overlay form with opacity for showing "Please wait..." when getting data from server.

The overlay form width and height is the same of Main Form but I would like to know how can I let overlay form to show only the top title main form so the ControlBox (close, minimize, etc) buttons can be clicked.

What I would need is to know the height property of the Main Form Title bar.

Appreciate any guide.

Thanks

VAAA
  • 14,531
  • 28
  • 130
  • 253
  • Check this answer: [How to get the size of a Winforms Form titlebar height?](http://stackoverflow.com/a/2022684/69809). – vgru Aug 19 '13 at 15:18
  • I'm having trouble understand what you're trying to do. Perhaps it would be helpful to [edit] your question to include some sample code and a screenshot. – Cody Gray - on strike Aug 19 '13 at 15:34

1 Answers1

0

Suppose your overlay form is splash:

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

However to make it works as expected, you need more code:

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

And when showing your splash, you need something like this:

splash.Show(mainForm);
//if you call it in your mainForm class, just use the keyword this
splash.Show(this);
King King
  • 61,710
  • 16
  • 105
  • 130