Export (0) Print
Expand All

DesignerRegionMouseEventArgs Class

Provides data for a ViewEvent event that is raised when you click on a selected control or a designer region in a selected control. This class cannot be inherited.

Namespace: System.Web.UI.Design
Assembly: System.Design (in system.design.dll)

public sealed class DesignerRegionMouseEventArgs : EventArgs
public final class DesignerRegionMouseEventArgs extends EventArgs
public final class DesignerRegionMouseEventArgs extends EventArgs
Not applicable.

The ViewEvent event is raised by the designer host for certain actions on a control on the design surface. For example, an event is raised when you click a selected control or a designer region in a selected control on the design surface.

The ControlDesigner class supplies a default delegate to handle the ViewEvent event. When you click a selected control or a designer region of a selected control at design time, the designer host initializes a ViewEventArgs object for a Click event type, and then sets the EventArgs property with a DesignerRegionMouseEventArgs object.

When the ViewEventArgs object indicates that you clicked a designer region, the default delegate in the ControlDesigner class passes the DesignerRegionMouseEventArgs object to the OnClick method. Classes deriving from the ControlDesigner class override the OnClick method to process events that are raised when you click a control in the design host.

The Region property represents the control designer region that the event applies to, if any. The Location property represents the location on the design surface that was clicked.

For more information about events and delegates, see Events and Delegates.

The following code example shows how to use the DesignerRegionMouseEventArgs to identify the region that was clicked and to change the view accordingly. This example is part of a larger example provided for the EditableDesignerRegion class.

// Handler for the Click event, which provides the region in the arguments.
protected override void OnClick(DesignerRegionMouseEventArgs e)
{
    if (e.Region == null)
        return;

    // If the clicked region is not a header, return
    if (e.Region.Name.IndexOf("Header") != 0)
        return;

    // Switch the current view if required
    if (e.Region.Name.Substring(6, 1) != myControl.CurrentView.ToString())
    {
        myControl.CurrentView = int.Parse(e.Region.Name.Substring(6, 1));
        base.UpdateDesignTimeHtml();
    }
}

System.Object
   System.EventArgs
    System.Web.UI.Design.DesignerRegionMouseEventArgs

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show:
© 2014 Microsoft