Advertisement
Guest User

Untitled

a guest
Apr 20th, 2014
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. Private bit As New System.Drawing.Bitmap(250, 250)
  2. Private gg As Graphics = Graphics.FromImage(Me.PictureBox1.Image)
  3. ' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4. ' ^^^^^^^^^^ HERE IS THE PROBLEM ^^^^^^^^^^^^^^^^^^^^^^
  5. ' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  6. Private br As New Pen(Color.Red)
  7. Private dwn As Boolean
  8. Private lst As Point
  9. Private firstrun As Boolean = True
  10. Dim Tloustka As Integer = 10
  11. Dim Barva As Integer
  12.  
  13. Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown
  14. 'gg = Graphics.FromImage(Me.PictureBox1.Image)
  15. dwn = True
  16. End Sub
  17.  
  18.  
  19. Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
  20. If dwn = True Then
  21. Dim s As Integer
  22. Dim xy As Point
  23. Dim br2 As New SolidBrush(Color.FromName("White"))
  24. s = Tloustka
  25. br.Color = Color.FromName("White")
  26. br.Width = Tloustka
  27. xy.X = e.X
  28. xy.Y = e.Y
  29. If firstrun = True Then
  30. lst = xy
  31. firstrun = False
  32. End If
  33. gg.FillEllipse(br2, xy.X - CLng(s / 2), xy.Y - CLng(s / 2), s, s)
  34. gg.DrawLine(br, lst, xy)
  35. lst = xy
  36. PictureBox1.Image = bit
  37. End If
  38. End Sub
  39.  
  40. etc. etc. etc.
  41.  
  42. Private Sub PictureBox1_MouseMove(sender As Object, e As MouseEventArgs) Handles PictureBox1.MouseMove
  43. If dwn = True Then
  44. Using g As Graphics = Graphics.FromImage(bit)
  45. Dim s As Integer
  46. Dim xy As Point
  47. Using br2 As New SolidBrush(Color.FromName("White"))
  48. s = Tloustka
  49. br.Color = Color.FromName("White")
  50. br.Width = Tloustka
  51. xy.X = e.X
  52. xy.Y = e.Y
  53. If firstrun = True Then
  54. lst = xy
  55. firstrun = False
  56. End If
  57. g.FillEllipse(br2, xy.X - CLng(s / 2), xy.Y - CLng(s / 2), s, s)
  58. g.DrawLine(br, lst, xy)
  59. End Using
  60. End Using
  61. lst = xy
  62. PictureBox1.Invalidate()
  63. End If
  64. End Sub
  65.  
  66. Private Sub PictureBox1_Paint(sender As Object, e As PaintEventArgs) Handles PictureBox1.Paint
  67. e.Graphics.DrawImage(bit, Point.Empty)
  68. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement