Applies to: Nevron Diagram for .NET
How to change the standard highlighted points of the shapes?
When using a connector tool to connect a shape, and when the mouse cursor is close to the shape port, the port is highlighted as red square. You can change the standard highlighted points of the diagram shapes by overriding the PaintHighlightedPoints method of the NDrawingView. Following is the default implementation:
[C#]
protected
virtual
void
PaintHighlightedPoints(NPaintContext context)
{
if
(m_HighlightedPoints ==
null
)
return
;
if
(m_HighlightedPointsStroke ==
null
)
{
m_HighlightedPointsStroke =
new
NStrokeStyle(
new
NLength(2, NGraphicsUnit.Pixel), Color.Red);
}
float
width = m_HighlightedPointsSize.Width;
float
height = m_HighlightedPointsSize.Height;
int
count = m_HighlightedPoints.Count;
context.Device.ActivateStyles(
null
, m_HighlightedPointsStroke,
null
);
IN2DPainter painter = context.Device.Painter;
for
(
int
i = 0; i < count; i++)
{
NPointF point = m_SceneToDevice.TransformPoint((NPointF)m_HighlightedPoints[i]);
painter.PaintRectangle(
new
NRectangleF(point.X - width / 2, point.Y - height / 2, width, height));
}
}
[VB.NET]
Protected
Overridable
Sub
PaintHighlightedPoints(context
As
NPaintContext)
If
m_HighlightedPoints
Is
Nothing
Then
Return
End
If
If
m_HighlightedPointsStroke
Is
Nothing
Then
m_HighlightedPointsStroke =
New
NStrokeStyle(
New
NLength(2, NGraphicsUnit.Pixel), Color.Red)
End
If
Dim
width
As
Single
= m_HighlightedPointsSize.Width
Dim
height
As
Single
= m_HighlightedPointsSize.Height
Dim
count
As
Integer
= m_HighlightedPoints.Count
context.Device.ActivateStyles(
Nothing
, m_HighlightedPointsStroke,
Nothing
)
Dim
painter
As
IN2DPainter = context.Device.Painter
For
i
As
Integer
= 0
To
count - 1
Dim
point
As
NPointF = m_SceneToDevice.TransformPoint(
DirectCast
(m_HighlightedPoints(i), NPointF))
painter.PaintRectangle(
New
NRectangleF(point.X - width / 2, point.Y - height / 2, width, height))
Next
End
Sub
The view will display all highlight points with the same appearance.
Article ID: 81, Created On: 10/8/2010, Modified: 11/15/2010