Home > Net >  VB.Net drawing graphics class in the paint, shows a figure
VB.Net drawing graphics class in the paint, shows a figure

Time:10-09

VB.Net drawing graphics class in the paint event, show no,,

CodePudding user response:

What code is in unnatural all have no, who knows

CodePudding user response:

 
Public Class Form1
Public Property PictureBox1 As Object
Private Sub Form1_Paint (sender As object, e As PaintEventArgs) Handles Form1. Paint
Dim g As Graphics=Me. PictureBox1. CreateGraphics
Dim mpen As New Pen (Color Red)
G.D rawLine (mpen, 0, 80, 0, 160)
End Sub
End the Class

CodePudding user response:

Is a very simple code, just contact, don't understand why just don't figure out,

CodePudding user response:

Where did PictureBox1 assignment? How do the object types? Also did not see the defined size, the complete code?

Remove the sentence PictureBox1 defined statement, drag a PictureBox control at the interface between the ok


CodePudding user response:

And normal usage, you in PictureBox1 drawing, with the Picture Box, don't use From1,
 Private Sub PictureBox1_Paint (sender As Object, e As PaintEventArgs) Handles PictureBox1. Paint 

Dim mpen As New Pen (Color. Green)
Um participant raphics. DrawLine (mpen, 10, 80, 10, 160)

End Sub

CodePudding user response:

PictureBox1. Image=g

CodePudding user response:

With e in this Graphics object,

Refer to the 5 floor
  • Related