简体   繁体   中英

Windows Forms Application C# - Tab Control items shift location after running on debug mode

Currently working on a Form in Visual Studio. My form has a tab control with 4 tabs and one particular tab experiences some issues after running on debug mode. Once I stop and go back to build mode, all items (buttons, labels, textboxes) shift downwards and I am left with a huge blank space the size of the tab height. This means I have to scroll down the tab to find my buttons. This happens after every debug and the "blank spaces" add up on top of another, pushing all the buttons further down.

The tab is set to AutoScroll: True and Dock: Fill . I set items to Locked: True but issue still occurs.

Any idea as to why this is occurring?

Try setting Location property for the tab control. You can do this from properties window or explicitly assign System.Drawing.Point object to this property. Similarly for Size property you can use System.Drawing.Size

eg:

TabControl.Location = new System.Drawing.Point(0, 0);

TabControl.Size = new System.Drawing.Size(450, 295);

I know usually this is already taken care of by Visual Studio, still I prefer setting locations and sizes manually so that I can be sure it's working in the way I want it to work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM