.NET – Draw when design

I created a custom list view control. Every time I add a new column, I set it to add a new button.
When I run the custom control that contains me In the program, the column buttons are placed correctly. However, in the design, when I add or delete columns, the control does not update the added buttons.

They are normal at runtime, but When designing, I need to close the form and reopen it (force redrawing) to update the column buttons.
How to force redraw the user control programmatically?
Column properties are as follows:

 _
_
_
_
Public ReadOnly Property Columns() As ListView.ColumnHeaderCollection
Get
Return ListView1.Columns
End Get
End Property

I tried to redraw like this Controls:

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, it doesn’t work. At design time, every time a column is added, the corresponding Button.

is just a simple idea and may not be the best solution, but it doesn’t There is no harm to try, I guess it works, even if I say, this is not the best way.

In the Sub for adding/removing columns, add the following:

Dim Graphics As Graphics = [yourform].CreateGra phics
Dim ParamArg As New PaintEventArgs(Graphics, [yourform].ClientRectangle)
InvokePaint(Me, ParamArgs)

Every time you add/remove, this will enforce annoying Thing.

I created a custom list view control. Every time I add a new column, I set it to add a new button.
When I When I run the program that contains my custom control, the column buttons are placed correctly. However, at design time, when I add or delete columns, the control does not update the added buttons.

They are in It is normal at runtime, but at design time I need to close the form and reopen it (force redrawing) to update the column buttons.
How to force the user control to be redrawn programmatically?
Column properties are as follows:

 _
_
_
_
Public ReadOnly Property Columns() As ListView.ColumnHeaderCollection
Get
Return ListView1.Columns
End Get
End Property

I tried to redraw like this Controls:

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, it doesn’t work. At design time, every time a column is added, the corresponding Button.

It’s just a simple idea, may not be the best solution, but it doesn’t hurt to try, I guess it works, even if I Say, this is not the best way.

In the Sub used to add/remove columns, add the following:

Dim Graphics As Graphics = [yourform].CreateGraphics
Dim ParamArg As New PaintEventArgs(Graphics, [you rform].ClientRectangle)
InvokePaint(Me, ParamArgs)

Every time you add/remove, this will enforce annoying things.

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3368 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.