From c8b8c04b062f820fe9dfba03017a9901c1972162 Mon Sep 17 00:00:00 2001 From: RKrom Date: Wed, 19 Nov 2014 10:45:53 +0100 Subject: [PATCH] FEATURE-777 BUG-1699: Changes for having a border around the Font-Family dropdown, and hopefully increasing the toolstrip width with 1px stops the jumping on Windows Vista. Tried to make the dropdown height less, this doesn't work! [skip ci] --- Greenshot/Forms/ImageEditorForm.Designer.cs | 6 +++-- Greenshot/Forms/ImageEditorForm.cs | 26 ++++++++++++++++++++- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/Greenshot/Forms/ImageEditorForm.Designer.cs b/Greenshot/Forms/ImageEditorForm.Designer.cs index 8dc8f7cf9..94733fb30 100644 --- a/Greenshot/Forms/ImageEditorForm.Designer.cs +++ b/Greenshot/Forms/ImageEditorForm.Designer.cs @@ -1045,13 +1045,14 @@ namespace Greenshot { this.toolStripSeparator10, this.btnConfirm, this.btnCancel}); - this.propertiesToolStrip.MinimumSize = new System.Drawing.Size(0, coreConfiguration.IconSize.Height + 8); + this.propertiesToolStrip.MinimumSize = new System.Drawing.Size(150, coreConfiguration.IconSize.Height + 9); this.propertiesToolStrip.Name = "propertiesToolStrip"; this.propertiesToolStrip.Stretch = true; this.propertiesToolStrip.TabIndex = 2; this.propertiesToolStrip.Renderer = new CustomToolStripProfessionalRenderer(); this.propertiesToolStrip.BackColor = System.Drawing.SystemColors.Control; this.propertiesToolStrip.OverflowButton.DropDown.BackColor = System.Drawing.SystemColors.Control; + this.propertiesToolStrip.Paint += propertiesToolStrip_Paint; // // obfuscateModeButton // @@ -1177,9 +1178,10 @@ namespace Greenshot { // fontFamilyComboBox // this.fontFamilyComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.fontFamilyComboBox.AutoSize = false; this.fontFamilyComboBox.MaxDropDownItems = 20; this.fontFamilyComboBox.Name = "fontFamilyComboBox"; - this.fontFamilyComboBox.Size = new System.Drawing.Size(200, 23); + this.fontFamilyComboBox.Size = new System.Drawing.Size(200, 20); this.fontFamilyComboBox.Text = "Aharoni"; this.fontFamilyComboBox.GotFocus += new System.EventHandler(this.ToolBarFocusableElementGotFocus); this.fontFamilyComboBox.LostFocus += new System.EventHandler(this.ToolBarFocusableElementLostFocus); diff --git a/Greenshot/Forms/ImageEditorForm.cs b/Greenshot/Forms/ImageEditorForm.cs index ff634c497..c54676d9b 100644 --- a/Greenshot/Forms/ImageEditorForm.cs +++ b/Greenshot/Forms/ImageEditorForm.cs @@ -193,7 +193,31 @@ namespace Greenshot { ApplyLanguage(); } - + + /// + /// Workaround for having a border around the dropdown + /// See: http://stackoverflow.com/questions/9560812/change-border-of-toolstripcombobox-with-flat-style + /// + /// + /// + void propertiesToolStrip_Paint(object sender, PaintEventArgs e) { + using (Pen cbBorderPen = new Pen(SystemColors.ActiveBorder)) { + // Loop over all items in the propertiesToolStrip + foreach (ToolStripItem item in propertiesToolStrip.Items) { + ToolStripComboBox cb = item as ToolStripComboBox; + // Only ToolStripComboBox that are visible + if (cb == null || !cb.Visible) { + continue; + } + // Calculate the rectangle + Rectangle r = new Rectangle(cb.ComboBox.Location.X - 1, cb.ComboBox.Location.Y - 1, cb.ComboBox.Size.Width + 1, cb.ComboBox.Size.Height + 1); + + // Draw the rectangle + e.Graphics.DrawRectangle(cbBorderPen, r); + } + } + } + /// /// Get all the destinations and display them in the file menu and the buttons ///