Hi,
Am trying to do the simplest of things in winforms/vb using the RadDiagram ..
My use case is simply changing the color of a shape when the mouse enters it and back again when it leaves it.
I have been experimenting with the events and their behaviors and cannot explain/figure out the following :
- mouse leave event fires correctly on the boundary of the shape (works as expected)
- mouse enter event fires only when the shape is selected and when touching the connector borders (the four default ones - up/down/left/right). the mouse changes to resize cursor when touching the four corner connectors
Below is my simple test code -
Imports System.GlobalizationImports System.MathImports System.Drawing.Drawing2DImports System.Drawing.ColorImports Telerik.WindowsImports Telerik.Windows.Diagrams.CoreImports Telerik.WinControls.UIImports Telerik.WinControls.UI.DiagramsPublic Class RadForm1 Public Sub New() ' This call is required by the designer. InitializeComponent() ' Add any initialization after the InitializeComponent() call. End Sub Private Sub NewItemToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles NewItemToolStripMenuItem.Click Dim shape As LayoutShape = New LayoutShape() RadDiagram1.AddShape(shape) End Sub Private Sub RadDiagram1_ShapeClicked(sender As Object, e As ShapeRoutedEventArgs) Handles RadDiagram1.ShapeClicked Dim shape As LayoutShape = TryCast(e.Shape, LayoutShape) If (shape IsNot Nothing) Then shape.BackColor = Green ' reset End If End SubEnd ClassPublic Class LayoutShape Inherits RadDiagramShape Public Sub New() IsEditable = False Shape = New Telerik.WinControls.RoundRectShape(5) AutoSize = False BorderBrush = New System.Drawing.SolidBrush(System.Drawing.Color.Red) ShouldHandleMouseInput = True SetBounds(0, 0, 100, 25) BackColor = Green Position = New Point(100, 100) IsEditable = False AutoToolTip = False NotifyParentOnMouseInput = True End Sub Public Sub LayoutShape_MouseLeave(sender As Object, e As EventArgs) Handles Me.MouseLeave Dim shape As LayoutShape = TryCast(sender, LayoutShape) shape.BackColor = Blue End Sub Private Sub LayoutShape_MouseEnter(sender As Object, e As EventArgs) Handles Me.MouseEnter Dim shape As LayoutShape = TryCast(sender, LayoutShape) shape.BackColor = Yellow End SubEnd Class