My form has a background picture on it. Over this is a Picture Box with its BackColour set to "Transparent"
I draw on the picture box as follows :-
Public Class Form1
Public Line_Width As Integer = 3
Public myPen As Pen = New Pen(Drawing.Color.Black, Line_Width)
Private Sub PictureBox1_MouseMove(sender As Object, e As MouseEventArgs) Handles PictureBox1.MouseMove
Static last As New Point
If e.Button = Windows.Forms.MouseButtons.Left Then
Me.PictureBox1.CreateGraphics.DrawLine(myPen, last.X, last.Y, e.X, e.Y)
last = e.Location
This works fine, draws black lines all over the PictureBox. Now I want to erase some of the lines I have just drawn (some, not all). I have a button on the form, its function is to change the pen colour to "Transparent"
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
myPen = New Pen(Drawing.Color.Transparent, 10)
The idea is that drawing a "Transparent" line over an existing "Black" line should erase the Black line. Unfortunatly this does not work.
Any suggestions as to why this does not work, and any ideas as to how I can use the mouse to selectivly erase the black lines?