private void handleRemovePage(object sender, EventArgs e) { WelcomeTabPage page = this.Control as WelcomeTabPage; IDesignerHost h = (IDesignerHost)GetService(typeof(IDesignerHost)); IComponentChangeService c = (IComponentChangeService)GetService(typeof(IComponentChangeService)); DesignerTransaction dt = h.CreateTransaction("Remove Page"); if (page.Parent is WelcomeTabControl) { WelcomeTabControl welcomeTabControl = page.Parent as WelcomeTabControl; c.OnComponentChanging(welcomeTabControl, null); //Drop from WelcomeTabControl welcomeTabControl.Pages.Remove(page); welcomeTabControl.Controls.Remove(page); c.OnComponentChanged(welcomeTabControl, null, null, null); h.DestroyComponent(page); } else { c.OnComponentChanging(page, null); //Mark for destruction page.Dispose(); c.OnComponentChanged(page, null, null, null); } dt.Commit(); }
public void ActivatePage(WelcomeTabPage page) { if (activePage != null) { activePage.Visible = false; } //Activate the new page activePage = page; if (activePage != null) { //Ensure that this panel displays inside the WelcomeTabControl activePage.Parent = this; if (this.Contains(activePage) == false) { this.Container.Add(activePage); } InitPage(activePage); activePage.Visible = true; activePage.BringToFront(); activePage.FocusFirstTabIndex(); } Invalidate(true); }
private void InitPage(WelcomeTabPage page) { page.Location = new Point(LeftEdgeChildren - margin, margin); page.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; page.Width = Width - LeftEdgeChildren; page.Height = Height - margin * 2; page.BackColor = highlightColor; }
protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; Pen p = new Pen(Color.Silver, 2); for (int n = 0; n < Pages.Count; n++) { Rectangle rc = BoundingRect(n); Brush textBrush = Brushes.White; if (Pages[n].Equals(activePage)) { using (GraphicsPath gp = HighlightPath(n)) { e.Graphics.FillPath(new SolidBrush(highlightColor), gp); } textBrush = Brushes.Black; // e.Graphics.FillPath(SystemBrushes.ControlLight, gp); // e.Graphics.DrawPath(new Pen(Brushes.Red, 5), gp); } WelcomeTabPage page = Pages[n]; if (page.ImageList != null) { int dx = (rc.Width - page.ImageList.ImageSize.Width) / 2; int dy = (rc.Height - page.ImageList.ImageSize.Height) / 2; page.ImageList.Draw(e.Graphics, rc.X + dx, rc.Y + dy, page.ImageIndex); } if (n == hoverIndex) { DrawRoundRect(e.Graphics, p, rc, 10); } Rectangle rc2 = new Rectangle(rc.Right + margin, rc.Top + 25, LeftEdgeChildren - rc.Right - margin * 4, 180); rc.Inflate(-margin, -margin); StringFormat fmt = new StringFormat(); fmt.Alignment = StringAlignment.Center; fmt.LineAlignment = StringAlignment.Center; e.Graphics.DrawString(Pages[n].ButtonText, Font, textBrush, rc, fmt); // Brush fb=new SolidBrush(Color.FromArgb(240,240,240)); Font f1 = new Font("Arial", 10, FontStyle.Bold); Font f2 = new Font("Arial", 10); e.Graphics.DrawString(Pages[n].Title, f1, textBrush, rc2.X, rc2.Y - 20); e.Graphics.DrawString(Pages[n].Description, f2, textBrush, rc2); } }
protected internal void ActivatePage(int index) { //If the new page is invalid if (index < 0) { return; } //Change to the new Page WelcomeTabPage tWizPage = ((WelcomeTabPage)pages[index]); //Really activate the page ActivatePage(tWizPage); }
private void handleAddPage(object sender, EventArgs e) { WelcomeTabControl welcomeTabControl = this.Control as WelcomeTabControl; IDesignerHost h = (IDesignerHost)GetService(typeof(IDesignerHost)); IComponentChangeService c = (IComponentChangeService)GetService(typeof(IComponentChangeService)); DesignerTransaction dt = h.CreateTransaction("Add Page"); WelcomeTabPage page = (WelcomeTabPage)h.CreateComponent(typeof(WelcomeTabPage)); c.OnComponentChanging(welcomeTabControl, null); //Add a new page to the collection welcomeTabControl.Pages.Add(page); welcomeTabControl.Controls.Add(page); // welcomeTabControl.ActivatePage(page); c.OnComponentChanged(welcomeTabControl, null, null, null); dt.Commit(); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.wtc = new XEditNetAuthor.Welcome.WelcomeTabControl(); this.welcomeTabPage4 = new XEditNetAuthor.Welcome.WelcomeTabPage(); this.welcomeTabPage1 = new XEditNetAuthor.Welcome.WelcomeTabPage(); this.samplesPanel = new XEditNetAuthor.Welcome.WelcomeTabPage(); this.listView1 = new System.Windows.Forms.ListView(); this.colName = new System.Windows.Forms.ColumnHeader(); this.colDescription = new System.Windows.Forms.ColumnHeader(); this.welcomeTabPage2 = new XEditNetAuthor.Welcome.WelcomeTabPage(); this.newFileCtrl1 = new XEditNet.Profile.NewFileCtrl(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.wtc.SuspendLayout(); this.welcomeTabPage4.SuspendLayout(); this.welcomeTabPage1.SuspendLayout(); this.samplesPanel.SuspendLayout(); this.welcomeTabPage2.SuspendLayout(); this.SuspendLayout(); // // wtc // this.wtc.Anchor = System.Windows.Forms.AnchorStyles.None; this.wtc.Controls.Add(this.welcomeTabPage1); this.wtc.Controls.Add(this.welcomeTabPage4); this.wtc.Controls.Add(this.welcomeTabPage2); this.wtc.Controls.Add(this.samplesPanel); this.wtc.Location = new System.Drawing.Point(16, 16); this.wtc.Name = "wtc"; this.wtc.PageIndex = 2; this.wtc.Pages.AddRange(new XEditNetAuthor.Welcome.WelcomeTabPage[] { this.welcomeTabPage2, this.samplesPanel, this.welcomeTabPage1, this.welcomeTabPage4 }); this.wtc.Size = new System.Drawing.Size(824, 552); this.wtc.TabIndex = 0; // // welcomeTabPage4 // this.welcomeTabPage4.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.welcomeTabPage4.BackColor = System.Drawing.SystemColors.Control; this.welcomeTabPage4.ButtonText = "Tips"; this.welcomeTabPage4.Controls.Add(this.label2); this.welcomeTabPage4.Description = "Learn how to get the best from XEditNet"; this.welcomeTabPage4.ImageIndex = 0; this.welcomeTabPage4.ImageList = null; this.welcomeTabPage4.Location = new System.Drawing.Point(290, 10); this.welcomeTabPage4.Name = "welcomeTabPage4"; this.welcomeTabPage4.Size = new System.Drawing.Size(524, 532); this.welcomeTabPage4.TabIndex = 3; this.welcomeTabPage4.Title = "Hints And Tips"; this.welcomeTabPage4.Visible = false; // // welcomeTabPage1 // this.welcomeTabPage1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.welcomeTabPage1.BackColor = System.Drawing.SystemColors.Control; this.welcomeTabPage1.ButtonText = "Recent"; this.welcomeTabPage1.Controls.Add(this.label1); this.welcomeTabPage1.Description = "Open a file you have recently edited"; this.welcomeTabPage1.ImageIndex = 0; this.welcomeTabPage1.ImageList = null; this.welcomeTabPage1.Location = new System.Drawing.Point(290, 10); this.welcomeTabPage1.Name = "welcomeTabPage1"; this.welcomeTabPage1.Size = new System.Drawing.Size(524, 532); this.welcomeTabPage1.TabIndex = 0; this.welcomeTabPage1.Title = "Recent Files"; this.welcomeTabPage1.Visible = false; // // samplesPanel // this.samplesPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.samplesPanel.AutoScroll = true; this.samplesPanel.BackColor = System.Drawing.SystemColors.Control; this.samplesPanel.ButtonText = "Samples"; this.samplesPanel.Controls.Add(this.listView1); this.samplesPanel.Description = "Browse samples showing the features of XEditNet"; this.samplesPanel.ImageIndex = 0; this.samplesPanel.ImageList = null; this.samplesPanel.Location = new System.Drawing.Point(290, 10); this.samplesPanel.Name = "samplesPanel"; this.samplesPanel.Size = new System.Drawing.Size(524, 532); this.samplesPanel.TabIndex = 2; this.samplesPanel.Title = "Explore Samples"; // // listView1 // this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.colName, this.colDescription }); this.listView1.Dock = System.Windows.Forms.DockStyle.Fill; this.listView1.Font = new System.Drawing.Font("Arial", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.listView1.FullRowSelect = true; this.listView1.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; this.listView1.Location = new System.Drawing.Point(0, 0); this.listView1.MultiSelect = false; this.listView1.Name = "listView1"; this.listView1.Size = new System.Drawing.Size(524, 532); this.listView1.TabIndex = 0; this.listView1.View = System.Windows.Forms.View.Details; this.listView1.DoubleClick += new System.EventHandler(this.OpenSample); // // colName // this.colName.Text = "Name"; this.colName.Width = 121; // // colDescription // this.colDescription.Text = "Description"; this.colDescription.Width = 399; // // welcomeTabPage2 // this.welcomeTabPage2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.welcomeTabPage2.BackColor = System.Drawing.SystemColors.Control; this.welcomeTabPage2.ButtonText = "New"; this.welcomeTabPage2.Controls.Add(this.newFileCtrl1); this.welcomeTabPage2.Description = "Create a new XML file or document from profile"; this.welcomeTabPage2.ImageIndex = 0; this.welcomeTabPage2.ImageList = null; this.welcomeTabPage2.Location = new System.Drawing.Point(290, 10); this.welcomeTabPage2.Name = "welcomeTabPage2"; this.welcomeTabPage2.Size = new System.Drawing.Size(524, 532); this.welcomeTabPage2.TabIndex = 1; this.welcomeTabPage2.Title = "Create New File"; // // newFileCtrl1 // this.newFileCtrl1.BackColor = System.Drawing.SystemColors.Control; this.newFileCtrl1.CloseOnFinish = false; this.newFileCtrl1.Dock = System.Windows.Forms.DockStyle.Fill; this.newFileCtrl1.Location = new System.Drawing.Point(0, 0); this.newFileCtrl1.Name = "newFileCtrl1"; this.newFileCtrl1.Size = new System.Drawing.Size(524, 532); this.newFileCtrl1.TabIndex = 0; this.newFileCtrl1.WizardFinished += new System.EventHandler(this.NewFileWizardFinished); // // label1 // this.label1.Location = new System.Drawing.Point(176, 216); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(192, 23); this.label1.TabIndex = 0; this.label1.Text = "Not currently implemented"; // // label2 // this.label2.Location = new System.Drawing.Point(176, 216); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(192, 23); this.label2.TabIndex = 1; this.label2.Text = "Not currently implemented"; // // WelcomeForm // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.AutoScroll = true; this.BackColor = System.Drawing.SystemColors.ControlDark; this.ClientSize = new System.Drawing.Size(856, 582); this.Controls.Add(this.wtc); this.Name = "WelcomeForm"; this.Text = "Welcome"; this.wtc.ResumeLayout(false); this.welcomeTabPage4.ResumeLayout(false); this.welcomeTabPage1.ResumeLayout(false); this.samplesPanel.ResumeLayout(false); this.welcomeTabPage2.ResumeLayout(false); this.ResumeLayout(false); }
/// <summary> /// Removes the given page from the collection /// </summary> /// <param name="value">Page to remove</param> public void Remove(WelcomeTabPage value) { //Remove the item List.Remove(value); }
/// <summary> /// Adds a new page at a particular position in the Collection /// </summary> /// <param name="index">Position</param> /// <param name="value">Page to be added</param> public void Insert(int index, WelcomeTabPage value) { List.Insert(index, value); }
/// <summary> /// Finds the position of the page in the colleciton /// </summary> /// <param name="value">Page to find position of</param> /// <returns>Index of Page in collection</returns> public int IndexOf(WelcomeTabPage value) { return(List.IndexOf(value)); }
/// <summary> /// Adds a WelcomeTabPage into the Collection /// </summary> /// <param name="value">The page to add</param> /// <returns></returns> public int Add(WelcomeTabPage value) { int result = List.Add(value); return(result); }
/// <summary> /// Detects if a given Page is in the Collection /// </summary> /// <param name="value">Page to find</param> /// <returns></returns> public bool Contains(WelcomeTabPage value) { // If value is not of type Int16, this will return false. return(List.Contains(value)); }
private void InitPage(WelcomeTabPage page) { page.Location=new Point(LeftEdgeChildren-margin, margin); page.Anchor=AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; page.Width=Width-LeftEdgeChildren; page.Height=Height-margin*2; page.BackColor=highlightColor; }
public void ActivatePage(WelcomeTabPage page) { if (activePage != null) { activePage.Visible = false; } //Activate the new page activePage = page; if (activePage != null) { //Ensure that this panel displays inside the WelcomeTabControl activePage.Parent = this; if (this.Contains(activePage) == false) this.Container.Add(activePage); InitPage(activePage); activePage.Visible = true; activePage.BringToFront(); activePage.FocusFirstTabIndex(); } Invalidate(true); }