public void Display(Form owner, List <NuGenCodeEditorForm> activeCodeEditors) { ActiveCodeEditors = activeCodeEditors; if (DockPanel != null) { documentsPanel.Controls.Clear(); Labels = new List <NuGenHighlightLabel>(1); using (Graphics graphics = CreateGraphics()) { AddPanels(graphics); AddDocuments(graphics); } Left = (owner.Width - owner.Left - Width) / 2; Top = (owner.Height - owner.Top - Height) / 2; Show(owner); NuGenHighlightLabel labelOfActiveContent = documentsPanel.Tag as NuGenHighlightLabel; if (labelOfActiveContent != null) { labelOfActiveContent.Focus(); } } }
private void DisplayChosenContent() { Hide(); NuGenHighlightLabel label = (NuGenHighlightLabel)documentsPanel.Tag; //PETETODO: What? //DockContent content = (DockContent)label.Tag; //content.Activate(); }
private void AddPanels(Graphics graphics) { int panelIndex = 0; NuGenHighlightLabel label = CreateLabel(graphics, DockPanel); Labels.Add(label); documentsPanel.Controls.Add(label, 0, panelIndex++); if (ActiveCodeEditors.Count == 0) { documentsPanel.Tag = label; } }
private NuGenHighlightLabel CreateLabel(Graphics graphics, Panel content) { NuGenHighlightLabel result = new NuGenHighlightLabel(); result.Dock = DockStyle.Fill; result.Tag = content; result.Text = content.Text; result.TextAlign = ContentAlignment.MiddleLeft; SizeF measuredSize = graphics.MeasureString(result.Text, result.Font); result.Height = 17; result.Width = Convert.ToInt32(measuredSize.Width) + 5; result.Click += new EventHandler(contentLabel_Click); return(result); }
private void AddDocuments(Graphics graphics) { int documentIndex = 0; bool isActiveContentCodeEditor = DockPanel is NuGenCodeEditorForm; for (int index = 0; index < ActiveCodeEditors.Count; index++) { NuGenCodeEditorForm codeEditor = ActiveCodeEditors[index]; if (codeEditor.Visible) { NuGenHighlightLabel label = CreateLabel(graphics, codeEditor); Labels.Add(label); documentsPanel.Controls.Add(label, 1, documentIndex++); if ((isActiveContentCodeEditor && index == 1) || index == 0) { documentsPanel.Tag = label; } } } }