private void UpdateFilletBounds() { if (this.Width <= 0) { return; } m_Path = RoundRect.GetRoundRectPath(new Rectangle(0, 0, this.Width, this.Height), radius); }
/// <summary> /// C# GDI+ 绘制圆角实心矩形 /// </summary> /// <param name="g">Graphics 对象</param> /// <param name="rectangle">要填充的矩形</param> /// <param name="backColor">填充背景色</param> /// <param name="r">圆角半径</param> public static void FillRoundRectangle(Graphics g, Rectangle rectangle, Color backColor, int r) { rectangle = new Rectangle(rectangle.X, rectangle.Y, rectangle.Width - 1, rectangle.Height - 1); Brush b = new SolidBrush(backColor); g.SmoothingMode = SmoothingMode.AntiAlias; g.FillPath(b, RoundRect.GetRoundRectPath(rectangle, r)); }
public override void Dispose() { if (this.rect != null) { this.rect.Dispose(); this.rect = null; } base.Dispose(); }
public RoundQuadDescriptor(float cornerRadius = 0.1f, bool enableCenter = true, int cornerResolution = 6) : base(PrimitiveType.RoundQuad) { var size = new SlimDX.Vector2(cornerRadius > 0 ? 0.5f - cornerRadius : 0.5f); Settings = new RoundRect() { InnerRadius = size, OuterRadius = cornerRadius * 0.5f, EnableCenter = enableCenter, CornerResolution = cornerResolution }; }
protected override DX11IndexedGeometry GetGeom(DX11RenderContext context, int slice) { RoundRect roundrect = new RoundRect() { CornerResolution = this.FInRes[slice], EnableCenter = this.FInCenter[slice], InnerRadius = this.FInInner[slice], OuterRadius = this.FInOuter[slice] }; return(context.Primitives.RoundRect(roundrect)); }
protected override void OnPaint(PaintEventArgs e) { var g = e.Graphics; g.Clear(BackColor); g.SmoothingMode = SmoothingMode.HighQuality; var borderRectangle = new Rectangle(0, 0, Width - 1, Height - 2); var roundedBorderPath = RoundRect.Round(borderRectangle, 2); g.DrawPath(_p1, roundedBorderPath); g.FillPath(_b1, roundedBorderPath); }
public MemberSymbol() { this.rect = new RoundRect(0, 0, 140, 60); this.rect.FillStyle.Color = System.Drawing.Color.Beige; this.AppendChild(this.rect); this.nameLbl = this.AddLabel("", BoxPosition.Center); this.nameLbl.OffsetY = -12; this.nameLbl.FontStyle.Style = System.Drawing.FontStyle.Bold; this.nameLbl.BackgroundStyle.Color = System.Drawing.Color.Transparent; this.titleLbl = this.AddLabel("", BoxPosition.Center); this.titleLbl.OffsetY = 12; this.titleLbl.BackgroundStyle.Color = System.Drawing.Color.Transparent; }
protected override void OnPaint(PaintEventArgs e) { var g = e.Graphics; g.Clear(Color.FromArgb(96, 110, 121)); g.TextRenderingHint = TextRenderingHint.ClearTypeGridFit; g.SmoothingMode = SmoothingMode.AntiAlias; GraphicsPath graphicsPath; var itemHeight = ItemSize.Height + 2; for (var i = 0; i < TabCount; i++) { var tabPage = TabPages[i]; var tabRectangle = GetTabRect(i); tabRectangle.Y += 2; tabRectangle.Height -= 3; tabRectangle.Width += 5; tabRectangle.X -= 1; if (i == SelectedIndex) { using (graphicsPath = RoundRect.Round(tabRectangle, 7)) { g.FillPath(_b1, graphicsPath); g.DrawPath(_p2, graphicsPath); } using (graphicsPath = RoundRect.Round(tabRectangle.X + 2, tabRectangle.Y + 3, tabRectangle.Width, tabRectangle.Height - 6, 7)) g.DrawPath(_p3, graphicsPath); } tabRectangle.X += 10; var offsetTabRectangle = tabRectangle; offsetTabRectangle.Y += 1; offsetTabRectangle.X += 1; var tabText = tabPage.Text.ToUpper(); g.DrawString(tabText, _tabFont, Brushes.Black, offsetTabRectangle, _stringFormat); g.DrawString(tabText, _tabFont, (i == SelectedIndex) ? Brushes.White : _b2, tabRectangle, _stringFormat); } using (graphicsPath = RoundRect.Round(itemHeight, 0, Width - itemHeight - 1, Height - 1, 15)) { g.FillPath(Brushes.White, graphicsPath); g.DrawPath(_p1, graphicsPath); } }
protected override void CreateShape() { if (this.rect != null) { this.rect.Dispose(); } float effLineWidth = (StrokeLineWidth ?? 1.0f) - 1.0f; this.rect = new RoundRect(vg, this.Bounds - new Bounds(effLineWidth, effLineWidth), arcWidth, arcHeight) { StrokeLineWidth = StrokeLineWidth }; }
public static void Main() { RoundRect rr = new RoundRect(); rr.Draw(); rr.Color(); Rect n = new RoundRect(); n.Color(); n.Draw(); //c#에서 메서드에 대한 기본 바인딩 정책은 정적 바인딩이다. //정적 바인딩 : 컴파일 타임에 바인딩이 결정되고 // 프로그램의 구동 중에 다른 메서드로 변경되지 않는개념 // 동적 바인딩 : 프로그램 구동중에 메서드가 변경되는 개념. }
protected override void OnPaint(PaintEventArgs e) { var g = e.Graphics; g.Clear(Color.FromArgb(96, 110, 121)); g.TextRenderingHint = TextRenderingHint.ClearTypeGridFit; g.SmoothingMode = SmoothingMode.AntiAlias; var innerRectangle = ClientRectangle; innerRectangle.Height -= 4; g.FillPath(Brushes.LightGray, RoundRect.Round(ClientRectangle, 7)); g.FillPath(Brushes.White, RoundRect.Round(innerRectangle, 7)); base.OnPaint(e); }
/// <summary> /// Create a new instance of CustomGroup /// </summary> /// <param name="classList">ClassList</param> public CustomGroup(ClassList classList) { _lstClass = classList; float Height = 60, PinPointY = 0; //if (string.IsNullOrEmpty(classList.ObjectType)) // Height = 55; CustomRectangle customRect = new CustomRectangle(0, 0, 220, Height); customRect.ClassName = classList.ClassName; customRect.ClassType = classList.ClassType; customRect.ObjectType = classList.ObjectType; customRect.TitleImage = Image.FromFile(@"..\..\..\..\..\..\..\Common\Images\Diagram\class diagram\5.png"); customRect.FillStyle.Color = Color.Transparent; customRect.LineStyle.LineColor = Color.Transparent; this.AppendChild(customRect); PinPointY = customRect.PinPoint.Y + (customRect.Size.Height - customRect.PinPoint.Y); if (classList.PropertyList.Count > 0) { RowRectangle rect = new RowRectangle(0, PinPointY, 220, 25); rect.FillStyle.Color = Color.FromArgb(248, 249, 252); rect.LineStyle.LineColor = Color.Transparent; rect.Labels[0].OffsetX = 25; rect.RowText = "Properties"; this.AppendChild(rect); PinPointY = rect.PinPoint.Y + 12.5f; for (int i = 0; i < classList.PropertyList.Count; i++) { RowRectangle rect1 = new RowRectangle(0, PinPointY, 220, 25); if (classList.PropertyList[i].PropertyType == PropertyType.Internal) { rect1.RowImage = Image.FromFile(@"..\..\..\..\..\..\..\Common\Images\Diagram\class diagram\6.png"); } else { rect1.RowImage = Image.FromFile(@"..\..\..\..\..\..\..\Common\Images\Diagram\class diagram\7.png"); } rect1.RowText = classList.PropertyList[i].PropertyName; rect1.FillStyle.Color = Color.White; rect1.LineStyle.LineColor = Color.Transparent; this.AppendChild(rect1); PinPointY += rect1.PinPoint.Y + (rect1.Size.Height - rect1.PinPoint.Y); } } if (classList.MethodList.Count > 0) { RowRectangle rect = new RowRectangle(0, PinPointY, 220, 25); rect.FillStyle.Color = Color.FromArgb(248, 249, 252); rect.LineStyle.LineColor = Color.Transparent; rect.RowText = "Methods"; rect.Labels[0].OffsetX = 25; this.AppendChild(rect); PinPointY = rect.PinPoint.Y + 12.5f; for (int i = 0; i < classList.MethodList.Count; i++) { RowRectangle rect1 = new RowRectangle(0, PinPointY, 220, 25); if (classList.MethodList[i].MethodType == MethodType.Internal) { rect1.RowImage = Image.FromFile(@"..\..\..\..\..\..\..\Common\Images\Diagram\class diagram\1.png"); } else if (classList.MethodList[i].MethodType == MethodType.Protected) { rect1.RowImage = Image.FromFile(@"..\..\..\..\..\..\..\Common\Images\Diagram\class diagram\2.png"); } else if (classList.MethodList[i].MethodType == MethodType.Public) { rect1.RowImage = Image.FromFile(@"..\..\..\..\..\..\..\Common\Images\Diagram\class diagram\3.png"); } rect1.RowText = classList.MethodList[i].MethodName; rect1.FillStyle.Color = Color.White; rect1.LineStyle.LineColor = Color.Transparent; this.AppendChild(rect1); PinPointY += 25; } } RoundRect roundRect = new RoundRect(this.Nodes[0].PinPoint.X - 110, this.Nodes[0].PinPoint.Y - 30, this.Size.Width, this.Size.Height + 10, MeasureUnits.Pixel); roundRect.FillStyle.Color = Color.White; roundRect.FillStyle.ForeColor = Color.FromArgb(236, 238, 247); roundRect.FillStyle.ForeColor = Color.FromArgb(222, 226, 241); roundRect.FillStyle.Type = FillStyleType.LinearGradient; roundRect.FillStyle.GradientAngle = 90; roundRect.FillStyle.GradientCenter = 1; roundRect.LineStyle.LineColor = Color.FromArgb(199, 205, 231); this.AppendChild(roundRect); this.SendToBack(roundRect); }
/// <summary> /// Initialize the Diagram from XML file /// </summary> protected void InitializeDiagramFromXMLData(string path) { diagram1.Model.Clear(); diagram1.Model.BeginUpdate(); RoundRect rrect = new RoundRect(900, 30, 250, 70, MeasureUnits.Pixel); rrect.FillStyle.Color = Color.Transparent; rrect.EditStyle.AllowSelect = false; rrect.LineStyle.LineColor = Color.Gray; Syncfusion.Windows.Forms.Diagram.Label lbl = new Syncfusion.Windows.Forms.Diagram.Label(rrect, "Relationships"); lbl.Position = Position.TopLeft; lbl.FontStyle.Family = "Segoe UI"; lbl.FontStyle.Size = 9; rrect.Labels.Add(lbl); Syncfusion.Windows.Forms.Diagram.Label lblOneToOne = new Syncfusion.Windows.Forms.Diagram.Label(rrect, ": OneToOne"); lblOneToOne.FontStyle.Family = "Segoe UI"; lblOneToOne.FontStyle.Size = 9; lblOneToOne.OffsetX = 120; lblOneToOne.OffsetY = 10; rrect.Labels.Add(lblOneToOne); Syncfusion.Windows.Forms.Diagram.Label lblOneToMany = new Syncfusion.Windows.Forms.Diagram.Label(rrect, ": OneToMany"); lblOneToMany.FontStyle.Family = "Segoe UI"; lblOneToMany.FontStyle.Size = 9; lblOneToMany.OffsetX = 120; lblOneToMany.OffsetY = 40; rrect.Labels.Add(lblOneToMany); diagram1.Model.AppendChild(rrect); LineConnector oneToOne = new LineConnector(new PointF(910, 50), new PointF(1010, 50)); oneToOne.EditStyle.AllowSelect = false; oneToOne.TailDecorator.DecoratorShape = DecoratorShape.FilledDiamond; oneToOne.HeadDecorator.DecoratorShape = DecoratorShape.FilledDiamond; diagram1.Model.AppendChild(oneToOne); LineConnector oneToMany = new LineConnector(new PointF(910, 80), new PointF(1010, 80)); oneToMany.EditStyle.AllowSelect = false; oneToMany.TailDecorator.DecoratorShape = DecoratorShape.Diamond; oneToMany.HeadDecorator.DecoratorShape = DecoratorShape.FilledDiamond; diagram1.Model.AppendChild(oneToMany); // Read data from the XML data file and populate a Hashtable using the employee ID as the key Hashtable lstEmployees = this.ReadEmployeeDataFromXMLFile(path); // Create a manager-employee nested list with top-level employees forming the root nodes ArrayList sortedlist = this.GetSortedEmployeesList(lstEmployees); foreach (Employee emply in sortedlist) { this.IterUpdateSubEmployeeCount(emply); } // Create diagram symbol nodes for each employee and initialize the diagram this.CreateOrgDiagramFromList(sortedlist); lstEmployees.Clear(); sortedlist.Clear(); //Make connection between nodes ConnectNodes(); diagram1.Model.EndUpdate(); diagram1.View.SelectionList.Clear(); }