本文整理汇总了C#中NSEvent.LocationInView方法的典型用法代码示例。如果您正苦于以下问题:C# NSEvent.LocationInView方法的具体用法?C# NSEvent.LocationInView怎么用?C# NSEvent.LocationInView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NSEvent
的用法示例。
在下文中一共展示了NSEvent.LocationInView方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MouseDown
public override void MouseDown(NSEvent evnt)
{
NSPoint point = evnt.LocationInView(this);
int index = this.IndexOfCircleAtPoint(point);
if (index >= 0)
{
this.DragCircleAtIndexWithEvent((uint) index, evnt);
}
}
示例2: DragCircleAtIndexWithEvent
public void DragCircleAtIndexWithEvent(uint index, NSEvent evnt)
{
Circle circle = this.circles.ObjectAtIndex(index).CastTo<Circle>();
circle.Retain();
this.circles.RemoveObjectAtIndex(index);
this.circles.AddObject(circle);
circle.Release();
this.SetNeedsDisplayInRect(this.BoundsForCircle(circle));
NSEventMask mask = NSEventMask.NSLeftMouseDraggedMask | NSEventMask.NSLeftMouseUpMask;
NSPoint start = evnt.LocationInView(this);
while (true)
{
evnt = this.Window.NextEventMatchingMask(mask);
if (evnt.Type == NSEventType.NSLeftMouseUp)
{
break;
}
this.SetNeedsDisplayInRect(this.BoundsForCircle(circle));
NSPoint center = circle.Center;
NSPoint point = evnt.LocationInView(this);
center.x += point.x - start.x;
center.y += point.y - start.y;
circle.Center = center;
this.SetNeedsDisplayInRect(this.BoundsForCircle(circle));
start = point;
}
}