Search
DiagramView.CreatingAreaElement Event
See Also
 





Allows adding custom attributes to the AREA elements generated in ImageMap mode.

Namespace: MindFusion.Diagramming.WebForms
Package: MindFusion.Diagramming.WebForms

 Syntax

C#  Copy Code

public event CreatingAreaElementEventHandler CreatingAreaElement

Visual Basic  Copy Code

Public Event CreatingAreaElement As CreatingAreaElementEventHandler

 Event Data

CreatingAreaElement event handlers receive an argument of type CreatingAreaElementEventArgs. The following CreatingAreaElementEventArgs members provide information relevant to the event:

Member name

Description 

Attributes

The custom attributes added for the specified Item.

Item

The diagram item whose AREA element is currently being created.

 Remarks

You could use this event to attach custom event handlers for various DOM events supported by the HTML AREA element. Note that the few built-in client-side events supported by ImageMap mode let you access only two properties of items - their ZIndex and Tag. In contrast, since CreatingAreaElement is raised on the server, you can access any attributes of the respective diagram item and include their value in your custom scripts.

 Example

This code shows how to attach a custom handler to the mousedown DOM event:

C#  Copy Code

// in the code-behind
protected void view_CreatingAreaElement(object sender, CreatingAreaElementEventArgs e)
{
    e.Attributes["onmousedown"] = "return onMouseDown(event)";
}

// in the ASPX file
function onMouseDown(e)
{
    if (e.button == 2)
        alert("right button");
    else
        alert("another button");

    return false;
}

 See Also