/// <summary> /// Initializes this instance. /// </summary> private void 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); #region Some examples of materials; feel free to add/remove what you wish /* ClickableIconMaterial cicon = new ClickableIconMaterial("Resources.Schema.ico"); cicon.Resizable = false; cicon.Gliding = false; cicon.Transform(new Rectangle(Rectangle.X + 10, Rectangle.Y + 10, 16, 16)); Children.Add(cicon); */ /* SwitchIconMaterial xicon = new SwitchIconMaterial(SwitchIconType.PlusMinus); xicon.Gliding = false; xicon.Resizable = false; xicon.Transform(new Rectangle(Rectangle.X + 10, Rectangle.Y + 10, 16, 16)); Children.Add(xicon); */ /* IconLabelMaterial ilab = new IconLabelMaterial("Resources.PublicMethod.ico", "ISerializable.GetObjectData"); ilab.Gliding = false; ilab.Resizable = false; ilab.Transform(new Rectangle(Rectangle.X + 10, Rectangle.Y + 10, Rectangle.Width - 20, Rectangle.Height - 30)); Children.Add(ilab); */ /* IconMaterial icon = new IconMaterial("Resources.Web.png"); icon.Resizable = false; icon.Gliding = false; if(icon.Icon!=null) icon.Transform(new Rectangle(Rectangle.X + 10, Rectangle.Y + 10, icon.Icon.Width , icon.Icon.Height)); Children.Add(icon); */ /* 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); */ string[] stuff = new string[]{"Wagner", "van Beethoven", "Sibelius", "Lutovski", "Haydn", "Prokofiev", "Karduso"}; FolderMaterial folder = new FolderMaterial("Expand me!", stuff); folder.Transform(new Rectangle(Rectangle.X + 10, Rectangle.Y + 10, Rectangle.Width - 20, Rectangle.Height - 30)); folder.OnFolderChanged += new EventHandler<RectangleEventArgs>(folder_OnFolderChanged); this.Children.Add(folder); #endregion Resizable = true; Services[typeof(IAdditionCallback)] = this; }
// ------------------------------------------------------------------ /// <summary> /// Initialize of the bundle /// </summary> // ------------------------------------------------------------------ protected override void Initialize() { base.Initialize(); Name = "Class Shape"; mTitle = "Class shape"; mSubTitle = "by The Netron Project"; this.Resizable = false; sf.Trimming = StringTrimming.EllipsisCharacter; //the initial size Transform(0, 0, 200, 50); //mList.OnItemAdded += new EventHandler<CollectionEventArgs<ClassShapeItem>>(mList_OnItemAdded); #region The icon material CreateShapeIcon(); #endregion #region The xpand icon material CreateXpansionIcon(); #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 The folders /* The following code is only an example of what is possible. * You can add any shape material here but I guess the properties/methods nodes * are quite useful for many purposes. */ string[] props = new string[] { "Rectangle", "Size", "Visible" }; FolderMaterial folder1 = new FolderMaterial("Properties", props, "Resources.PublicProperty.ico"); folder1.Transform(new Rectangle(Rectangle.X + 5, Rectangle.Y + 55, Rectangle.Width - 10, FolderMaterial.HeaderHeight)); folder1.Visible = false; folder1.ShowLines = true; mFolders.Add(folder1); folder1.OnFolderChanged += new EventHandler <RectangleEventArgs>(folders_OnFolderChanged); Children.Add(folder1); mPropertiesNode = folder1; string[] methds = new string[] { "Invalidate", "Transform", "Update", "Reset", "Delete" }; FolderMaterial folder2 = new FolderMaterial("Methods", methds, "Resources.PublicMethod.ico"); folder2.Transform(new Rectangle(Rectangle.X + 5, Rectangle.Y + 55 + FolderMaterial.HeaderHeight + 10, Rectangle.Width - 10, FolderMaterial.HeaderHeight)); folder2.Visible = false; folder2.ShowLines = true; mFolders.Add(folder2); folder2.OnFolderChanged += new EventHandler <RectangleEventArgs>(folders_OnFolderChanged); Children.Add(folder2); mMethodsNode = folder2; #region this calculates the initial body height foreach (FolderMaterial folder in mFolders) { bodyHeight += folder.Rectangle.Height + 3; } //UpdateBody(); #endregion #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 }
// ----------------------------------------------------------------- /// <summary> /// Initializes this instance. /// </summary> // ----------------------------------------------------------------- protected override void Initialize() { base.Initialize(); 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); #region Some examples of materials; feel free to add/remove what you wish /* * ClickableIconMaterial cicon = new ClickableIconMaterial("Resources.Schema.ico"); * cicon.Resizable = false; * cicon.Gliding = false; * cicon.Transform(new Rectangle(Rectangle.X + 10, Rectangle.Y + 10, 16, 16)); * Children.Add(cicon); */ /* * SwitchIconMaterial xicon = new SwitchIconMaterial(SwitchIconType.PlusMinus); * xicon.Gliding = false; * xicon.Resizable = false; * xicon.Transform(new Rectangle(Rectangle.X + 10, Rectangle.Y + 10, 16, 16)); * Children.Add(xicon); */ /* * IconLabelMaterial ilab = new IconLabelMaterial("Resources.PublicMethod.ico", "ISerializable.GetObjectData"); * ilab.Gliding = false; * ilab.Resizable = false; * ilab.Transform(new Rectangle(Rectangle.X + 10, Rectangle.Y + 10, Rectangle.Width - 20, Rectangle.Height - 30)); * Children.Add(ilab); */ /* * IconMaterial icon = new IconMaterial("Resources.Web.png"); * icon.Resizable = false; * icon.Gliding = false; * if(icon.Icon!=null) * icon.Transform(new Rectangle(Rectangle.X + 10, Rectangle.Y + 10, icon.Icon.Width , icon.Icon.Height)); * Children.Add(icon); */ /* * 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); */ string[] stuff = new string[] { "Wagner", "van Beethoven", "Sibelius", "Lutovski", "Haydn", "Prokofiev", "Karduso" }; FolderMaterial folder = new FolderMaterial("Expand me!", stuff); folder.Transform( new Rectangle( Rectangle.X + 10, Rectangle.Y + 10, Rectangle.Width - 20, Rectangle.Height - 30)); folder.OnFolderChanged += new EventHandler <RectangleEventArgs>(folder_OnFolderChanged); this.Children.Add(folder); #endregion Resizable = true; Services[typeof(IAdditionCallback)] = this; }