Shape.ModifierKeys Property

 

Gets a value indicating which of the modifier keys (SHIFT, CTRL, and ALT) is in a pressed state.

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

Syntax

[BrowsableAttribute(false)]
public static Keys ModifierKeys { get; }
public:
[BrowsableAttribute(false)]
property Keys ModifierKeys {
    static Keys get();
}
[<BrowsableAttribute(false)>]
static member ModifierKeys : Keys with get
<BrowsableAttribute(False)>
Public Shared ReadOnly Property ModifierKeys As Keys

Property Value

Type: System.Windows.Forms.Keys

A bitwise combination of the Keys values. The default is None.

Examples

The following example hides a shape when the CTRL key is pressed when the shape is clicked. This example requires that you have a RectangleShape named RectangleShape1 on a form.

private void rectangleShape1_Click(System.Object sender, System.EventArgs e)
{
    if (Shape.ModifierKeys == Keys.Control)
    {
        ((Shape)sender).Hide();
    }
}
Private Sub RectangleShape1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RectangleShape1.Click
    If Shape.ModifierKeys = Keys.Control Then
        CType(sender, Shape).Hide()
    End If
End Sub

See Also

Shape Class
Microsoft.VisualBasic.PowerPacks Namespace
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)

Return to top