Shape.MouseButtons Property

Gets a value indicating which of the mouse buttons is in a pressed state.

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

Syntax

'Declaration
<BrowsableAttribute(False)> _
Public Shared ReadOnly Property MouseButtons As MouseButtons
[BrowsableAttribute(false)]
public static MouseButtons MouseButtons { get; }
[BrowsableAttribute(false)]
public:
static property MouseButtons MouseButtons {
    MouseButtons get ();
}
[<BrowsableAttribute(false)>]
static member MouseButtons : MouseButtons with get
static function get MouseButtons () : MouseButtons

Property Value

Type: System.Windows.Forms.MouseButtons
A bitwise combination of the MouseButtons enumeration values. The default is None.

Examples

The following example changes the color of a shape when the right mouse button is clicked on the shape. This example requires that you have a RectangleShape named RectangleShape1 on a form.

Private Sub RectangleShape1_MouseDown(
    ByVal sender As Object, 
    ByVal e As System.Windows.Forms.MouseEventArgs
  ) Handles RectangleShape1.MouseDown

    If e.Button = Windows.Forms.MouseButtons.Right Then 
        CType(sender, Shape).BorderColor = Color.Red
    End If 
End Sub
private void rectangleShape1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
    if (e.Button==MouseButtons.Right)
    {
        ((Shape) sender).BorderColor = Color.Red;
    }
}

.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)