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]

This commit is contained in:
RKrom 2014-11-19 10:45:53 +01:00
parent 99d78e86db
commit c8b8c04b06
2 changed files with 29 additions and 3 deletions

View file

@ -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);

View file

@ -194,6 +194,30 @@ namespace Greenshot {
ApplyLanguage();
}
/// <summary>
/// Workaround for having a border around the dropdown
/// See: http://stackoverflow.com/questions/9560812/change-border-of-toolstripcombobox-with-flat-style
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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);
}
}
}
/// <summary>
/// Get all the destinations and display them in the file menu and the buttons
/// </summary>