Hello Guys, I am building an application using C# as a front end(VS 2008).
I have a main form which contains a main menu and other controls like labels, calendar etc.. the main form I am talking about starts as full screen, my problem is when I drag/drop/edit controls in design mode and run the application, the controls are not in the same place as i putted them in design mode. [i.e] I placed a calendar in design mode in the center of the form, and another label as a footer, so when i run the application i found the calendar and the label went up few inches up.

Any help would be appreciated.

Edited 5 Years Ago by wissam.ashkar: edit

Hello Guys, I am building an application using C# as a front end(VS 2008).
I have a main form which contains a main menu and other controls like labels, calendar etc.. the main form I am talking about starts as full screen, my problem is when I drag/drop/edit controls in design mode and run the application, the controls are not in the same place as i putted them in design mode. [i.e] I placed a calendar in design mode in the center of the form, and another label as a footer, so when i run the application i found the calendar and the label went up few inches up.

Any help would be appreciated.

Can you post a screenshot of the problem and any code that you think might be suspect?

If you are using a MDI, the menu might move off of your form and onto the parent form which could make it look different.

Edited 5 Years Ago by zachattack05: n/a

The label at the bottom is probably moving because the anchor for it is set to "Top, Left". Try changing it to "Bottom, Left, Right" or something along those lines to keep it in place.

The calendar is probably having the same problem. Maybe set it to "Top, Left, Right"

If you already have the anchor set correctly, the next question I would ask is, are you using any layout tables, panels or anything like that?

Thank you zachattack05, I wasn't familiar with anchor thing, now I edited my controls anchors and the form is having a better look than previous.
Yea I am using panels in other forms, but in this one I prefer something else, can you give me more useful layout tables?

Panels are okay, just remember though, the anchor is only for the the control's parent container. So...if, for example, you have a form with PanelA and a label control LabelA inside that panel, when you set the anchor on the label, it will adhere to the PanelA rules.

I attached an example to show what I mean.

In the example, you can see that the label ignores the size of the window even with the anchor set. It does that because the anchor is relative to the panel, and the panel is set to Top, Left for both. If I changes the panel to "Dock Fill" the form, or if I changed the anchor of the panel, the label would react differently.

Honestly, I find the programming logic, the code writing or whatever you want to call it, MUCH easier than form design...I HATE messing around with layouts...it's so frustrating.

Edited 5 Years Ago by zachattack05: n/a

Attachments topleft0.JPG 35.27 KB topleft1.jpg 15.63 KB topright0.JPG 29.43 KB topright1.jpg 15.83 KB
This question has already been answered. Start a new discussion instead.