开发者

Form not updating usercontrol

开发者 https://www.devze.com 2022-12-28 22:58 出处:网络
From the post \"Growing user control not updating\"... Using C#, .Net 2.0 in a Windows environment. UserControl1 - draws cells to a bitmap buffer dependent upon NumberOfCells property

From the post "Growing user control not updating"... Using C#, .Net 2.0 in a Windows environment.

UserControl1 - draws cells to a bitmap buffer dependent upon NumberOfCells property UserControl2 - panel contains UserControl1 which displays vertical scroll when necessary; also contains NumberOfCells which sets UserControl1's NumberOfCells开发者_StackOverflow. Formf1 - contains NumericUpDown controls (just increments) which updates the UserControl2 - suppose to!

When I increment the control on the form by say 20, UserControl1 adds the necessary cells, UserControl2 displays the vertical scroll bar accordingly, BUT the form does not 'redraw' to the updated/correct image!! Meaning, after I increment by 20, cells are added, vertical scrool bar added... but the image shown is just everything else expanding.

I reset the control to scoll to the very TOP and the scrolling works, but the image is still staic... UNTIL I resize my form, more specifically, when I change it from maximize to window or vice versa!!!

What can I do to 'reset/redraw' the correct image???? Thank you in advance.

  • Lawrence


If this is C# and Windows Forms I would try calling Update() or Refresh() on the control to make it redraw itself.


Try calling Refresh in the Scroll events and the NumberOfCells Property.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号