Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private bit As New System.Drawing.Bitmap(250, 250)
- Private gg As Graphics = Graphics.FromImage(Me.PictureBox1.Image)
- ' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- ' ^^^^^^^^^^ HERE IS THE PROBLEM ^^^^^^^^^^^^^^^^^^^^^^
- ' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Private br As New Pen(Color.Red)
- Private dwn As Boolean
- Private lst As Point
- Private firstrun As Boolean = True
- Dim Tloustka As Integer = 10
- Dim Barva As Integer
- Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown
- 'gg = Graphics.FromImage(Me.PictureBox1.Image)
- dwn = True
- End Sub
- Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
- If dwn = True Then
- Dim s As Integer
- Dim xy As Point
- Dim br2 As New SolidBrush(Color.FromName("White"))
- s = Tloustka
- br.Color = Color.FromName("White")
- br.Width = Tloustka
- xy.X = e.X
- xy.Y = e.Y
- If firstrun = True Then
- lst = xy
- firstrun = False
- End If
- gg.FillEllipse(br2, xy.X - CLng(s / 2), xy.Y - CLng(s / 2), s, s)
- gg.DrawLine(br, lst, xy)
- lst = xy
- PictureBox1.Image = bit
- End If
- End Sub
- etc. etc. etc.
- Private Sub PictureBox1_MouseMove(sender As Object, e As MouseEventArgs) Handles PictureBox1.MouseMove
- If dwn = True Then
- Using g As Graphics = Graphics.FromImage(bit)
- Dim s As Integer
- Dim xy As Point
- Using br2 As New SolidBrush(Color.FromName("White"))
- s = Tloustka
- br.Color = Color.FromName("White")
- br.Width = Tloustka
- xy.X = e.X
- xy.Y = e.Y
- If firstrun = True Then
- lst = xy
- firstrun = False
- End If
- g.FillEllipse(br2, xy.X - CLng(s / 2), xy.Y - CLng(s / 2), s, s)
- g.DrawLine(br, lst, xy)
- End Using
- End Using
- lst = xy
- PictureBox1.Invalidate()
- End If
- End Sub
- Private Sub PictureBox1_Paint(sender As Object, e As PaintEventArgs) Handles PictureBox1.Paint
- e.Graphics.DrawImage(bit, Point.Empty)
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement