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
[BrowsableAttribute(false)]
public static MouseButtons MouseButtons { get; }
public:
[BrowsableAttribute(false)]
property MouseButtons MouseButtons {
static MouseButtons get();
}
[<BrowsableAttribute(false)>]
static member MouseButtons : MouseButtons with get
<BrowsableAttribute(False)>
Public Shared ReadOnly Property MouseButtons As 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 void rectangleShape1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (e.Button==MouseButtons.Right)
{
((Shape) sender).BorderColor = Color.Red;
}
}
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
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