views:

89

answers:

2

I am developing in C# and .Net 2.0. I have a user control that draws cells (columnar) depending upon the maximum number of cells. There are some drawing routines that generate the necessary cells. There is a property NumberOfCells that adjust the height of this control; CELLHEIGHT_CONSTANT * NumberOfCells. The OnPaint() method is overridden (code that draws the Number of cells).

There is another user control that contains a panel which contains the userControl1 from above. There is a property NumberCells that changes userControl1's NumberOfCells.

UserControl2 is then placed on a windows form. On that form there is a NumericUpDown control (only increments from 1). When the user increments by 1, I adjust the VerticalScroll.Maximum by 1 as well.

Everything works well and good BUT when I increment once, the panel updates fine (inserts a vertical scrolll when necessary) but cells are not being added! I've tried Invalidating on userControl2 AND on the form but nothing seems to draw the newly added cells.

Any assistance is appreciated. Thank you in advance.

  • Lawrence
A: 

Try debugging and check that the NumberOfCells property is properly being set. If it is and the cells still do not show after the window has invalidated (say, by minimizing then restoring the window), you have a problem with your cell-drawing method.

If after minimizing/restoring the cells show up, you need to call Invalidate(CellRegion) in the setter for NumberOfCells

BlueRaja - Danny Pflughoeft
A: 

Are you resizing the controls when you add columns? If they are not big enough to show their entire contents, then they will simply clip them and you may not see any new column(s) that have been added.

Jason Williams