Skip to content

Instantly share code, notes, and snippets.

@hexbinoct
Created February 2, 2022 08:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hexbinoct/4bde2e339ccceded197b9b01b27ba35d to your computer and use it in GitHub Desktop.
Save hexbinoct/4bde2e339ccceded197b9b01b27ba35d to your computer and use it in GitHub Desktop.
in an mdi app, add 2 seperate forms form1 and form2, put a lable in form2, and Anchor it to bottom. start the app, show form1 as max, now show form2, because form1 was max, form2 will also show as max, you will see label in form2 at the correct place. Now, in code, goto the load event of form2, just type label1.Text="hi". Now run the app again, show form1 maximized, and now show form2, it will open maximized, but the anchoring of label will be disturbed, now its not where it was supposed to be, now its distance from top of the form is what it was in the designer.
Now if you move the statement label1.Text="hi" from form's Load event to Shown event, the anchoring bug is disappears.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment