I have a picturebox and a transparent panel on my main form. panel is under the picturebox and has brought to the front. so that I can select it on the picturebox. Program draws a rectangle on the panel, when mouse is located on it. This rectangle was visible from the picturebox until I change the picture of the picturebox. Now when I move the mouse on top of the panel, I cannot see the rectangle. I tried "Bring to Front", but didn't work. This is the code that draws the rectangle on the panel on the main form:
Private Sub LSB2Panel_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LSB2Panel.MouseLeave
LSB2Panel_Highlighted = False
Invalidate(LSB2Panel.Bounds)
End Sub
If LSB1Panel_Highlighted Then
e.Graphics.DrawRectangle(PanelHighlightPen, ShrinkRect(LSB1Panel.Bounds, CType(PanelHighlightPen.Width, Integer)))
End If
Please help me to fix this program. It used to work.:confused:but don't offer any new way of programming, I am not supposed to change the code.
Private Sub LSB2Panel_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LSB2Panel.MouseLeave
LSB2Panel_Highlighted = False
Invalidate(LSB2Panel.Bounds)
End Sub
If LSB1Panel_Highlighted Then
e.Graphics.DrawRectangle(PanelHighlightPen, ShrinkRect(LSB1Panel.Bounds, CType(PanelHighlightPen.Width, Integer)))
End If
Please help me to fix this program. It used to work.:confused:but don't offer any new way of programming, I am not supposed to change the code.