本文整理汇总了C#中System.Windows.Forms.QueryContinueDragEventHandler代理的典型用法代码示例。如果您正苦于以下问题:C# QueryContinueDragEventHandler代理的具体用法?C# QueryContinueDragEventHandler怎么用?C# QueryContinueDragEventHandler使用的例子?那么恭喜您, 这里精选的代理代码示例或许可以为您提供帮助。
QueryContinueDragEventHandler代理属于System.Windows.Forms命名空间,在下文中一共展示了QueryContinueDragEventHandler代理的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ListDragSource_QueryContinueDrag
private void 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;
}
}
}