Why can the drawing, but it is not a flash,
What a great god can solve, thank!
Private Sub Button1_Click (ByVal sender As Systemobject, ByVal e the As System. EventArgs) Handles for. Click
DrawALine (PageToShow, Color Red, 50, 50, 5, 100)
End Sub
"Establish a mapping of the following functions
Public Sub DrawALine (ByVal WhereToDraw as Picturebox, ByVal Draw_Color as Color,
ByVal StartPoint_X As an Integer, ByVal the StartPoint Y As an Integer, ByVal Line_Width As an Integer, ByVal Line_Height As Integer)
Dim Pic As New PictureBox
With Pic
.name="Pic"
Size=New Size (Line_Width + 6, Line_Height + 6) SizeMode=PictureBoxSizeMode. StretchImage
The Parent=WhereToDraw
Location=New Point (StartPoint_X - 3 StartPoint_Y - 3)
End With
Dim g As Graphics=Pic. CreateGraphics () defines the canvas Dim DrawPen As New Pen (Draw_color Line_Width)
G.D rawLine (Draw_Pen, 3, 3, 3 + Line_Width, 3 + Line_Height)
Ernd Suib
CodePudding user response:
There may be knocked at the wrong in the sentence, the code is modified based on photo scanning, you forgive meCodePudding user response:
You know how the control display?Painting background control first, and then apply colours to a drawing control, and then perform user mapping,
Your event to the button on the control mapping, when control obscured or refresh, can make the control system is invalid, trigger the WM_PAINT, redraw the control, before you paint is not
You can put the code on the control of Paint, but will be flashing, you could look at the double buffer drawing can solve your problem.
CodePudding user response: