Freigeben über


Shape.Click Event

Occurs when the shape is clicked.

Namespace:  Microsoft.VisualBasic.PowerPacks
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)

Syntax

'Declaration
<BrowsableAttribute(True)> _
Public Event Click As EventHandler
[BrowsableAttribute(true)]
public event EventHandler Click
[BrowsableAttribute(true)]
public:
 event EventHandler^ Click {
    void add (EventHandler^ value);
    void remove (EventHandler^ value);
}
[<BrowsableAttribute(true)>]
member Click : IEvent<EventHandler,
    EventArgs>
JScript does not support events.

Remarks

The Click event passes an EventArgs to its event handler. Therefore, it only indicates that a click has occurred. If you need more specific mouse information (such as the button, the number of clicks, the wheel rotation, or the location), use the MouseClick event. However, the MouseClick event will not be raised if the click is caused by action other than that of the mouse, such as pressing the ENTER key.

A double-click is determined by the mouse settings of the user's operating system. The user can set the amount of time between clicks of a mouse button that determine what should be considered a double-click instead of two clicks. The Click event is raised every time that a control is double-clicked. For example, if you have event handlers for the Click and DoubleClick events of a Shape, the Click and DoubleClick events are raised when the shape is double-clicked, and both methods are called.

For more information about how to handle events, see Consuming Events.

Examples

The following example shows how to respond to the Click event in an event handler. This example requires that you have a RectangleShape control named RectangleShape1 on a form.

Private Sub RectangleShape1_Click() Handles RectangleShape1.Click
    ' Set properties to display a gradient fill.
    RectangleShape1.FillColor = Color.Blue
    RectangleShape1.FillGradientColor = Color.Red
    RectangleShape1.FillGradientStyle = 
      PowerPacks.FillGradientStyle.Horizontal
    RectangleShape1.FillStyle = PowerPacks.FillStyle.Solid
End Sub
private void rectangleShape1_Click(System.Object sender, System.EventArgs e)
{
    // Set properties to display a gradient fill.
    rectangleShape1.FillColor = Color.Blue;
    rectangleShape1.FillGradientColor = Color.Red;
    rectangleShape1.FillGradientStyle = FillGradientStyle.Horizontal;
    rectangleShape1.FillStyle = FillStyle.Solid;
}

.NET Framework Security

See Also

Reference

Shape Class

Microsoft.VisualBasic.PowerPacks Namespace

Other Resources

How to: Draw Lines with the LineShape Control (Visual Studio)

How to: Draw Shapes with the OvalShape and RectangleShape Controls (Visual Studio)

Introduction to the Line and Shape Controls (Visual Studio)