Este artigo foi traduzido por máquina. Coloque o ponteiro do mouse sobre as frases do artigo para ver o texto original. Mais informações. |
Tradução
Original
|
Classe QueryContinueDragEventArgs
Fornece dados para o QueryContinueDrag evento.
Assembly: System.Windows.Forms (em System.Windows.Forms.dll)
The QueryContinueDrag evento ocorre durante uma operação de do tipo arrastar e soltar e permite que fonte arrastar determinar se a operação de do tipo arrastar e soltar deve ser cancelada. A QueryContinueDragEventArgs Especifica se e como a operação de do tipo arrastar e soltar deve prosseguir, se forem pressionadas as teclas modificadoras e se o usuário pressionou o tecla ESC.
Por padrão, a QueryContinueDrag conjuntos de eventos Action para DragAction.Cancel Se a tecla ESC foi pressionada e define Action para DragAction.Drop Se a esquerda, central, ou botão direito do mouse é pressionado.
Para obter informações sobre o modelo de eventos, consulte Eventos e representantes.
Neste trecho de código demonstra o uso de QueryContinueDragEventArgs classe com o QueryContinueDrag evento. Consulte o DoDragDrop método no exemplo de código completo.
privatevoid ListDragSource_QueryContinueDrag(object sender, System.Windows.Forms.QueryContinueDragEventArgs e) { // Cancel the drag if the mouse moves off the form. ListBox lb = sender as ListBox; if (lb != null) { Form f = lb.FindForm(); // Cancel the drag if the mouse moves off the form. The screenOffset// takes into account any desktop bands that may be at the top or left// side of the screen.if (((Control.MousePosition.X - screenOffset.X) < f.DesktopBounds.Left) || ((Control.MousePosition.X - screenOffset.X) > f.DesktopBounds.Right) || ((Control.MousePosition.Y - screenOffset.Y) < f.DesktopBounds.Top) || ((Control.MousePosition.Y - screenOffset.Y) > f.DesktopBounds.Bottom)) { e.Action = DragAction.Cancel; } } }
private void listDragSource_QueryContinueDrag(Object sender,
System.Windows.Forms.QueryContinueDragEventArgs e)
{
// Cancel the drag if the mouse moves off the form.
ListBox lb = (ListBox)sender;
if (lb != null) {
Form f = lb.FindForm();
// Cancel the drag if the mouse moves off the form. The
// screenOffset takes into account any desktop bands
// that may be at the top or left side of the screen.
if (Control.get_MousePosition().get_X() - screenOffset.get_X()
< f.get_DesktopBounds().get_Left()
|| Control.get_MousePosition().get_X()
- screenOffset.get_X() > f.get_DesktopBounds().get_Right()
|| Control.get_MousePosition().get_Y() - screenOffset.get_Y()
< f.get_DesktopBounds().get_Top()
|| Control.get_MousePosition().get_Y() - screenOffset.get_Y()
> f.get_DesktopBounds().get_Bottom()) {
e.set_Action(DragAction.Cancel);
}
}
} //listDragSource_QueryContinueDrag
Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
o.NET Framework e.NET Compact Framework não oferecem suporte a todas as versões de cada plataforma. Para obter uma lista de versões suportadas, consulte Requisitos de sistema do .NET framework.