ImageAreaRectangle Class

This is the rectangle image area class

Definition

Namespace: EWSoftware.ImageMaps.Windows.Forms
Assembly: EWSoftware.ImageMaps.Windows.Forms (in EWSoftware.ImageMaps.Windows.Forms.dll) Version: 2023.1.3.0
public class ImageAreaRectangle : ImageAreaBase
Inheritance
Object    ImageAreaBase    ImageAreaRectangle

Example

This example demonstrates creating a Windows Forms image map and its areas.
C#
using EWSoftware.ImageMaps;
using EWSoftware.ImageMaps.Windows.Forms;

// Example code that creates an image map and adds some image areas
ImageMap imMap = new ImageMap();

ImageAreaRectangle imageAreaRectangle1 = new ImageAreaRectangle();
ImageAreaCircle imageAreaCircle1 = new ImageAreaCircle();
ImageAreaPolygon imageAreaPolygon1 = new ImageAreaPolygon();
ImageAreaRectangle imageAreaRectangle2 = new ImageAreaRectangle();
ImageAreaEllipse imageAreaEllipse1 = new ImageAreaEllipse();

imageAreaRectangle1.AccessKey = "R";
imageAreaRectangle1.Rectangle = new System.Drawing.Rectangle(16, 16, 150, 94);
imageAreaRectangle1.TabIndex = 3;
imageAreaRectangle1.ToolTip = "A rectangle area";

imageAreaCircle1.AccessKey = "C";
imageAreaCircle1.CenterPoint = new System.Drawing.Point(380, 88);
imageAreaCircle1.Radius = 60;
imageAreaCircle1.TabIndex = 1;
imageAreaCircle1.ToolTip = "A circle area";

imageAreaPolygon1.AccessKey = "P";
imageAreaPolygon1.Points.AddRange(new System.Drawing.Point[] {
    new System.Drawing.Point(42, 186),
    new System.Drawing.Point(110, 286),
    new System.Drawing.Point(144, 250),
    new System.Drawing.Point(138, 230),
    new System.Drawing.Point(160, 216),
    new System.Drawing.Point(190, 214),
    new System.Drawing.Point(152, 168),
    new System.Drawing.Point(112, 172),
    new System.Drawing.Point(70, 154)});

imageAreaPolygon1.TabIndex = 2;
imageAreaPolygon1.ToolTip = "A polygon area";

imageAreaRectangle2.Action = AreaClickAction.None;
imageAreaRectangle2.Rectangle = new System.Drawing.Rectangle(316, 176, 206, 118);
imageAreaRectangle2.ToolTip = "A tool tip only area";

imageAreaEllipse1.AccessKey = "E";
imageAreaEllipse1.Ellipse = new System.Drawing.Rectangle(199, 88, 128, 58);
imageAreaEllipse1.TabIndex = 4;
imageAreaEllipse1.ToolTip = "An ellipse area";

imMap.Areas.AddRange(new IImageArea[] {
    imageAreaRectangle1,
    imageAreaCircle1,
    imageAreaPolygon1,
    imageAreaRectangle2
    imageAreaEllipse1 });

imMap.Anchor = ((System.Windows.Forms.AnchorStyles)
    ((((System.Windows.Forms.AnchorStyles.Top |
    System.Windows.Forms.AnchorStyles.Bottom)
    | System.Windows.Forms.AnchorStyles.Left)
    | System.Windows.Forms.AnchorStyles.Right)));

imMap.Image = ((System.Drawing.Image)(resources.GetObject("imMap.Image")));
imMap.Location = new System.Drawing.Point(8, 8);
imMap.Name = "imMap";
imMap.Size = new System.Drawing.Size(552, 448);
imMap.TabIndex = 0;
imMap.ToolTip = "A test image";

// Add a click event handler
imMap.Click += imMap_Click;

// A simple image area click handler
private void imMap_Click(object sender, ImageMapClickEventArgs e)
{
    MessageBox.Show(String.Format(
        "You clicked area #{0} ({1}) at point {2}, {3}",
            e.AreaIndex + 1, imMap.Areas[e.AreaIndex].ToolTip,
            e.XCoordinate, e.YCoordinate), "Image Map Clicked",
            MessageBoxButtons.OK, MessageBoxIcon.Information);
}

Constructors

ImageAreaRectangle Default constructor
ImageAreaRectangle(Rectangle) Constructor. This version takes the rectangle coordinates.
ImageAreaRectangle(Rectangle, String) Constructor. This version takes the rectangle coordinates and a tool tip.

Properties

AccessKey This is used to get or set the access key (a shortcut key or mnemonic) for the image area
(Inherited from ImageAreaBase)
Action This defines the action to take when the area is clicked
(Inherited from ImageAreaBase)
Coordinates This is overridden to get or set the coordinate values in string form
(Overrides ImageAreaBaseCoordinates)
Enabled This is used to enable or disable the area
(Inherited from ImageAreaBase)
OwnerDraw This is used to turn owner draw mode on and off
(Inherited from ImageAreaBase)
Rectangle This is used to get or set the rectangle's area
Shape This is overridden to provide the shape type
(Overrides ImageAreaBaseShape)
TabIndex This is used to get or set the tab index of the area
(Inherited from ImageAreaBase)
Tag This is used to get or set an object that contains additional user-defined data for the image area
(Inherited from ImageAreaBase)
ToolTip This is used to get or set the tool tip to display when the mouse hovers over the area
(Inherited from ImageAreaBase)

Methods

DrawFocusFrame This is overridden to get the shape to draw a focus frame around itself
(Overrides ImageAreaBaseDrawFocusFrame(Graphics, Point))
Equals This is overridden to allow proper comparison of image area objects.
(Inherited from ImageAreaBase)
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
GetHashCode Get a hash code for the image area object
(Inherited from ImageAreaBase)
GetTypeGets the Type of the current instance.
(Inherited from Object)
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
OnClick This raises the image area Click event
(Inherited from ImageAreaBase)
OnDoubleClick This raises the image area DoubleClick event
(Inherited from ImageAreaBase)
OnDrawImage This raises the image area DrawImage event
(Inherited from ImageAreaBase)
OnEnter This raises the image area Enter event
(Inherited from ImageAreaBase)
OnImageAreaChanged This raises the ImageAreaChanged event
(Inherited from ImageAreaBase)
OnLeave This raises the image area Leave event
(Inherited from ImageAreaBase)
OnMouseDown This raises the image area MouseDown event
(Inherited from ImageAreaBase)
OnMouseEnter This raises the image area MouseEnter event
(Inherited from ImageAreaBase)
OnMouseHover This raises the image area MouseHover event
(Inherited from ImageAreaBase)
OnMouseLeave This raises the image area MouseLeave event
(Inherited from ImageAreaBase)
OnMouseMove This raises the image area MouseMove event
(Inherited from ImageAreaBase)
OnMouseUp This raises the image area MouseUp event
(Inherited from ImageAreaBase)
RaiseEvent This is used to fire an event on the image area
(Inherited from ImageAreaBase)
ToString Convert the image area instance to its string description
(Inherited from ImageAreaBase)

Events

Click This event is raised when the image area is clicked
(Inherited from ImageAreaBase)
DoubleClick This event is raised when the image area is double-clicked
(Inherited from ImageAreaBase)
DrawImage This event is raised when owner draw mode is enabled and the image area needs to be drawn
(Inherited from ImageAreaBase)
Enter This event is raised when the image area gains the focus
(Inherited from ImageAreaBase)
ImageAreaChanged This event is raised when an image area property changes that affects its visual presentation in the image map control such as its position or enabled state.
(Inherited from ImageAreaBase)
Leave This event is raised when the image area loses the focus
(Inherited from ImageAreaBase)
MouseDown This event is raised when a mouse button is pressed while the mouse is inside the image area
(Inherited from ImageAreaBase)
MouseEnter This event is raised when the mouse enters the image area
(Inherited from ImageAreaBase)
MouseHover This event is raised when the mouse remains stationary inside the image area for an amount of time
(Inherited from ImageAreaBase)
MouseLeave This event is raised when the mouse leaves the image area
(Inherited from ImageAreaBase)
MouseMove This event is raised when the mouse moves in the image area
(Inherited from ImageAreaBase)
MouseUp This event is raised when a mouse button is released while the mouse is inside the image area
(Inherited from ImageAreaBase)

See Also