本文整理汇总了C#中RectangleD.Add方法的典型用法代码示例。如果您正苦于以下问题:C# RectangleD.Add方法的具体用法?C# RectangleD.Add怎么用?C# RectangleD.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RectangleD
的用法示例。
在下文中一共展示了RectangleD.Add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetBounds
// TODO: Move this to FigureCollection
private RectangleD GetBounds (FigureCollection figures) {
RectangleD rectangle = new RectangleD (0, 0, 0, 0);
foreach (IFigure figure in figures) {
rectangle.Add (figure.DisplayBox);
}
return rectangle;
}
示例2: LineContainsPoint
public static bool LineContainsPoint (double x1, double y1, double x2, double y2, double px, double py) {
RectangleD r = new RectangleD (new PointD (x1, y1));
r.Add (x2, y2);
r.Inflate (2.0, 2.0);
if (!r.Contains (px, py)) {
return false;
}
double a, b, x, y;
if (x1 == x2) {
return (Math.Abs (px - x1) < 3.0);
}
if (y1 == y2) {
return (Math.Abs (py - y1) < 3.0);
}
a = (y1 - y2) / (x1 - x2);
b = y1 - a * x1;
x = (py - b) / a;
y = a * px + b;
return (Math.Min (Math.Abs (x - px), Math.Abs (y - py)) < 4.0);
}
示例3: RecalculateDisplayBox
public void RecalculateDisplayBox ()
{
_displayBox = new RectangleD (0.0, 0.0);
bool first_flag = true;
foreach (IFigure figure in FiguresEnumerator) {
if (first_flag) {
_displayBox = figure.DisplayBox;
first_flag = false;
}
else {
_displayBox.Add (figure.DisplayBox);
}
}
OnSizeAllocated ();
}