Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to clear a highlighted color of a picturebox image?

Status
Not open for further replies.

WomanPro

Programmer
Nov 1, 2012
180
GR
Hello everyone, I have a simple trouble, I have a button that in click event highlights an image of a picture box.
And I want when I click on the picture box, the image contained not to be highlighted. How can I do that?

Structure RectanglePointF
Public pnt1 As PointF
Public pnt2 As PointF
Public pnt3 As PointF
Public pnt4 As PointF
End Structure
Public LocalMousePosition As Point
Dim graphics As System.Drawing.Graphics

Dim g As System.Drawing.Graphics
Dim brsh As SolidBrush
Dim Highlighted As Boolean = False



Dim PointF_RectOut As New RectanglePointF

Private Sub HighlightPicture_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles HighlightPicture.Click
graphics = PB.CreateGraphics()

g = PB.CreateGraphics()
With PointF_RectOut.pnt1
.X = Convert.ToSingle(216)
.Y = Convert.ToSingle(268)
End With

With PointF_RectOut.pnt2
.X = Convert.ToSingle(16)
.Y = Convert.ToSingle(268)
End With
With PointF_RectOut.pnt3
.X = Convert.ToSingle(16)
.Y = Convert.ToSingle(76)
End With

With PointF_RectOut.pnt4
.X = Convert.ToSingle(216)
.Y = Convert.ToSingle(76)
End With

Dim ptsFArray As PointF() = {PointF_RectOut.pnt1, PointF_RectOut.pnt2, PointF_RectOut.pnt3, PointF_RectOut.pnt4}
g = PB.CreateGraphics()
brsh = New SolidBrush(Color.FromArgb(130, 255, 255, 0))
g.FillPolygon(brsh, ptsFArray)
brsh.Dispose()
End Sub

I tried
Private Sub PB_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles PB.Click
g.Clear(Color.FromArgb(0, 255, 255, 100))

End Sub

I don't know how to do it. Any suggestions?
Any help will be much appreciated.

Thank you so much in advanced.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top