简体   繁体   中英

In a form with a tabbed control, a button click reduces panel-height in tab page in focus, which gets corrected if move to another tab and come back

I have a fixed size form containing a tabcontrol component, which has two tab pages. The tab pages contain panels with tables which may contain a variable amount of data to be displayed. When I press a 'Refresh' button, in its event handler, I reinitialize the values in the table. So far, I do not recalculate the height of the panels. But the height of the panel on the tab page in focus somehow reduces by a small amount, ie, when you scroll down to the bottom of the panel, some data gets cut off. But if I switch focus to another tab page, that tab page appears fine. Also, when I switch back to the original tab page, now that also appears fine. Can someone explain why this happens, and how can I fix it?

I think I used to have a similar problem and I solved it with

tabControl.TabPages[tabPage].Refresh();

after reinitializing the values... But I have no idea why it happens.

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