I’m calling System.Windows.Forms … SetDesktopBounds(x, y, width, height) on a form that was just created, but not shown. When I do Show the form, it does not go to my SetDesktopBounds spot, but shows up elsewhere.
If I Show the form, then SetDesktopBounds, then Hide it… it will be in the spot the next time I Show it. Anyone know what’s going on here? I don’t want to do a Show beforehand because then you get a flicker of the form as I set it up.
Calling Activate and/or CreateControl before calling SetDesktopBounds doesn’t work either.
Thanks!
You won’t get happy results if you call it before the form’s Load event fires. The real size of the window isn’t known until then, user preferences and rescaling will take effect when the native window is created. If you do it after Load then the repositioning will be visible. So this is best: