/// <summary> /// Sets the clip rectangle. /// </summary> /// <param name="rect">The clip rectangle.</param> /// <returns> /// True if the clip rectangle was set. /// </returns> public bool SetClip(RectF rect) { // TODO return(false); }
public bool IntersectsWith(RectF rect) { if (this.IsEmpty || rect.IsEmpty || (rect.Left > this.Right || rect.Right < this.Left) || rect.Top > this.Bottom) return false; else return rect.Bottom >= this.Top; }
private RectF RenderTitle(RectF positionedRect,float borderWidth) { SizeF textSize = this.RootGraphics.MeasureString(this.Title, this.TitleStyle.Font); float x = 0, y = 0; switch (this.TitleStyle.HorizontalAlignment) { case HorizontalAlignment.Center: x = (positionedRect.X + (this.PositionedRect.Width/2)) - (textSize.Width/2); break; case HorizontalAlignment.Left: x = positionedRect.X; break; case HorizontalAlignment.Right: x = (positionedRect.X + (this.PositionedRect.Width)) - (textSize.Width); break; } switch (this.TitleStyle.VerticalAlignment) { case VerticalAlignment.Center: y = (positionedRect.Y) + (this.TitleMargin/2); break; case VerticalAlignment.Bottom: y = (positionedRect.Y) + this.TitleMargin; break; case VerticalAlignment.Top: y = positionedRect.Y; break; } if (!String.IsNullOrEmpty(this.Title)) { this.RootGraphics.DrawString(this.Title, this.TitleStyle.Font, this.TitleStyle.Foreground, x, y); } positionedRect = new RectF(new PointF(positionedRect.X, positionedRect.Y + (this.TitleMargin + textSize.Height)), new SizeF(positionedRect.Width, positionedRect.Height - textSize.Height - this.TitleMargin)); return positionedRect; }
public bool Contains(RectF rect) { if (this.IsEmpty || rect.IsEmpty || (this.x > rect.x || this.y > rect.y) || this.x + this.width < rect.x + rect.width) return false; else return this.y + this.height >= rect.y + rect.height; }