VB.NET:
Imports System.Drawing.Drawing2D
Public Class Form1
Private myPath As New GraphicsPath
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.DoubleBuffered = True
End Sub
Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
If myPath.IsVisible(e.X, e.Y) = True Then
Panel1.Visible = True
Panel1.Location = New Point(e.X, e.Y - Panel1.Height)
Else
Panel1.Visible = False
End If
End Sub
Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
myPath.AddRectangle(New Rectangle(457, 428, 602 - 457, 472 - 428))
Dim myPen As New Pen(Color.Black, 1)
e.Graphics.DrawPath(myPen, myPath)
End Sub
End Class
I've got a picturebox in a wpf, in which I've drawn a rectangle (and polygons) using graphics path. If the user mouses over the rectangle area, determined by the isVisible property, a panel pops up (like a tooltip) and displayed, and its location moved along the cursor position while the cursor is within the area. The panel has got a bunch of labels as attributes
I've used panel visible property to achieve this, but as the panel moves with the cursor, there is a lot of flickering. Is there any way to avoid flickering? I've tried using doublebuffered and setstyles
Please advise
thanks