4
Answers

Strange problem with Hide() then Show() changing position of a form by (22,29)

Tim Reiter

Tim Reiter

16y
3.3k
1

I'm running into a problem with a form changing position when I perform the Hide() method, then later performing the Show() method in C# (Visual C# Express 2005).

When I experimented with it a little, I was able to reproduce it just by repeatedly performing a Hide() then Show().

For example, I had a form object called SF.  I could cause it to move down and to the right just by performing:

SF.Hide();

SF.Show();

SF.Hide();

SF.Show();

etc...

Interestingly, the position of the dialog would always move by an offset of (22,29).  Someone on another forum pointed out that this is the offset used when another instance of the form is created, but that isn't the case here.

Any ideas?  Thanks!

Answers (4)