Dieser Artikel wurde maschinell übersetzt. Wenn Sie die englische Version des Artikels anzeigen möchten, aktivieren Sie das Kontrollkästchen Englisch. Sie können den englischen Text auch in einem Popupfenster anzeigen, indem Sie den Mauszeiger über den Text bewegen.



Veröffentlicht: Oktober 2016

Tritt ein, wenn auf die Form geklickt wird.

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

public event EventHandler Click

The Click event passes an T:System.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 E:Microsoft.VisualBasic.PowerPacks.Shape.MouseClick event. However, the E:Microsoft.VisualBasic.PowerPacks.Shape.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 E:Microsoft.VisualBasic.PowerPacks.Shape.DoubleClick events of a T:Microsoft.VisualBasic.PowerPacks.Shape, the Click and E:Microsoft.VisualBasic.PowerPacks.Shape.DoubleClick events are raised when the shape is double-clicked, and both methods are called.

For more information about how to handle events, see Handling and Raising Events.

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

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;
Zurück zum Anfang