本文整理汇总了C#中IFigure.RelativeLocator方法的典型用法代码示例。如果您正苦于以下问题:C# IFigure.RelativeLocator方法的具体用法?C# IFigure.RelativeLocator怎么用?C# IFigure.RelativeLocator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IFigure
的用法示例。
在下文中一共展示了IFigure.RelativeLocator方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MouseDown
/// <summary>
/// A handler for mouse down events
/// </summary>
/// <param name="sender">the object that generated the event</param>
/// <param name="e">the mouse event data</param>
public override void MouseDown(object sender, MouseEventArgs e)
{
if (e.Button != MouseButtons.Left) return;
foreach (var f in _canvas.SelectedFigures)
{
foreach (var h in f.Handles)
{
if (h.Touches(e.X, e.Y))
_selectedHandle = h;
}
}
if (_selectedHandle != null) // mouse was pressed over a handle
{
_selectedHandle.Selected = true;
}
else
{
_canvas.ClearSelected();
_selectedFigure = _canvas.FindFigureAtPoint(e.Location);
if (_selectedFigure != null) // mouse was pressed over a figure
{
_selectedFigure.Selected = true;
_canvas.TopFigure = _selectedFigure;
_figureLocator = _selectedFigure.RelativeLocator(e.Location);
}
else // just on the canvas, so make a selection rectangle
{
_startPoint = e.Location;
_selectionBox = new Rectangle(e.Location, Size.Empty);
_canvas.SelectionRectangle = _selectionBox;
_canvas.Repaint(Rectangle.Inflate(_selectionBox, 1, 1));
}
}
}