public ProjectExplorerForm() { // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); var sc = ScreenScale.Calc(); if (sc >= 1.99) { this.tvProjectExplorer.ImageList = this.imageList2; } this.tvProjectExplorer.LabelEdit = true; this.tvProjectExplorer.BeforeLabelEdit += tvProjectExplorer_BeforeLabelEdit; this.Icon = new System.Drawing.Icon(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("VisualPascalABC.Resources.PadIcons.ProjectBrowser.ico")); pRJBUILDToolStripMenuItem.Image = VisualPABCSingleton.MainForm.BuildImage; pRJBUILDALLToolStripMenuItem.Image = VisualPABCSingleton.MainForm.RebuildImage; pRJRUNToolStripMenuItem.Image = VisualPABCSingleton.MainForm.RunImage; pRJNEWFILEToolStripMenuItem.Image = VisualPABCSingleton.MainForm.NewFileImage; pRJOPENToolStripMenuItem.Image = VisualPABCSingleton.MainForm.OpenFileImage; pRJFORMToolStripMenuItem.Image = VisualPABCSingleton.MainForm.NewFormImage; Form1StringResources.SetTextForAllControls(this.AddReferenceMenuStrip); Form1StringResources.SetTextForAllControls(this.ProjectMenuStrip); Form1StringResources.SetTextForAllControls(this.ReferenceMenuStrip); Form1StringResources.SetTextForAllControls(this.SouceFileMenuStrip); this.tvProjectExplorer.AfterLabelEdit += new NodeLabelEditEventHandler(LabelEditFinished); }
public CodeTemplatesForm() { InitializeComponent(); var scale = ScreenScale.Calc(); listBox1.TileSize = new Size(listBox1.TileSize.Width, System.Convert.ToInt32(16 * scale)); LoadTemplates(); }
void ComboBoxDrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e) { ComboBox comboBox = (ComboBox)sender; lock (comboBox) { e.DrawBackground(); if (e.Index >= 0) { ComboBoxItem item = (ComboBoxItem)comboBox.Items[e.Index]; var dx = Convert.ToInt32(Math.Round(2 * ScreenScale.Calc())); e.Graphics.DrawImage(CodeCompletionProvider.ImagesProvider.ImageList.Images[item.IconIndex], e.Bounds.X + dx, e.Bounds.Y, // + (e.Bounds.Height - CodeCompletionProvider.ImagesProvider.ImageList.ImageSize.Height) / 2 e.Bounds.Height, e.Bounds.Height ); Rectangle drawingRect = new Rectangle(e.Bounds.X + dx + e.Bounds.Height /*CodeCompletionProvider.ImagesProvider.ImageList.ImageSize.Width*/, e.Bounds.Y, e.Bounds.Width - dx - e.Bounds.Height /*CodeCompletionProvider.ImagesProvider.ImageList.ImageSize.Width*/, e.Bounds.Height); Brush drawItemBrush = SystemBrushes.WindowText; if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) { drawItemBrush = SystemBrushes.HighlightText; } if (!item.IsInCurrentPart) { drawItemBrush = SystemBrushes.ControlDark; } else if (e.State == DrawItemState.ComboBoxEdit && !item.IsInside(textAreaControl.ActiveTextAreaControl.Caret.Line, textAreaControl.ActiveTextAreaControl.Caret.Column)) { drawItemBrush = SystemBrushes.ControlDark; } e.Graphics.DrawString(item.ToString(), font, drawItemBrush, drawingRect, drawStringFormat); } //e.DrawFocusRectangle(); } }
public ErrorsListWindowForm(Form1 MainForm) : base(MainForm) { InitializeComponent(); Form1StringResources.SetTextForAllControls(this.contextMenuStrip1); var sc = ScreenScale.Calc(); if (sc != 1.0) { columnHeader6.Width = Convert.ToInt32(columnHeader6.Width * sc); columnHeader7.Width = Convert.ToInt32(columnHeader7.Width * sc); columnHeader8.Width = Convert.ToInt32(columnHeader8.Width * sc); columnHeader9.Width = Convert.ToInt32(columnHeader9.Width * sc); columnHeader10.Width = Convert.ToInt32(columnHeader10.Width * 0.9 * sc); columnHeader11.Width = Convert.ToInt32(columnHeader11.Width * sc); } if (sc >= 1.99) { this.lvErrorsList.SmallImageList = this.ilvlErrorList32; } }
protected override void OnMeasureItem(System.Windows.Forms.MeasureItemEventArgs e) { if (e.Index > -1) { int w = 0; string fontstring = Items[e.Index].ToString(); Graphics g = CreateGraphics(); e.ItemHeight = (int)g.MeasureString(fontstring, new Font(fontstring, 10)).Height; w = (int)g.MeasureString(fontstring, new Font(fontstring, 10)).Width; if (both) { int h1 = (int)g.MeasureString(samplestr, new Font(fontstring, 10)).Height; int h2 = (int)g.MeasureString(Items[e.Index].ToString(), new Font("Arial", 10)).Height; int w1 = (int)g.MeasureString(samplestr, new Font(fontstring, 10)).Width; int w2 = (int)g.MeasureString(Items[e.Index].ToString(), new Font("Arial", 10)).Width; if (h1 > h2) { h2 = h1; } e.ItemHeight = h2; w = w1 + w2; } //w += ttimg.Width*2; if (w > maxwid) { maxwid = w; } var ss = ScreenScale.Calc(); if (e.ItemHeight > Convert.ToInt32(20 * ss)) { e.ItemHeight = Convert.ToInt32(20 * ss); } } base.OnMeasureItem(e); }
public QuickClassBrowserPanel(CodeFileDocumentTextEditorControl textAreaControl) { InitializeComponent(); this.membersComboBox.DropDownHeight = Convert.ToInt32(this.membersComboBox.DropDownHeight * ScreenScale.Calc()); this.classComboBox.DropDownHeight = Convert.ToInt32(this.classComboBox.DropDownHeight * ScreenScale.Calc()); this.membersComboBox.MaxDropDownItems = 20; base.Dock = DockStyle.Top; this.textAreaControl = textAreaControl; this.textAreaControl.ActiveTextAreaControl.Caret.PositionChanged += new EventHandler(CaretPositionChanged); if (VisualPABCSingleton.MainForm != null && !VisualPABCSingleton.MainForm.UserOptions.ShowQuickClassBrowserPanel) { this.Visible = false; } if (VisualPABCSingleton.MainForm != null) { th = new Thread(new ThreadStart(ChangeInternal)); th.Priority = ThreadPriority.Lowest; th.IsBackground = true; th.Start(); } }