ImageMapOwnerDraw Property
This is used to turn owner draw mode on and off
Namespace: EWSoftware.ImageMaps.Windows.FormsAssembly: EWSoftware.ImageMaps.Windows.Forms (in EWSoftware.ImageMaps.Windows.Forms.dll) Version: 2023.1.3.0
public bool OwnerDraw { get; set; }
Public Property OwnerDraw As Boolean
Get
Set
public:
property bool OwnerDraw {
bool get ();
void set (bool value);
}
member OwnerDraw : bool with get, set
Property Value
BooleanWhen true, the control will fire the
DrawImage event to allow you to draw the
image map and the individual image areas. Note that image areas can still be set to owner drawn even
if the image map is not.
This is an example of an owner drawn image event handler. For some other examples, see the demo application.
/// <summary>
/// When the image map is owner drawn, you can draw just the background
/// or you can draw the image areas too.
/// </summary>
/// <param name="sender">The sender of the event (the image map)</param>
/// <param name="e">The event arguments</param>
private void imMap_DrawImage(object sender, DrawImageEventArgs e)
{
// For this demo, we'll just draw a gradient fill background.
// You could get the image using the ImageMap.Image property too.
// Offset the drawing rectangle by the image offset in the event
// arguments. This indicates the true position of the image when
// centered or scrolled.
Rectangle r = new Rectangle(e.ImageOffset.X, e.ImageOffset.Y,
imMap.ImageMapWidth, imMap.ImageMapHeight);
using(LinearGradientBrush lgBrush = new LinearGradientBrush(r,
Color.White, Color.SteelBlue, LinearGradientMode.ForwardDiagonal))
{
e.Graphics.FillRectangle(lgBrush, r);
}
e.Graphics.DrawString("All items seen on this form are drawn by " +
"the image map or image area DrawImage event handlers. " +
"Even with owner draw disabled for the image map, image " +
"areas can still be set to owner drawn.", imMap.Font,
Brushes.Black, new Rectangle(r.X + 250, r.Y + 10, 325, 100),
sfFormat);
// The image map can draw areas too. In this case, we defer to
// the event handlers as they'll take over if owner drawing of the
// image map is turned off.
this.OwnerDrawOnOff_DrawImage(sender, e);
this.VisitWebSite_DrawImage(sender, e);
}
''' <summary>
''' When the image map is owner drawn, you can draw just the background or
''' you can draw the image areas too.
''' </summary>
''' <param name="sender">The sender of the event (the image map)</param>
''' <param name="e">The event arguments</param>
Private Sub imMap_DrawImage(sender As Object, e As DrawImageEventArgs) _
Handles imMap.DrawImage
' For this demo, we'll just draw a gradient fill background.
' You could get the image using the ImageMap.Image property too.
' Offset the drawing rectangle by the image offset in the event
' arguments. This indicates the true position of the image when
' centered or scrolled.
Dim r As New Rectangle(e.ImageOffset.X, e.ImageOffset.Y, _
imMap.ImageMapWidth, imMap.ImageMapHeight)
Using lgBrush As New LinearGradientBrush(r, _
Color.White, Color.SteelBlue, LinearGradientMode.ForwardDiagonal)
e.Graphics.FillRectangle(lgBrush, r)
End Using
e.Graphics.DrawString("All items seen on this form are drawn by " & _
"the image map or image area DrawImage event handlers. " & _
"Even with owner draw disabled for the image map, image " & _
"areas can still be set to owner drawn.", imMap.Font, _
Brushes.Black, New RectangleF(r.X + 250, r.Y + 10, 325, 100), _
sfFormat)
' The image map can draw areas too. In this case, we defer to
' the event handlers as they'll take over if owner drawing of the
' image map is turned off.
Me.OwnerDrawOnOff_DrawImage(sender, e)
Me.VisitWebSite_DrawImage(sender, e)
End Sub
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.