本文整理汇总了C#中RectangleD类的典型用法代码示例。如果您正苦于以下问题:C# RectangleD类的具体用法?C# RectangleD怎么用?C# RectangleD使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RectangleD类属于命名空间,在下文中一共展示了RectangleD类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MouseDrag
public override void MouseDrag (MouseEvent ev) {
DrawSelectionRect ((Gtk.Widget) ev.View, ev.GdkEvent.Window);
PointD anchor = new PointD (AnchorX, AnchorY);
PointD corner = new PointD (ev.X, ev.Y);
_selectionRect = new RectangleD (anchor, corner);
DrawSelectionRect ((Gtk.Widget) ev.View, ev.GdkEvent.Window);
}
示例2: GetCompliantBounds
public override RectangleD GetCompliantBounds(ShapeElement shape, RectangleD proposedBounds)
{
if (shape.Store.InSerializationTransaction)
return proposedBounds;
double width = 0.83675;
double height = 0.83675;
if (shape is StartableShape || shape is BatchWaitShape || shape is DatabaseBatchWaitShape)
{
width = 1.243;
height = 0.84025;
}
else if (shape is WorkflowRuleShape)
{
width = 1.2395;
height = 0.84025;
}
var activityShape = shape as BaseActivityShape;
if (activityShape == null) return proposedBounds;
var approvedBounds = new RectangleD();
approvedBounds.Location = proposedBounds.Location;
// But the height and width are constrained:
approvedBounds.Height = height;
approvedBounds.Width = width;
return approvedBounds;
}
示例3: InvalidateRect
public virtual RectangleD InvalidateRect(PointD b)
{
var r = new RectangleD (b.X, b.Y, 0.0, 0.0);
r.Inflate (15.0, 15.0);
return r;
}
示例4: AnalogClockFigure
public AnalogClockFigure()
: base()
{
DisplayBox = new RectangleD (0.0, 0.0, 100.0, 100.0);
LineWidth = 3.0;
FillColor = new Color (0.7, 0.7, 0.7, 0.8);
_now = DateTime.Now;
_handles = new List <IHandle> ();
//Handle used to keep height and width synchronized when resizing
_handles.Add (new AnalogClockNorthWestHandle (this));
_handlesHand = new List <IHandle> ();
//Handles to move hands
_handlesHand.Add (new AnalogClockHandHandle (this, new AnalogClockHandLocatorHour ()));
_handlesHand.Add (new AnalogClockHandHandle (this, new AnalogClockHandLocatorMinute ()));
_handlesHand.Add (new AnalogClockHandHandle (this, new AnalogClockHandLocatorSecond ()));
_hourColor = new Color (0.337, 0.612, 0.117, 0.8);
_minuteColor = new Color (0.117, 0.337, 0.619, 0.8);
_secondColor = new Color (1, 1, 1, 0.8);
_hourHandLength = 0.0;
//Timer to update time
GLib.Timeout.Add (500, new GLib.TimeoutHandler (UpdateClock));
}
示例5: Render
internal Present Render(MapRectangle mapRect, Size size, bool useDocumentTransparency, bool exactColors)
{
Monitor.Enter(this);
Present result;
try
{
RectangleD rectangleD = new RectangleD(mapRect.lon0 * (double)this.boundingBox.Width - 0.5, -mapRect.lat1 * (double)this.boundingBox.Height + (double)this.actualBoundingBox.Height - 0.5, (mapRect.lon1 - mapRect.lon0) * (double)this.boundingBox.Width + (double)this.hackRectangleAdjust, (mapRect.lat1 - mapRect.lat0) * (double)this.boundingBox.Height + (double)this.hackRectangleAdjust);
RectangleD rectangleD2 = new RectangleD(0.0, 0.0, (double)size.Width, (double)size.Height);
this.Reclip(this.actualBoundingBox, ref rectangleD, ref rectangleD2);
D.Say(10, string.Format("Rendering {0} from {1}", mapRect, rectangleD));
GDIBigLockedImage gDIBigLockedImage = new GDIBigLockedImage(size, "GDIVerb");
if (exactColors)
{
gDIBigLockedImage.SetInterpolationMode(InterpolationMode.NearestNeighbor);
}
else
{
gDIBigLockedImage.SetInterpolationMode(InterpolationMode.HighQualityBicubic);
}
gDIBigLockedImage.DrawImageOntoThis(this.loadedImage, rectangleD2.ToRectangleF(), rectangleD.ToRectangleF());
result = new ImageRef(new ImageRefCounted(gDIBigLockedImage));
}
finally
{
Monitor.Exit(this);
}
return result;
}
示例6: SetAbsoluteBoundsValue
protected override void SetAbsoluteBoundsValue(RectangleD newValue)
{
base.SetAbsoluteBoundsValue(newValue);
// trigger bounds rules of children
this.relayoutChildren = true;
}
示例7: RectangleInsideGdkRegion
public static bool RectangleInsideGdkRegion (RectangleD r, Gdk.Region region) {
r.Inflate (1.0, 1.0);
Gdk.Rectangle gdkRect = GdkRectangle (r);
Gdk.OverlapType type = region.RectIn (gdkRect);
return (type == Gdk.OverlapType.In || type == Gdk.OverlapType.Part);
}
示例8: EdgePointFromAngle
public static PointD EdgePointFromAngle (RectangleD r, double angle) {
double sin = Math.Sin (angle);
double cos = Math.Cos (angle);
double e = 0.0001;
double x = 0;
double y = 0;
if (Math.Abs (sin) > e) {
x = (1.0 + cos / Math.Abs (sin)) / 2.0 * r.Width;
x = Range (0.0, r.Width, x);
}
else if (cos >= 0.0) {
x = r.Width;
}
if (Math.Abs (cos) > e) {
y = (1.0 + sin / Math.Abs (cos)) / 2.0 * r.Height;
y = Range (0.0, r.Height, y);
}
else if (sin >= 0.0) {
y = r.Height;
}
return new PointD (r.X + x, r.Y + y);
}
示例9: 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;
}
示例10: ScaleAndTranslate
public ScaleAndTranslate(RectangleD source, RectangleD dest)
{
this.scx = (dest.Right - dest.Left) / (source.Right - source.Left);
this.tx = dest.Left - this.scx * source.Left;
this.scy = (dest.Bottom - dest.Top) / (source.Bottom - source.Top);
this.ty = dest.Top - this.scy * source.Top;
}
示例11: IsPotentialHit
/// <summary>
/// Gets a value indicating whether the specified point is potentially a hit for the specified element.
/// </summary>
/// <param name="element">The element to evaluate.</param>
/// <param name="point">The point to evaluate.</param>
/// <returns><see langword="true"/> if the specified point is a potential hit; otherwise, <see langword="false"/>.</returns>
public static Boolean IsPotentialHit(UIElement element, Point2D point)
{
if (element.Visibility != Visibility.Visible)
return false;
if (!element.IsHitTestVisible)
return false;
if (!element.VisualBounds.Contains(point))
return false;
var clip = element.ClipRectangle;
if (clip.HasValue)
{
var absoluteClip = clip.Value;
var relativeClip = new RectangleD(
absoluteClip.X - element.UntransformedAbsolutePosition.X,
absoluteClip.Y - element.UntransformedAbsolutePosition.Y,
absoluteClip.Width,
absoluteClip.Height);
if (!relativeClip.Contains(point))
return false;
}
return true;
}
示例12: RoundedRectangle
public static void RoundedRectangle(Cairo.Context c, RectangleD rect, double radius)
{
if (radius > (rect.Width /2) || radius > (rect.Height / 2)) {
radius = Math.Min ((rect.Width /2), (rect.Height / 2));
}
c.Save ();
/* Bottom Left */
c.MoveTo(rect.X, rect.Y + radius);
c.Arc (rect.X + radius, rect.Y + radius, radius, Math.PI, -Math.PI/2);
c.LineTo (rect.X2 - radius, rect.Y);
/* Bottom Right */
c.Arc (rect.X2 - radius, rect.Y + radius, radius, -Math.PI/2, 0);
c.LineTo (rect.X2, rect.Y2 - radius);
/* Top Right */
c.Arc (rect.X2 - radius, rect.Y2 - radius, radius, 0, Math.PI/2);
c.LineTo (rect.X + radius, rect.Y2);
/* Top Left */
c.Arc(rect.X + radius, rect.Y2 - radius, radius, Math.PI/2, Math.PI);
c.ClosePath ();
c.Restore ();
}
示例13: RectangleD_EqualsObject
public void RectangleD_EqualsObject()
{
var rectangle1 = new RectangleD(123.45, 456.78, 789.99, 999.99);
var rectangle2 = new RectangleD(123.45, 456.78, 789.99, 999.99);
TheResultingValue(rectangle1.Equals((Object)rectangle2)).ShouldBe(true);
TheResultingValue(rectangle1.Equals("This is a test")).ShouldBe(false);
}
示例14: MoveTo
/// <summary>
/// Moves shape to specified position (in world units) relative to the diagram.
/// </summary>
public static void MoveTo(this NodeShape shape, PointD position)
{
var newBounds = new RectangleD(PointD.Empty, shape.AbsoluteBounds.Size);
newBounds.X = position.X;
newBounds.Y = position.Y;
shape.AbsoluteBounds = newBounds;
}
示例15: DrawRadiusedArc
/// <summary>
/// Draws a radiused arc on the given path, at given location.
/// </summary>
protected void DrawRadiusedArc(GraphicsPath path, double left, double top, float startAngle, float sweepAngle)
{
RectangleD arcRectangle = new RectangleD();
arcRectangle.Width = (2 * this.Radius);
arcRectangle.Height = (2 * this.Radius);
path.AddArc((float)left, (float)top, (float)arcRectangle.Width, (float)arcRectangle.Height, startAngle, sweepAngle);
}