Evento Shape.MouseUp
Ocorre quando o ponteiro do mouse está sobre a forma e um botão do mouse é liberado.
Namespace: Microsoft.VisualBasic.PowerPacks
Assembly: Microsoft.VisualBasic.PowerPacks.Vs (em Microsoft.VisualBasic.PowerPacks.Vs.dll)
Sintaxe
'Declaração
<BrowsableAttribute(True)> _
Public Event MouseUp As MouseEventHandler
[BrowsableAttribute(true)]
public event MouseEventHandler MouseUp
[BrowsableAttribute(true)]
public:
event MouseEventHandler^ MouseUp {
void add (MouseEventHandler^ value);
void remove (MouseEventHandler^ value);
}
[<BrowsableAttribute(true)>]
member MouseUp : IEvent<MouseEventHandler,
MouseEventArgs>
JScript não oferece suporte a eventos.
Comentários
Os eventos de mouse ocorrem na seguinte ordem:
MouseHover / MouseDown / MouseWheel
MouseUp
Para obter mais informações sobre como identificar eventos, consulte Manipulando e acionando eventos.
Exemplos
O exemplo a seguir mostra como usar o MouseDown, MouseMove, e MouseUp eventos para desenhar linhas em uma RectangleShape controle. Este exemplo requer que você tenha um RectangleShape controle denominado RectangleShape1 em um formulário.
Private mousePath = New System.Drawing.Drawing2D.GraphicsPath()
Private Sub RectangleShape2_MouseDown(
ByVal sender As Object,
ByVal e As System.Windows.Forms.MouseEventArgs
) Handles RectangleShape2.MouseDown
Dim mouseDownLocation As New Point(e.X + RectangleShape2.Left,
e.Y + RectangleShape2.Top)
' Clear the previous line.
mousePath.Dispose()
mousePath = New System.Drawing.Drawing2D.GraphicsPath()
RectangleShape2.Invalidate()
' Add a line to the graphics path.
mousePath.AddLine(mouseDownLocation, mouseDownLocation)
End Sub
Private Sub RectangleShape2_MouseMove(
ByVal sender As Object,
ByVal e As System.Windows.Forms.MouseEventArgs
) Handles RectangleShape2.MouseMove
Dim mouseX As Integer = e.X + RectangleShape2.Left
Dim mouseY As Integer = e.Y + RectangleShape2.Top
' Add a line to the graphics path.
mousePath.AddLine(mouseX, mouseY, mouseX, mouseY)
End Sub
Private Sub RectangleShape2_MouseUp(
ByVal sender As Object,
ByVal e As System.Windows.Forms.MouseEventArgs
) Handles RectangleShape2.MouseUp
Dim mouseUpLocation = New System.Drawing.Point(e.X +
RectangleShape2.Left, e.Y + RectangleShape2.Top)
' Add a line to the graphics path.
mousePath.Addline(mouseUpLocation, mouseUpLocation)
' Force the shape to redraw.
RectangleShape2.Invalidate()
End Sub
Private Sub RectangleShape2_Paint(
ByVal sender As Object,
ByVal e As System.Windows.Forms.PaintEventArgs
) Handles RectangleShape2.Paint
' Draw the line.
e.Graphics.DrawPath(System.Drawing.Pens.DarkRed, mousePath)
End Sub
private System.Drawing.Drawing2D.GraphicsPath mousePath =
new System.Drawing.Drawing2D.GraphicsPath();
private void rectangleShape2_MouseDown(object sender,
System.Windows.Forms.MouseEventArgs e)
{
Point mouseDownLocation = new Point(e.X + rectangleShape2.Left,
e.Y + rectangleShape2.Top);
// Clear the previous line.
mousePath.Dispose();
mousePath = new System.Drawing.Drawing2D.GraphicsPath();
rectangleShape2.Invalidate();
// Add a line to the graphics path.
mousePath.AddLine(mouseDownLocation, mouseDownLocation);
}
private void rectangleShape2_MouseMove(object sender,
System.Windows.Forms.MouseEventArgs e)
{
int mouseX = e.X + rectangleShape2.Left;
int mouseY = e.Y + rectangleShape2.Top;
// Add a line to the graphics path.
mousePath.AddLine(mouseX, mouseY, mouseX, mouseY);
}
private void rectangleShape2_MouseUp(object sender,
System.Windows.Forms.MouseEventArgs e)
{
System.Drawing.Point mouseUpLocation =
new System.Drawing.Point(e.X + rectangleShape2.Left,
e.Y + rectangleShape2.Top);
// Add a line to the graphics path.
mousePath.AddLine(mouseUpLocation, mouseUpLocation);
// Force the shape to redraw.
rectangleShape2.Invalidate();
}
private void rectangleShape2_Paint(object sender,
System.Windows.Forms.PaintEventArgs e)
{
// Draw the line.
e.Graphics.DrawPath(System.Drawing.Pens.DarkRed, mousePath);
}
Segurança do .NET Framework
- Confiança total para o chamador imediato. O membro não pode ser usado por código parcialmente confiável. Para obter mais informações, consulte Usando bibliotecas de código parcialmente confiável.
Consulte também
Referência
Namespace Microsoft.VisualBasic.PowerPacks
Outros recursos
Como desenhar linhas com o controle LineShape (Visual Studio)
Como desenhar formas com os controles OvalShape e RectangleShape (Visual Studio)