// ------------------------------------------------------------------ /// <summary> /// Creates the label that shows the file's name. /// </summary> /// <param name="filename">string: The name to show in the /// label.</param> // ------------------------------------------------------------------ void CreateLabel(string filename) { if (this.myLabel == null) { this.myLabel = new LabelMaterial(); Children.Add(this.myLabel); } this.myLabel.Text = filename; }
// ------------------------------------------------------------------ /// <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 }