I created a listview user control. I set it to add a new button every time I add a new column.
When I run a program that contains my user control, the column buttons are placed correctly. However, during development, when I add or remove columns, the control does not update the added buttons.
They are fine at runtime, but at design time I need to close the form and reopen it (force redo) to refresh the column buttons.
How can I programmatically force a redraw of my User Control?
The Column property is as follows:
<MergableProperty(False)> _ <Editor("System.Windows.Forms.Design.ColumnHeaderCollectionEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", GetType(UITypeEditor))> _ <DesignerSerializationVisibility(DesignerSerializationVisibility.Content)> _ <Localizable(True)> _ Public ReadOnly Property Columns() As ListView.ColumnHeaderCollection Get Return ListView1.Columns End Get End Property
And I tried to redraw the control as follows:
Me.Invalidate() Dim x As New Rectangle With {.X = Me.Location.X, .Y = Me.Location.Y, .Size = Me.Size} Me.NotifyInvalidate(x)
But for some reason its not working. During design, each time Ii adds a column, the corresponding button is not added.
source share