本文整理汇总了C#中Drawing.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Drawing.Add方法的具体用法?C# Drawing.Add怎么用?C# Drawing.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drawing
的用法示例。
在下文中一共展示了Drawing.Add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main()
{
Rectangle rectangle = new Rectangle();
Circle circle = new Circle();
Drawing drawing = new Drawing();
drawing.Add( rectangle );
drawing.Add( circle );
foreach( GeometricShape shape in drawing ) {
shape.Draw();
}
}
示例2: GetPinPositionForCorner
private static Drawing.Point GetPinPositionForCorner(Shapes.XFormCells input_xfrm, Drawing.Point new_lower_left, SnapCornerPosition corner)
{
var size = new Drawing.Size(input_xfrm.Width.Result, input_xfrm.Height.Result);
var locpin = new Drawing.Point(input_xfrm.LocPinX.Result, input_xfrm.LocPinY.Result);
switch (corner)
{
case SnapCornerPosition.LowerLeft:
{
return new_lower_left.Add(locpin.X, locpin.Y);
}
case SnapCornerPosition.UpperRight:
{
return new_lower_left.Subtract(size.Width, size.Height).Add(locpin.X, locpin.Y);
}
case SnapCornerPosition.LowerRight:
{
return new_lower_left.Subtract(size.Width, 0).Add(locpin.X, locpin.Y);
}
case SnapCornerPosition.UpperLeft:
{
return new_lower_left.Subtract(0, size.Height).Add(locpin.X, locpin.Y);
}
default:
{
throw new System.ArgumentOutOfRangeException(nameof(corner), "Unsupported corner");
}
}
}