views:

51

answers:

2

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. 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
A: 

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

dutt
A: 

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

eschneider