// Window Constructor. Copies the existing Graphics and creates a new // Graphics that has an origin of baseWindow.Location and is always clipped // to baseWindow internal Graphics(IToolkitGraphics graphics, Rectangle baseWindow) : this(graphics) { this.baseWindow = baseWindow; clip = new Region(baseWindow); clip.Translate(-baseWindow.X, -baseWindow.Y); Clip = clip; }
static BlockRegions() { int n = Constants.PROJ_WIDTH / 4; WholeBlock = new Region(); WholeBlock.MakeEmpty(); for (int i = 0; i <= n; i++) { WholeBlock.Union(new Rectangle(n * 2 - 1 - 2 * i, i, i * 4 + 2, Constants.PROJ_HEIGHT - 2 * i)); } WholeBlock.Intersect(new Rectangle(0, 0, Constants.PROJ_WIDTH, Constants.PROJ_HEIGHT)); InnerBlock = new Region(); InnerBlock.MakeEmpty(); for (int i = 0; i <= n; i++) { InnerBlock.Union(new Rectangle(n * 2 - 1 - 2 * i, i + 1, i * 4 + 2, Constants.PROJ_HEIGHT - 2 - 2 * i)); } InnerBlock.Intersect(new Rectangle(1, 1, Constants.PROJ_WIDTH - 2, Constants.PROJ_HEIGHT - 2)); OuterBorder = WholeBlock.Clone(); OuterBorder.Exclude(InnerBlock); Top = InnerBlock.Clone(); Top.Translate(0, -Constants.BLOCK_HEIGHT); Top.Intersect(InnerBlock); Left = InnerBlock.Clone(); Left.Exclude(Top); Top.Translate(0, 1); Left.Exclude(Top); Top.Translate(0, -1); Right = Left.Clone(); Left.Intersect(new Rectangle(0, 0, Constants.PROJ_WIDTH / 2, Constants.PROJ_HEIGHT)); Right.Intersect(new Rectangle(Constants.PROJ_WIDTH / 2 + 1, 0, Constants.PROJ_WIDTH / 2, Constants.PROJ_HEIGHT)); InnerBorder = InnerBlock.Clone(); InnerBorder.Exclude(Top); InnerBorder.Exclude(Left); InnerBorder.Exclude(Right); }
//Implement a base rendering of an element protected internal override void RenderShadow(Graphics graphics,IRender render) { if (mPoints == null) return; if (mPoints.Count < 2) return; PointF startLocation = (PointF) mPoints[0]; PointF startReference = (PointF) mPoints[1]; PointF endLocation = (PointF) mPoints[mPoints.Count-1]; PointF endReference = (PointF) mPoints[mPoints.Count-2]; Layer layer = this.Layer; Pen shadowPen = new Pen(layer.ShadowColor); GraphicsPath shadowPath = GetPathInternal(); shadowPen.Color = render.AdjustColor(layer.ShadowColor,0,this.Opacity); //Save the current region Region current = graphics.Clip; //Mask out the start marker if (Start.Marker != null) { Region region = new Region(Start.Marker.GetPathInternal()); region.Transform(GetMarkerTransform(Start.Marker,startLocation,startReference,new Matrix())); region.Translate(layer.ShadowOffset.X ,layer.ShadowOffset.Y); graphics.SetClip(region,CombineMode.Exclude); } //Mask out the end marker if (End.Marker != null) { Region region = new Region(End.Marker.GetPathInternal()); region.Transform(GetMarkerTransform(End.Marker,endLocation,endReference,new Matrix())); region.Translate(layer.ShadowOffset.X ,layer.ShadowOffset.Y); graphics.SetClip(region,CombineMode.Exclude); } graphics.TranslateTransform(layer.ShadowOffset.X ,layer.ShadowOffset.Y); //Draw line if (Layer.SoftShadows) { shadowPen.Color = Color.FromArgb(20,shadowPen.Color); graphics.CompositingQuality = CompositingQuality.HighQuality; graphics.SmoothingMode = SmoothingMode.HighQuality; } graphics.DrawPath(shadowPen, shadowPath); if (layer.SoftShadows) { graphics.CompositingQuality = render.CompositingQuality; graphics.SmoothingMode = SmoothingMode; } //Restore graphics if (Start.Marker != null || End.Marker != null) { graphics.Clip = current; if (Start.Marker != null) RenderMarkerShadow(Start.Marker,startLocation,startReference,graphics,render); if (End.Marker != null) RenderMarkerShadow(End.Marker,endLocation,endReference,graphics,render); } graphics.TranslateTransform(-layer.ShadowOffset.X ,-layer.ShadowOffset.Y); }
protected internal override void RenderShadow(Graphics graphics, IRender render) { if (Points == null) return; PointF location; PointF reference; Segment segment = null; Layer layer = this.Layer; Pen shadowPen = new Pen(layer.ShadowColor); GraphicsPath shadowPath = GetPathInternal(); shadowPen.Color = render.AdjustColor(layer.ShadowColor,0,this.Opacity); //Save the current region Region current = graphics.Clip; //Mask out each marker for (int i=0;i<Points.Count-1;i++) { location = (PointF) Points[i]; reference = (PointF) Points[i+1]; segment = Segments[i]; //Mask out the start marker if (segment.Start.Marker != null) { Region region = new Region(segment.Start.Marker.GetPathInternal()); region.Transform(GetMarkerTransform(segment.Start.Marker,location,reference,new Matrix())); region.Translate(layer.ShadowOffset.X ,layer.ShadowOffset.Y); graphics.SetClip(region,CombineMode.Exclude); } } //Mask out final marker if (segment.End.Marker != null) { location = (PointF) Points[Points.Count-1]; reference = (PointF) Points[Points.Count-2]; Region region = new Region(segment.End.Marker.GetPathInternal()); region.Transform(GetMarkerTransform(segment.End.Marker,location,reference,new Matrix())); region.Translate(layer.ShadowOffset.X ,layer.ShadowOffset.Y); graphics.SetClip(region,CombineMode.Exclude); } //Draw the path graphics.TranslateTransform(layer.ShadowOffset.X ,layer.ShadowOffset.Y); graphics.DrawPath(shadowPen,shadowPath); //Reset the clip graphics.Clip = current; //Render the markers for (int i=0;i<Points.Count-1;i++) { segment = Segments[i]; location = (PointF) Points[i]; reference = (PointF) Points[i+1]; if (segment.Start.Marker != null) RenderMarkerShadow(segment.Start.Marker,location,reference,graphics,render); } //Render final marker if (segment.End.Marker != null) { location = (PointF) Points[Points.Count-1]; reference = (PointF) Points[Points.Count-2]; RenderMarkerShadow(segment.End.Marker,location,reference,graphics,render); } graphics.TranslateTransform(-layer.ShadowOffset.X ,-layer.ShadowOffset.Y); }
public void InfinityTranslate () { using (Region r = new Region ()) { Assert.IsTrue (r.IsInfinite (graphic), "before"); r.Translate (10, 10); Assert.IsTrue (r.IsInfinite (graphic), "after"); CheckEmpty ("InfinityTranslate", r); } }
private RectangleF GetTransformCellRect(int index) { RectangleF rect = GetCellRect(index); Region region = new Region(rect); region.Translate(AutoScrollPosition.X, AutoScrollPosition.Y); rect = region.GetBounds(CreateGraphics()); return rect; }
public override void Paint(Graphics g) { base.Paint(g); g.SmoothingMode = SmoothingMode.HighQuality; using (Pen pen = new Pen(lineColor, lineWidth)) { SizeF titleSize = g.MeasureString(this.Title, ArtPalette.DefaultBoldFont, Rectangle.Width - 45); titleSize.Height += 10; //add spacing SizeF subtitleSize = g.MeasureString(this.Subtitle, ArtPalette.DefaultFont, Rectangle.Width - 45); subtitleSize.Height += 5; //add spacing if (this.Title == this.Subtitle || string.IsNullOrEmpty(this.Subtitle)) subtitleSize = new SizeF(0, 0); if ((int)titleSize.Height + (int)subtitleSize.Height != Rectangle.Height) { headerHeight = (int)titleSize.Height + (int)subtitleSize.Height; this.UpdateLabels(); } GraphicsPath path = new GraphicsPath(); path.AddArc(Rectangle.X, Rectangle.Y, 20, 20, -180, 90); path.AddLine(Rectangle.X + 10, Rectangle.Y, Rectangle.X + Rectangle.Width - 10, Rectangle.Y); path.AddArc(Rectangle.X + Rectangle.Width - 20, Rectangle.Y, 20, 20, -90, 90); path.AddLine(Rectangle.X + Rectangle.Width, Rectangle.Y + 10, Rectangle.X + Rectangle.Width, Rectangle.Y + Rectangle.Height - 10); path.AddArc(Rectangle.X + Rectangle.Width - 20, Rectangle.Y + Rectangle.Height - 20, 20, 20, 0, 90); path.AddLine(Rectangle.X + Rectangle.Width - 10, Rectangle.Y + Rectangle.Height, Rectangle.X + 10, Rectangle.Y + Rectangle.Height); path.AddArc(Rectangle.X, Rectangle.Y + Rectangle.Height - 20, 20, 20, 90, 90); path.AddLine(Rectangle.X, Rectangle.Y + Rectangle.Height - 10, Rectangle.X, Rectangle.Y + 10); //shadow if (ArtPalette.EnableShadows) { Region darkRegion = new Region(path); darkRegion.Translate(5, 5); g.FillRegion(ArtPalette.ShadowBrush, darkRegion); } //background g.FillPath(Brush, path); using (LinearGradientBrush gradientBrush = new LinearGradientBrush(Rectangle.Location, new Point(Rectangle.X + Rectangle.Width, Rectangle.Y), this.Color, Color.White)) { Region gradientRegion = new Region(path); g.FillRegion(gradientBrush, gradientRegion); } if (!this.Collapsed) { TextStyle textStyle = new TextStyle(Color.Black, new Font("Arial", 7), StringAlignment.Near, StringAlignment.Near); StringFormat stringFormat = textStyle.StringFormat; stringFormat.Trimming = StringTrimming.EllipsisWord; stringFormat.FormatFlags = StringFormatFlags.LineLimit; Rectangle rect; const int verticalHeaderSpacing = 5; Point separationLineStart = new Point(Rectangle.X + 25, Rectangle.Y + headerHeight - verticalHeaderSpacing); Point separationLineEnd = new Point(Rectangle.X + Rectangle.Width - 25, Rectangle.Y + headerHeight - verticalHeaderSpacing); using (LinearGradientBrush brush = new LinearGradientBrush(separationLineStart, separationLineEnd, Color.Black, Color.White)) { using (Pen separationLinePen = new Pen(brush)) { g.DrawLine(separationLinePen, separationLineStart, separationLineEnd); } } for (int i = 0; i < this.labels.Count; i++) { rect = new Rectangle(Rectangle.X + 25, Rectangle.Y + headerHeight + i * (LABEL_HEIGHT + LABEL_SPACING), LABEL_WIDTH, LABEL_HEIGHT); g.DrawString(textStyle.GetFormattedText(this.labels[i]), textStyle.Font, textStyle.GetBrush(), rect, stringFormat); } } //the border g.DrawPath(pen, path); //the title g.DrawString(this.Title, ArtPalette.DefaultBoldFont, Brushes.Black, new Rectangle(Rectangle.X + 25, Rectangle.Y + 5, Rectangle.Width - 45, Rectangle.Height - 5 - (int)subtitleSize.Height)); //the subtitle if (this.Title != this.Subtitle || string.IsNullOrEmpty(this.Subtitle)) { g.DrawString(this.Subtitle, ArtPalette.DefaultFont, Brushes.Black, new Rectangle(Rectangle.X + 25, Rectangle.Y + (int)titleSize.Height -5 , Rectangle.Width - 45, Rectangle.Height - 5)); } //the material foreach (IShapeMaterial material in Children) material.Paint(g); //the connectors if (this.ShowConnectors) { foreach (IConnector t in Connectors) t.Paint(g); } } }
/// <summary> /// Draws the given cell and label onto the specified canvas. No /// children or descendants are painted. /// </summary> public void DrawState(mxICanvas canvas, mxCellState state, String label) { Object cell = (state != null) ? state.Cell : null; if (cell != null && cell != model.Root && (model.IsVertex(cell) || model.IsEdge(cell))) { Object obj = canvas.DrawCell(state); Object lab = null; // Holds the current clipping region in case the label will // be clipped Region clip = null; Region newClip = new Region(state.GetRectangle()); // Indirection for image canvas that contains a graphics canvas mxICanvas clippedCanvas = (mxUtils.GetString(state.Style, mxConstants. STYLE_OVERFLOW, "").Equals("hidden")) ? canvas : null; if (clippedCanvas is mxImageCanvas) { clippedCanvas = ((mxImageCanvas) clippedCanvas).GdiCanvas; Point pt = ((mxImageCanvas) canvas).Translate; newClip.Translate(pt.X, pt.Y); } if (clippedCanvas is mxGdiCanvas) { Graphics g = ((mxGdiCanvas) clippedCanvas).Graphics; clip = g.Clip; g.Clip = newClip; } if (label != null && state.LabelBounds != null) { lab = canvas.DrawLabel(label, state, false); } // Restores the previous clipping region if (clippedCanvas is mxGdiCanvas) { ((mxGdiCanvas)clippedCanvas).Graphics.Clip = clip; } // Invokes the cellDrawn callback with the object which was created // by the canvas to represent the cell graphically if (obj != null) { // LATER: Add inner callback for rendering //CellDrawn(cell, obj, lab); } } }
// Set the caret bounds from a character position // Set update region internal override void CaretSetPosition( int position) { // remember Caret position caretPosition = position; if (!IsHandleCreated) { return; } Rectangle newBounds = Rectangle.Empty; int height = Font.Height; if (Text.Length == 0) { newBounds = new Rectangle(CaretXFromAlign, 1, 1, height); } else { if (position == Text.Length) { // If the last character is a linefeed, position ourselves at the // beginning of the following line. Otherwise, position ourselves // immediately to the right of the last character. LayoutInfo.Item item = layout.Items[position -1]; newBounds = item.bounds; if (item.type == LayoutInfo.Item.CharType.LF) { newBounds = new Rectangle(CaretXFromAlign, newBounds.Top + height, 1, height); } else { newBounds = new Rectangle(newBounds.Right, newBounds.Top, 1, newBounds.Height + 1); } } else { newBounds = layout.Items[position].bounds; newBounds = new Rectangle(newBounds.Left, newBounds.Top, 1, newBounds.Height + 1); } } // This looks better. if (newBounds.X == 0) newBounds.X = 1; // When we change the caret position, find the region to update Region region = new Region(newBounds); if (!caretHiding) { region.Xor(caretBounds); } region.Translate(- XViewOffset, - YViewOffset); AddUpdate(region); caretBounds = newBounds; if (Focused) { CaretShow(); } }
// Called to change the text. Sets the update to whats needed to but doesnt change the selection point or caret private void SetTextActual( string text) { if( !IsHandleCreated ) { // create handle here to be sure that LayoutInfo will be set correct. this.CreateHandle(); } // Layout the new text. Compare with old layout, Creating a region for areas that must be updated. bool prevLayout = layout != null; LayoutInfo oldLayout = null; if (prevLayout) { oldLayout = (LayoutInfo)layout.Clone(); } string oldText = Text; LayoutFromText(text); // We must not trigger the onTextChanged event yet else this controls text could be change in the event! (this as Control).text = text; SetScrollBarPositions(); if (prevLayout) { try { Region update = new Region(RectangleF.Empty); int oldLen = oldText.Length; int newLen = text.Length; int len = newLen; if (oldLen > len) { len = oldLen; } for (int i=0;i < len;i++) { if (i >= oldLen) { if( i < newLen ) update.Union( layout.Items[i].bounds); } else if (i >= newLen ) { if( i < oldLen ) update.Union( oldLayout.Items[i].bounds); } else if ( (i < oldLen && i < newLen) && (Text[i] != oldText[i] || oldLayout.Items[i].bounds != layout.Items[i].bounds ) ) { if( i < newLen ) { update.Union( layout.Items[i].bounds); } if( i < oldLen ) { update.Union( oldLayout.Items[i].bounds); } } } // Get the offset of the TextDrawArea update.Translate( - XViewOffset, - YViewOffset); AddUpdate(update); } catch { // ignore exceptions here, because in some cases this could happen } } }
public static void SetRoundedRegion(Form form, Size overrideSize) { int width, height; if (overrideSize == Size.Empty) { width = form.ClientSize.Width; height = form.ClientSize.Height; } else { width = overrideSize.Width; height = overrideSize.Height; } Region r = new Region(new Rectangle(3, 0, width - 6, height)); r.Union(new Rectangle(2, 1, width - 4, height - 2)); r.Union(new Rectangle(1, 2, width - 2, height - 4)); r.Union(new Rectangle(0, 3, width, height - 6)); RECT rect = new RECT(); User32.GetWindowRect(form.Handle, ref rect); Point windowScreenPos = RectangleHelper.Convert(rect).Location; Point clientScreenPos = form.PointToScreen(new Point(0, 0)); r.Translate(clientScreenPos.X - windowScreenPos.X, clientScreenPos.Y - windowScreenPos.Y); form.Region = r; }
internal void InvalidateAdornerWindow(Region region) { if (this.DesignerFrameValid) { Point autoScrollPosition = ((System.Windows.Forms.Design.DesignerFrame) this.designerFrame).AutoScrollPosition; region.Translate(autoScrollPosition.X, autoScrollPosition.Y); this.designerFrame.Invalidate(region, true); this.designerFrame.Update(); } }
/// <summary> /// Calculates the region of the rectangle that is not overlapped by siblings or children. /// </summary> /// <param name="rectangle">The rectangle.</param> /// <param name="potentialIntersections">An array of potentially intersecting rectangles.</param> /// <returns>A region.</returns> public static Region GetClippedRegion(Rectangle rectangle, IEnumerable<Rectangle> potentialIntersections) { var region = new Region(rectangle); // Exclude children and intersecting siblings RectangleUtil.ChildrenAndIntersectingSiblings(rectangle, potentialIntersections).ForEach(region.Exclude); // Set X and Y to 0 region.Translate(-rectangle.Left, -rectangle.Top); return region; }
public void InvalidateRegion( Region r ) { if( !zoomon ) { r.Translate( left_margin - offx, top_margin - offy ); r.Intersect( DiagramArea ); Invalidate( r ); } else { Invalidate(); } }
// Process when the control loses the focus protected override void OnLeave(EventArgs e) { base.OnLeave (e); // Create a region containing the caret and all visible selected text Region update = new Region(caretBounds); for (int i = 0; i < Text.Length; i++) { if (layout.Items[i].selected) { Rectangle b = layout.Items[i].bounds; update.Union(new Region(new Rectangle(b.Left,b.Top,b.Width,b.Height + 1))); } } update.Translate(- XViewOffset, - YViewOffset); AddUpdate(update); caretHiding = true; InvalidateDirty(); mouseDown = false; // We dont need to update any selection if( null != selectedRegion ) { selectedRegion.Dispose(); selectedRegion = null; } }
/// <summary> /// IE will, in fact, call Draw() more than once in drawing the element, as it paints the element rectangle in successive horizontal bands. /// For this reason, it is best to prepare an off-screen bitmap image before element invalidation, so that successive calls to Draw() /// deal with an unchanging graphic. When IE calls Draw(), the drawing requirements dictated by IE are obtained through GetDrawInfo(), /// and any necessary image transformation and clipping can then be applied before rendering with Graphics.DrawImage(). /// </summary> /// <param name="rcBounds"></param> /// <param name="rcUpdate"></param> /// <param name="lDrawFlags"></param> /// <param name="hdc"></param> /// <param name="pvDrawObject"></param> // FIXME: Move this to an IE specific HTMLCanvasElement implementation. public void Draw(tagRECT rcBounds, tagRECT rcUpdate, int lDrawFlags, IntPtr hdc, IntPtr pvDrawObject) { // _element.Paint -= _element.HTMLCanvasElement_Paint; _graphics = Graphics.FromHdc(hdc); _graphics.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceOver; // Apply any scaling, etc. to the output. _HTML_PAINT_DRAW_INFO info; _paintSite.GetDrawInfo( (int)_HTML_PAINT_DRAW_INFO_FLAGS.HTMLPAINT_DRAWINFO_XFORM | (int)_HTML_PAINT_DRAW_INFO_FLAGS.HTMLPAINT_DRAWINFO_UPDATEREGION, out info); var xform = new System.Drawing.Drawing2D.Matrix( info.xform.eM11, info.xform.eM12, info.xform.eM21, info.xform.eM22, info.xform.eDx - rcBounds.left, info.xform.eDy - rcBounds.top); _graphics.Transform = xform; // Update clipping region. var clip = new Region(); if (info.hrgnUpdate != IntPtr.Zero) { Region updateclip = Region.FromHrgn(info.hrgnUpdate); clip.Intersect(updateclip); clip.Translate(rcBounds.left, rcBounds.top); } _graphics.SetClip(clip, System.Drawing.Drawing2D.CombineMode.Replace); if (init != null) //run only once { _init.GetType().InvokeMember("", System.Reflection.BindingFlags.InvokeMethod, null, _init, new object[] { }); _init = null; } // _element.Draw(_graphics, rcBounds, rcUpdate); _graphics.Dispose(); }
public static Region TranslatedAndClipped(this Region r, int dx, int dy, Rectangle clip) { Region R = new Region(); R.Intersect(r); R.Intersect(clip); R.Translate(dx, dy); return R; }
public void TranslateRegion(Graphics g) { Pen myPen = new Pen(Color.FromArgb(196, 0xC3, 0xC9, 0xCF), (float)0.6); SolidBrush myBrush = new SolidBrush(Color.FromArgb(127, 0xDD, 0xDD, 0xF0)); // Create the first rectangle and draw it to the screen in blue. Rectangle regionRect = new Rectangle(100, 50, 100, 100); g.DrawRectangle(myPen, regionRect); g.FillRectangle (myBrush, regionRect); // Create a region using the first rectangle. Region myRegion = new Region(regionRect); // Apply the translation to the region. myRegion.Translate(150, 100); // Fill the transformed region with red and draw it to the screen in red. myBrush.Color = Color.FromArgb(127, 0x66, 0xEF, 0x7F); myPen.Color = Color.FromArgb(255, 0, 0x33, 0); g.FillRegion(myBrush, myRegion); title = "TranslateRegion"; }
public void TestTranslate() { Region rgn1 = new Region (new RectangleF (10, 10, 120,120)); rgn1.Translate (30,20); Matrix matrix = new Matrix (); RectangleF [] rects = rgn1.GetRegionScans (matrix); Assert.AreEqual (1, rects.Length); Assert.AreEqual (40, rects[0].X); Assert.AreEqual (30, rects[0].Y); Assert.AreEqual (120, rects[0].Width); Assert.AreEqual (120, rects[0].Height); }
public void Translate_Float () { Region r1 = new Region (sp1); Region r2 = new Region (sp2); r2.Translate (-2.0f, -2.0f); r1.Intersect (r2); CompareSmallRegion (r1, self1, 7, 7); }
public void InfinityIntersectTranslate () { using (Region r = new Region ()) { Assert.IsTrue (r.IsInfinite (graphic), "before"); r.Intersect (new Rectangle (-10, -10, 20, 20)); r.Translate (10, 10); RectangleF bounds = r.GetBounds (graphic); Assert.AreEqual (0, bounds.X, "X"); Assert.AreEqual (0, bounds.Y, "Y"); Assert.AreEqual (20, bounds.Width, "Width"); Assert.AreEqual (20, bounds.Height, "Height"); } }
private void Invalidate(int i1, int i2) { Rectangle rect; if (i2 == -1) { i2 = i1; } rect = rectangles[i2]; Region r = new Region(rect); if (i1 != -1) { try { rect = rectangles[i1]; r.Union(rect); } catch (IndexOutOfRangeException ex) { Console.WriteLine(ex.Message); } } r.Translate(AutoScrollPosition.X, AutoScrollPosition.Y); Invalidate(r); r.Dispose(); }
/// <summary> /// Paints the bundle on the canvas /// </summary> /// <param name="g"></param> public override void Paint(Graphics g) { g.SmoothingMode = SmoothingMode.HighQuality; GraphicsPath path = new GraphicsPath(); path.AddArc(Rectangle.X, Rectangle.Y, 20, 20, -180, 90); path.AddLine(Rectangle.X + 10, Rectangle.Y, Rectangle.X + Rectangle.Width - 10, Rectangle.Y); path.AddArc(Rectangle.X + Rectangle.Width - 20, Rectangle.Y, 20, 20, -90, 90); path.AddLine(Rectangle.X + Rectangle.Width, Rectangle.Y + 10, Rectangle.X + Rectangle.Width, Rectangle.Y + Rectangle.Height - 10); path.AddArc(Rectangle.X + Rectangle.Width - 20, Rectangle.Y + Rectangle.Height - 20, 20, 20, 0, 90); path.AddLine(Rectangle.X + Rectangle.Width - 10, Rectangle.Y + Rectangle.Height, Rectangle.X + 10, Rectangle.Y + Rectangle.Height); path.AddArc(Rectangle.X, Rectangle.Y + Rectangle.Height - 20, 20, 20, 90, 90); path.AddLine(Rectangle.X, Rectangle.Y + Rectangle.Height - 10, Rectangle.X, Rectangle.Y + 10); //shadow Region darkRegion = new Region(path); darkRegion.Translate(4, 4); g.FillRegion(ArtPallet.ShadowBrush, darkRegion); //background g.FillPath(Brushes.White, path); //the border if(Hovered || IsSelected) g.DrawPath(ArtPallet.HighlightPen, path); else g.DrawPath(Pen, path); //the connectors Brush cBrush = ArtPallet.GetSolidBrush(Color.Gray, 255); //Color.SteelBlue foreach(Connector c in cOut) { g.FillRectangle(cBrush, c.Point.X - 7, c.Point.Y - 12, 7, 24); g.FillPie(cBrush, c.Point.X - 18, c.Point.Y - 12, 24, 24, 90, 180); //g.FillEllipse(cBrush, c.Point.X - 12, c.Point.Y - 12, 24, 24); } for(int k = 0; k < Connectors.Count; k++) { Connectors[k].Paint(g); } if(port != null) { g.DrawString(port.Entity.Symbol, ArtPallet.DefaultBoldFont, Brushes.Black, TextRectangle.X, TextRectangle.Y); g.DrawString(port.Entity.EntityId.Domain, ArtPallet.DefaultFont, Brushes.Black, TextRectangle.X, TextRectangle.Y + 15); g.DrawString(port.Entity.EntityId.Label, ArtPallet.DefaultFont, Brushes.Black, TextRectangle.X, TextRectangle.Y + 30); } }