public override void Init() { base.Init(); cTop = new Connector(new Point((int) (Rectangle.Left + Rectangle.Width / 2), Rectangle.Top), Model); cTop.Name = "Top connector"; cTop.Parent = this; Connectors.Add(cTop); cRight = new Connector(new Point(Rectangle.Right, (int) (Rectangle.Top + Rectangle.Height / 2)), Model); cRight.Name = "Right connector"; cRight.Parent = this; Connectors.Add(cRight); cBottom = new Connector(new Point((int)(Rectangle.Left + Rectangle.Width / 2), Rectangle.Bottom), Model); cBottom.Name = "Bottom connector"; cBottom.Parent = this; Connectors.Add(cBottom); cLeft = new Connector(new Point(Rectangle.Left, (int)(Rectangle.Top + Rectangle.Height / 2)), Model); cLeft.Name = "Left connector"; cLeft.Parent = this; Connectors.Add(cLeft); LabelMaterial label = new LabelMaterial(); label.Text = "Complex rectangle example"; label.Transform( new Rectangle(Rectangle.X + 10, Rectangle.Y + 10, Rectangle.Width - 20, Rectangle.Height-30)); this.Children.Add(label); }
public override void Init() { base.Init(); cTop = new Connector(new Point((int)(Rectangle.Left + Rectangle.Width / 2), Rectangle.Top), Model); cTop.Name = "Top connector"; cTop.Parent = this; Connectors.Add(cTop); cRight = new Connector(new Point(Rectangle.Right, (int)(Rectangle.Top + Rectangle.Height / 2)), Model); cRight.Name = "Right connector"; cRight.Parent = this; Connectors.Add(cRight); cBottom = new Connector(new Point((int)(Rectangle.Left + Rectangle.Width / 2), Rectangle.Bottom), Model); cBottom.Name = "Bottom connector"; cBottom.Parent = this; Connectors.Add(cBottom); cLeft = new Connector(new Point(Rectangle.Left, (int)(Rectangle.Top + Rectangle.Height / 2)), Model); cLeft.Name = "Left connector"; cLeft.Parent = this; Connectors.Add(cLeft); LabelMaterial label = new LabelMaterial(); label.Text = "Complex rectangle example"; label.Transform(new Rectangle(Rectangle.X + 10, Rectangle.Y + 10, Rectangle.Width - 20, Rectangle.Height - 30)); this.Children.Add(label); }
public override void Init() { base.Init(); this.Name = "Class Shape"; title = "Class shape"; subTitle = "by The Netron Project"; bodyText = ""; this.Resizable = false; sf.Trimming = StringTrimming.EllipsisCharacter; //the initial size Transform(0, 0, 200, 50); //the bold font boldFont = new Font(ArtPallet.DefaultFont, FontStyle.Bold); //handle the click to enable the collapse/expand icon this.OnMouseDown += new EventHandler <EntityMouseEventArgs>(ClassShape_Click); mList.OnItemAdded += new EventHandler <CollectionEventArgs <ClassShapeItem> >(mList_OnItemAdded); #region The icon material ClickableIconMaterial icon = new ClickableIconMaterial("Resources.ClassShape.png"); //IconMaterial icon = new IconMaterial("Resources.idea.gif"); if (icon.Icon == null) { throw new InconsistencyException("The icon resource of the class shape could not be found."); } //Rectangle rec = new Rectangle(new Point(Rectangle.X + 5, Rectangle.Y + 3), icon.Icon.Size); icon.Transform(new Rectangle(new Point(Rectangle.X + 5, Rectangle.Y + 5), icon.Icon.Size)); icon.Gliding = false; Children.Add(icon); #endregion #region The xpand icon material //we use a custom version of the ClickableIconMaterial xicon = new ExpansionIcon(); //Rectangle rec = new Rectangle(new Point(Rectangle.Right -20, Rectangle.Y + 5), xicon.Icon.Size); xicon.Transform(new Rectangle(new Point(Rectangle.Right - 20, Rectangle.Y + 7), xicon.Icon.Size)); xicon.Gliding = false; Children.Add(xicon); #endregion #region The free text textMaterial = new LabelMaterial(); textMaterial.Transform(new Rectangle(Rectangle.X + 5, Rectangle.Y + 18, Rectangle.Width - 10, bodyHeight)); textMaterial.Text = GetQuotation(); textMaterial.Visible = false; Children.Add(textMaterial); #endregion #region Connectors cTop = new Connector(new Point((int)(Rectangle.Left + Rectangle.Width / 2), Rectangle.Top), Model); cTop.Name = "Top connector"; cTop.Parent = this; Connectors.Add(cTop); cRight = new Connector(new Point(Rectangle.Right, (int)(Rectangle.Top + Rectangle.Height / 2)), Model); cRight.Name = "Right connector"; cRight.Parent = this; Connectors.Add(cRight); cBottom = new Connector(new Point((int)(Rectangle.Left + Rectangle.Width / 2), Rectangle.Bottom), Model); cBottom.Name = "Bottom connector"; cBottom.Parent = this; Connectors.Add(cBottom); cLeft = new Connector(new Point(Rectangle.Left, (int)(Rectangle.Top + Rectangle.Height / 2)), Model); cLeft.Name = "Left connector"; cLeft.Parent = this; Connectors.Add(cLeft); #endregion }