本文整理汇总了C#中Rectangle2D.IsInside方法的典型用法代码示例。如果您正苦于以下问题:C# Rectangle2D.IsInside方法的具体用法?C# Rectangle2D.IsInside怎么用?C# Rectangle2D.IsInside使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rectangle2D
的用法示例。
在下文中一共展示了Rectangle2D.IsInside方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddShapesRecursive
void AddShapesRecursive(ShapeCollection target, ShapeBase parent, Rectangle2D selection )
{
if (parent.ShapeVirtualCounter==0 && parent.CanCopyPaste && (parent is Shape3D))
{
Shape3D shape3D = (Shape3D)parent;
if (selection.IsInside(shape3D.x, shape3D.y))
{
target.Add(parent);
//return; // iterate through children as well - the CloneForClipboard will take care of handling duplicates
}
}
if (parent.HasChildren())
{
ShapeCollection children = parent.ChildCollection;
foreach (ShapeBase child in children)
AddShapesRecursive(target, child, selection);
}
}
示例2: OnMouseMove
//.........这里部分代码省略.........
if (Dragmode == MOUSE_MODE.UI_MOVE || Dragmode == MOUSE_MODE.UI_COPY )
{
// this.MoveUIShape(m_selectedShape, e.X, e.Y);
foreach (UIShapeBase shape in m_selectedShapeList)
{
this.MoveUIShapeDelta(shape, e.X - iOldX, e.Y - iOldY);
}
}
else if (Dragmode == MOUSE_MODE.UI_SIZE)
{
foreach (UIShapeBase shape in m_selectedShapeList)
{
Rectangle2D newRect = new Rectangle2D();
float fDeltaX = (e.X - iOldX);
float fDeltaY = (e.Y - iOldY);
if (View.Cursor == Cursors.PanNW)
{
newRect.Add(shape.ScreenBound.X2, shape.ScreenBound.Y2);
newRect.Add(shape.ScreenBound.X1 + fDeltaX, shape.ScreenBound.Y1 + fDeltaY);
newRect.Validate();
shape.ScreenBound = newRect;
}
else if (View.Cursor == Cursors.PanSW)
{
newRect.Add(shape.ScreenBound.X2, shape.ScreenBound.Y1);
newRect.Add(shape.ScreenBound.X1 + fDeltaX, shape.ScreenBound.Y2 + fDeltaY);
newRect.Validate();
shape.ScreenBound = newRect;
}
else if (View.Cursor == Cursors.PanNE)
{
newRect.Add(shape.ScreenBound.X1, shape.ScreenBound.Y2);
newRect.Add(shape.ScreenBound.X2 + fDeltaX, shape.ScreenBound.Y1 + fDeltaY);
newRect.Validate();
shape.ScreenBound = newRect;
}
else if (View.Cursor == Cursors.PanSE)
{
newRect.Add(shape.ScreenBound.X1, shape.ScreenBound.Y1);
newRect.Add(shape.ScreenBound.X2 + fDeltaX, shape.ScreenBound.Y2 + fDeltaY);
newRect.Validate();
shape.ScreenBound = newRect;
}
}
}
}
else
{
}
if (Dragmode == MOUSE_MODE.UI_NONE)
{
UIShapeBase tempShape = this.GetUIShapeFromSelection(e.X, e.Y);
if (tempShape == null)
{
View.Cursor = Cursors.Default;
}
else
{
int margin = 15;
Rectangle2D mouseBound = new Rectangle2D();
mouseBound.Add(e.X - margin, e.Y - margin);
mouseBound.Add(e.X + margin, e.Y + margin);
float fX1 = tempShape.ScreenBound.X1;
float fY1 = tempShape.ScreenBound.Y1;
float fX2 = tempShape.ScreenBound.X2;
float fY2 = tempShape.ScreenBound.Y2;
if (mouseBound.IsInside(fX1, fY1))
View.Cursor = Cursors.PanNW;
else if (mouseBound.IsInside(fX1, fY2))
View.Cursor = Cursors.PanSW;
else if (mouseBound.IsInside(fX2, fY1))
View.Cursor = Cursors.PanNE;
else if (mouseBound.IsInside(fX2, fY2))
View.Cursor = Cursors.PanSE;
else if (tempShape is UIShapeDialog) // 다이얼로그는 사이즈조정밖에 안됨
{
View.Cursor = Cursors.Arrow;
}
else
{
View.Cursor = Cursors.SizeAll;
}
}
}
}
return false;
}