/// <summary> /// Paints the aFrame object /// </summary> /// <param name="paintContext"></param> protected override void Paint(UMD.HCIL.Piccolo.Util.PPaintContext paintContext) { Graphics graphics = paintContext.Graphics; graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit; RectangleF inBnds = InnerBounds; Pen pen = new Pen(Brushes.Black, 2); float x = X; float y = Y; float width = Width; float height = Height; float inX = inBnds.X; float inY = inBnds.Y; float inWidth = inBnds.Width; float inHeight = inBnds.Height; graphics.FillRectangle(Brushes.WhiteSmoke, x, y, width, height); graphics.FillRectangle(Brushes.White, inX, inY, inWidth, inHeight); graphics.DrawRectangle(pen, x, y, width, height); graphics.DrawRectangle(pen, inX, inY, inWidth, inHeight); graphics.DrawLine(pen, x, y, inX, inY); graphics.DrawLine(pen, x + width, y, inX + inWidth, inY); graphics.DrawLine(pen, x, y + height, inX, inY + inHeight); graphics.DrawLine(pen, x + width, y + height, inX + inWidth, inY + inHeight); if (ShowCodes && Label != null) { Font font = new Font("Arial", FontSize, FontStyle.Regular); PointF labelPosition = new PointF(x + Width / 2 - (Label.Length * font.Size) / 2, y + (inY - y) / 2 - font.Height / 2); graphics.DrawString(Label, font, Brushes.Black, labelPosition); } }
protected override void Paint(UMD.HCIL.Piccolo.Util.PPaintContext paintContext) { Graphics graphics = paintContext.Graphics; if (!Model.FillingType.Glass) { graphics.FillRectangle(Brushes.White, Bounds); object image = Resources.ResourceManager.GetObject("board"); using (TextureBrush brush = new TextureBrush((Image)image, WrapMode.Tile)) { graphics.FillRectangle(brush, Bounds); } } else { graphics.FillRectangle(new SolidBrush(Color.FromArgb(100, Color.SkyBlue)), Bounds); } if (Model.Code != null && Model.SurfaceParent.Frame.ShowCodes) { Font font = new Font("Arial", Model.SurfaceParent.Frame.FontSize, FontStyle.Regular); graphics.DrawString(Model.Code, font, Brushes.Black, X + Width / 2 - (Model.Code.Length * font.Size) / 2, Y + (Height / 2) - (font.Height / 2)); } }
protected override void Paint(UMD.HCIL.Piccolo.Util.PPaintContext paintContext) { Graphics graphics = paintContext.Graphics; graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; if (Model != null && Model.IsVirtual) { graphics.FillRectangle(Brushes.Red, Bounds); return; } Pen pen = new Pen(Brushes.Black, 2); graphics.FillRectangle(Brushes.WhiteSmoke, Model.X, Model.Y, Model.Width, Model.Height); if (Model.Orientation == Orientation.Horizontal) { graphics.DrawLine(pen, X, Y, X, Y + Thickness); graphics.DrawLine(pen, X, Y, X + Width, Y); graphics.DrawLine(pen, X, Y + Thickness, X + Width, Y + Thickness); } else if (Model.Orientation == Orientation.Vertical) { graphics.DrawLine(pen, X, Y, X + Thickness, Y); graphics.DrawLine(pen, X, Y, X, Y + Height); graphics.DrawLine(pen, X + Thickness, Y, X + Thickness, Y + Height); } if (Label != null && Frame.ShowCodes) { graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit; Font font = new Font("Arial", Frame.FontSize, FontStyle.Regular); if (Model.Orientation == Orientation.Horizontal) { graphics.DrawString(Label, font, Brushes.Black, new PointF(Model.X + Model.Length / 2 - (Label.Length * font.Size) / 2, Model.Y - font.Height / 2 + Thickness / 2)); } else { graphics.DrawString(Label, font, Brushes.Black, new PointF(Model.X + Thickness / 2 - (font.Height / 2), Model.Y + Model.Length / 2 - (Label.Length * font.Size) / 2), new StringFormat(StringFormatFlags.DirectionVertical)); } } }
protected override void Paint(UMD.HCIL.Piccolo.Util.PPaintContext paintContext) { Graphics graphics = paintContext.Graphics; graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; Pen pen = new Pen(Brushes.Red, 1); pen.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDotDot; graphics.DrawRectangle(pen, X, Y, Width, Height); for (float i = X; i <= Width; i += 30) { graphics.DrawLine(pen, i, Y, i, Y + Height); } for (float j = Y; j <= Height; j += 30) { graphics.DrawLine(pen, X, j, X + Width, j); } }
protected override void Paint(UMD.HCIL.Piccolo.Util.PPaintContext paintContext) { base.Paint(paintContext); Graphics graphics = paintContext.Graphics; graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit; graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; Pen pen = new Pen(Brushes.Black, 2); RectangleF innerBounds = InnerBounds; float thickness = Thickness; graphics.FillRectangle(Brushes.WhiteSmoke, X, Y, Width, thickness); graphics.FillRectangle(Brushes.WhiteSmoke, X, Y, thickness, Height); graphics.FillRectangle(Brushes.WhiteSmoke, X + Width - thickness, Y, thickness, Height); graphics.FillRectangle(Brushes.WhiteSmoke, X, Y + Height - thickness, Width, thickness); graphics.FillRectangle(Brushes.White, innerBounds); graphics.DrawRectangle(pen, X, Y, Width, Height); graphics.DrawRectangle(pen, innerBounds.X, innerBounds.Y, innerBounds.Width, innerBounds.Height); graphics.DrawLine(pen, X, Y, innerBounds.X, innerBounds.Y); graphics.DrawLine(pen, X + Width, Y, innerBounds.X + innerBounds.Width, innerBounds.Y); graphics.DrawLine(pen, X + Width, Y + Height, innerBounds.X + innerBounds.Width, innerBounds.Y + innerBounds.Height); graphics.DrawLine(pen, X, Y + Height, innerBounds.X, innerBounds.Y + innerBounds.Height); if (!string.IsNullOrEmpty(Direction)) { pen.Color = Color.Black; if (direction.Equals("Top")) { graphics.DrawLine(pen, innerBounds.X + innerBounds.Width / 2, innerBounds.Y, innerBounds.X, innerBounds.Y + innerBounds.Height); graphics.DrawLine(pen, innerBounds.X + innerBounds.Width / 2, innerBounds.Y, innerBounds.X + innerBounds.Width, innerBounds.Y + innerBounds.Height); } else if (direction.Equals("Right")) { graphics.DrawLine(pen, innerBounds.X, innerBounds.Y, innerBounds.X + innerBounds.Width, innerBounds.Y + innerBounds.Height / 2); graphics.DrawLine(pen, innerBounds.X + innerBounds.Width, innerBounds.Y + innerBounds.Height / 2, innerBounds.X, innerBounds.Y + innerBounds.Height); } else if (direction.Equals("Left")) { graphics.DrawLine(pen, innerBounds.X + innerBounds.Width, innerBounds.Y, innerBounds.X, innerBounds.Y + innerBounds.Height / 2); graphics.DrawLine(pen, innerBounds.X, innerBounds.Y + innerBounds.Height / 2, innerBounds.X + innerBounds.Width, innerBounds.Y + innerBounds.Height); } else if (direction.Equals("Bottom")) { graphics.DrawLine(pen, innerBounds.X, innerBounds.Y, innerBounds.X + innerBounds.Width / 2, innerBounds.Y + innerBounds.Height); graphics.DrawLine(pen, innerBounds.X + innerBounds.Width / 2, innerBounds.Height + innerBounds.Y, innerBounds.X + innerBounds.Width, innerBounds.Y); } } if (_fixed && !string.IsNullOrEmpty(Direction)) { float accessoryThickness = 16; float accessoryLength = 60; pen.Color = Color.Black; if (direction.Equals("Top")) { graphics.FillRectangle(Brushes.Gray, X, Y + (innerBounds.Y - Y) / 2 - accessoryThickness / 2, accessoryLength, accessoryThickness); graphics.DrawRectangle(pen, X, Y + (innerBounds.Y - Y) / 2 - accessoryThickness / 2, accessoryLength, accessoryThickness); graphics.FillRectangle(Brushes.Gray, X + Width - accessoryLength, Y + (innerBounds.Y - Y) / 2 - accessoryThickness / 2, accessoryLength, accessoryThickness); graphics.DrawRectangle(pen, X + Width - accessoryLength, Y + (innerBounds.Y - Y) / 2 - accessoryThickness / 2, accessoryLength, accessoryThickness); } else if (direction.Equals("Right")) { graphics.FillRectangle(Brushes.Gray, X + Width - (innerBounds.X - X) / 2 - (accessoryThickness / 2), Y, accessoryThickness, accessoryLength); graphics.DrawRectangle(pen, X + Width - (innerBounds.X - X) / 2 - (accessoryThickness / 2), Y, accessoryThickness, accessoryLength); graphics.FillRectangle(Brushes.Gray, X + Width - (innerBounds.X - X) / 2 - (accessoryThickness / 2), Y + Height - accessoryLength, accessoryThickness, accessoryLength); graphics.DrawRectangle(pen, X + Width - (innerBounds.X - X) / 2 - (accessoryThickness / 2), Y + Height - accessoryLength, accessoryThickness, accessoryLength); } else if (direction.Equals("Left")) { graphics.FillRectangle(Brushes.Gray, X + (innerBounds.X - X) / 2 - accessoryThickness / 2, Y, accessoryThickness, accessoryLength); graphics.DrawRectangle(pen, X + (innerBounds.X - X) / 2 - accessoryThickness / 2, Y, accessoryThickness, accessoryLength); graphics.FillRectangle(Brushes.Gray, X + (innerBounds.X - X) / 2 - accessoryThickness / 2, Y + Height - accessoryLength, accessoryThickness, accessoryLength); graphics.DrawRectangle(pen, X + (innerBounds.X - X) / 2 - accessoryThickness / 2, Y + Height - accessoryLength, accessoryThickness, accessoryLength); } else if (direction.Equals("Bottom")) { graphics.FillRectangle(Brushes.Gray, X, Y + Height - (innerBounds.Y - Y) / 2 - accessoryThickness / 2, accessoryLength, accessoryThickness); graphics.DrawRectangle(pen, X, Y + Height - (innerBounds.Y - Y) / 2 - accessoryThickness / 2, accessoryLength, accessoryThickness); graphics.FillRectangle(Brushes.Gray, X + Width - accessoryLength, Y + Height - (innerBounds.Y - Y) / 2 - accessoryThickness / 2, accessoryLength, accessoryThickness); graphics.DrawRectangle(pen, X + Width - accessoryLength, Y + Height - (innerBounds.Y - Y) / 2 - accessoryThickness / 2, accessoryLength, accessoryThickness); } } if (!string.IsNullOrEmpty(Direction) && !_fixed) { float accessoryThickness = 16; float accessoryLength = 60; pen.Color = Color.Black; if (direction.Equals("Top")) { graphics.FillRectangle(Brushes.Gray, X + Width / 2 - (accessoryLength / 2), Y + Model.SashType.ProfileType.Thickness / 2 - (accessoryThickness / 2), accessoryLength, accessoryThickness); graphics.DrawRectangle(pen, X + Width / 2 - (accessoryLength / 2), Y + Model.SashType.ProfileType.Thickness / 2 - (accessoryThickness / 2), accessoryLength, accessoryThickness); } else if (direction.Equals("Right")) { graphics.FillRectangle(Brushes.Gray, X + Width - (Model.SashType.ProfileType.Thickness / 2) - (accessoryThickness / 2), Y + (Height / 2) - (accessoryLength / 2), accessoryThickness, accessoryLength); graphics.DrawRectangle(pen, X + Width - (Model.SashType.ProfileType.Thickness / 2) - (accessoryThickness / 2), Y + (Height / 2) - (accessoryLength / 2), accessoryThickness, accessoryLength); } else if (direction.Equals("Left")) { graphics.FillRectangle(Brushes.Gray, X + Model.SashType.ProfileType.Thickness - (Model.SashType.ProfileType.Thickness / 2) - (accessoryThickness / 2), Y + (Height / 2) - (accessoryLength / 2), accessoryThickness, accessoryLength); graphics.DrawRectangle(pen, X + Model.SashType.ProfileType.Thickness - (Model.SashType.ProfileType.Thickness / 2) - (accessoryThickness / 2), Y + (Height / 2) - (accessoryLength / 2), accessoryThickness, accessoryLength); } else if (direction.Equals("Bottom")) { graphics.FillRectangle(Brushes.Gray, X + Width / 2 - (accessoryLength / 2), Y + Height - (Model.SashType.ProfileType.Thickness / 2) - (accessoryThickness / 2), accessoryLength, accessoryThickness); graphics.DrawRectangle(pen, X + Width / 2 - (accessoryLength / 2), Y + Height - (Model.SashType.ProfileType.Thickness / 2) - (accessoryThickness / 2), accessoryLength, accessoryThickness); } } if (Model.Code != null && Model.SurfaceParent.Frame.ShowCodes) { Font font = new Font("Arial", Model.SurfaceParent.Frame.FontSize, FontStyle.Regular); PointF labelPosition; if (!string.IsNullOrEmpty(Direction) && Direction.Equals("Top")) { labelPosition = new PointF(X + Width / 2 - (font.Size * Model.Code.Length) / 2, Y + Height - Model.SashType.ProfileType.Thickness + (innerBounds.Y - Y) / 2 - font.Height / 2); } else { labelPosition = new PointF(X + Width / 2 - (font.Size * Model.Code.Length) / 2, Y + (innerBounds.Y - Y) / 2 - font.Height / 2); } graphics.DrawString(Model.Code, font, Brushes.Black, labelPosition); } }