mirror of
https://github.com/greenshot/greenshot
synced 2025-07-14 00:53:51 -07:00
Fixes for the toolstrip rendering: this makes the background "flat" and fixes an visual artifact on the right side of the window.
This commit is contained in:
parent
9a6a3e6a90
commit
99b93a7e21
3 changed files with 93 additions and 37 deletions
62
Greenshot/Controls/CustomToolStripProfessionalRenderer.cs
Normal file
62
Greenshot/Controls/CustomToolStripProfessionalRenderer.cs
Normal file
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* Greenshot - a free and open source screenshot tool
|
||||
* Copyright (C) 2007-2014 Thomas Braun, Jens Klingen, Robin Krom
|
||||
*
|
||||
* For more information see: http://getgreenshot.org/
|
||||
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Greenshot.Controls {
|
||||
/// <summary>
|
||||
/// Prevent having a gradient background in the toolstrip, and the overflow button
|
||||
/// See: http://stackoverflow.com/a/16926979
|
||||
/// </summary>
|
||||
internal class CustomProfessionalColorTable : ProfessionalColorTable {
|
||||
public override Color ToolStripGradientBegin {
|
||||
get { return SystemColors.Control; }
|
||||
}
|
||||
public override Color ToolStripGradientMiddle {
|
||||
get { return SystemColors.Control; }
|
||||
}
|
||||
public override Color ToolStripGradientEnd {
|
||||
get { return SystemColors.Control; }
|
||||
}
|
||||
public override Color OverflowButtonGradientBegin {
|
||||
get { return SystemColors.ControlDark; }
|
||||
}
|
||||
public override Color OverflowButtonGradientMiddle {
|
||||
get { return SystemColors.ControlDark; }
|
||||
}
|
||||
public override Color OverflowButtonGradientEnd {
|
||||
get { return SystemColors.ControlDark; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ToolStripProfessionalRenderer without having a visual artifact
|
||||
/// See: http://stackoverflow.com/a/16926979
|
||||
/// </summary>
|
||||
public class CustomToolStripProfessionalRenderer : ToolStripProfessionalRenderer {
|
||||
public CustomToolStripProfessionalRenderer() : base(new CustomProfessionalColorTable()) {
|
||||
}
|
||||
protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e) {
|
||||
// Don't draw a border
|
||||
}
|
||||
}
|
||||
}
|
67
Greenshot/Forms/ImageEditorForm.Designer.cs
generated
67
Greenshot/Forms/ImageEditorForm.Designer.cs
generated
|
@ -18,6 +18,9 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Greenshot.Controls;
|
||||
|
||||
namespace Greenshot {
|
||||
partial class ImageEditorForm {
|
||||
/// <summary>
|
||||
|
@ -215,15 +218,15 @@ namespace Greenshot {
|
|||
this.topToolStripContainer.ContentPanel.Controls.Add(this.tableLayoutPanel1);
|
||||
this.topToolStripContainer.ContentPanel.Size = new System.Drawing.Size(761, 385);
|
||||
this.topToolStripContainer.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.topToolStripContainer.LeftToolStripPanel.Controls.Add(this.toolsToolStrip);
|
||||
this.topToolStripContainer.LeftToolStripPanel.Join(this.toolsToolStrip,0);
|
||||
this.topToolStripContainer.Location = new System.Drawing.Point(0, 0);
|
||||
this.topToolStripContainer.Name = "toolStripContainer1";
|
||||
this.topToolStripContainer.Size = new System.Drawing.Size(785, 485);
|
||||
this.topToolStripContainer.TabIndex = 2;
|
||||
this.topToolStripContainer.Text = "toolStripContainer1";
|
||||
this.topToolStripContainer.TopToolStripPanel.Join(this.menuStrip1, 1);
|
||||
this.topToolStripContainer.TopToolStripPanel.Join(this.destinationsToolStrip, 2);
|
||||
this.topToolStripContainer.TopToolStripPanel.Join(this.propertiesToolStrip, 3);
|
||||
this.topToolStripContainer.TopToolStripPanel.Join(this.menuStrip1,0);
|
||||
this.topToolStripContainer.TopToolStripPanel.Join(this.destinationsToolStrip, 1);
|
||||
this.topToolStripContainer.TopToolStripPanel.Join(this.propertiesToolStrip, 2);
|
||||
//
|
||||
// statusStrip1
|
||||
//
|
||||
|
@ -289,6 +292,7 @@ namespace Greenshot {
|
|||
this.toolsToolStrip.ImageScalingSize = editorConfiguration.ButtonIconSize;
|
||||
this.toolsToolStrip.Dock = System.Windows.Forms.DockStyle.None;
|
||||
this.toolsToolStrip.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
|
||||
this.toolsToolStrip.Renderer = new CustomToolStripProfessionalRenderer();
|
||||
this.toolsToolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.btnCursor,
|
||||
this.toolStripSeparator1,
|
||||
|
@ -309,12 +313,11 @@ namespace Greenshot {
|
|||
this.rotateCwToolstripButton,
|
||||
this.rotateCcwToolstripButton,
|
||||
this.btnResize});
|
||||
this.toolsToolStrip.Location = new System.Drawing.Point(0, 0);
|
||||
this.toolsToolStrip.Name = "toolStrip2";
|
||||
this.toolsToolStrip.Size = new System.Drawing.Size(24, 385);
|
||||
this.toolsToolStrip.Name = "toolsToolStrip";
|
||||
this.toolsToolStrip.Stretch = true;
|
||||
this.toolsToolStrip.TabIndex = 0;
|
||||
this.toolsToolStrip.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.toolsToolStrip.OverflowButton.DropDown.BackColor = System.Drawing.SystemColors.Control;
|
||||
//
|
||||
// btnCursor
|
||||
//
|
||||
|
@ -523,16 +526,15 @@ namespace Greenshot {
|
|||
//
|
||||
this.menuStrip1.ClickThrough = true;
|
||||
this.menuStrip1.ImageScalingSize = editorConfiguration.ButtonIconSize;
|
||||
this.menuStrip1.Dock = System.Windows.Forms.DockStyle.None;
|
||||
this.menuStrip1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.menuStrip1.Stretch = true;
|
||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.fileStripMenuItem,
|
||||
this.editToolStripMenuItem,
|
||||
this.objectToolStripMenuItem,
|
||||
this.pluginToolStripMenuItem,
|
||||
this.helpToolStripMenuItem});
|
||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
this.menuStrip1.Size = new System.Drawing.Size(785, 24);
|
||||
this.menuStrip1.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.menuStrip1.TabIndex = 1;
|
||||
//
|
||||
|
@ -837,7 +839,7 @@ namespace Greenshot {
|
|||
//
|
||||
this.destinationsToolStrip.ClickThrough = true;
|
||||
this.destinationsToolStrip.ImageScalingSize = editorConfiguration.ButtonIconSize;
|
||||
this.destinationsToolStrip.Dock = System.Windows.Forms.DockStyle.None;
|
||||
this.destinationsToolStrip.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.destinationsToolStrip.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
|
||||
this.destinationsToolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.btnSave,
|
||||
|
@ -856,12 +858,12 @@ namespace Greenshot {
|
|||
this.toolStripSeparator11,
|
||||
this.toolStripSeparator16,
|
||||
this.btnHelp});
|
||||
this.destinationsToolStrip.Location = new System.Drawing.Point(0, 24);
|
||||
this.destinationsToolStrip.Name = "toolStrip1";
|
||||
this.destinationsToolStrip.Size = new System.Drawing.Size(785, 25);
|
||||
this.destinationsToolStrip.Stretch = true;
|
||||
this.destinationsToolStrip.TabIndex = 0;
|
||||
this.destinationsToolStrip.Renderer = new CustomToolStripProfessionalRenderer();
|
||||
this.destinationsToolStrip.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.destinationsToolStrip.OverflowButton.DropDown.BackColor = System.Drawing.SystemColors.Control;
|
||||
//
|
||||
// btnSave
|
||||
//
|
||||
|
@ -992,7 +994,7 @@ namespace Greenshot {
|
|||
//
|
||||
this.propertiesToolStrip.ClickThrough = true;
|
||||
this.propertiesToolStrip.ImageScalingSize = editorConfiguration.ButtonIconSize;
|
||||
this.propertiesToolStrip.Dock = System.Windows.Forms.DockStyle.None;
|
||||
this.propertiesToolStrip.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.propertiesToolStrip.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
|
||||
this.propertiesToolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.obfuscateModeButton,
|
||||
|
@ -1025,13 +1027,13 @@ namespace Greenshot {
|
|||
this.toolStripSeparator10,
|
||||
this.btnConfirm,
|
||||
this.btnCancel});
|
||||
this.propertiesToolStrip.Location = new System.Drawing.Point(0, 49);
|
||||
this.propertiesToolStrip.MinimumSize = new System.Drawing.Size(0, editorConfiguration.ButtonIconSize.Height + 8);
|
||||
this.propertiesToolStrip.Name = "propertiesToolStrip";
|
||||
//this.propertiesToolStrip.Size = new System.Drawing.Size(785, 33);
|
||||
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;
|
||||
//
|
||||
// obfuscateModeButton
|
||||
//
|
||||
|
@ -1591,27 +1593,18 @@ namespace Greenshot {
|
|||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ImageEditorFormFormClosing);
|
||||
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ImageEditorFormKeyDown);
|
||||
this.Resize += new System.EventHandler(this.ImageEditorFormResize);
|
||||
this.topToolStripContainer.BottomToolStripPanel.ResumeLayout(false);
|
||||
this.topToolStripContainer.BottomToolStripPanel.PerformLayout();
|
||||
this.topToolStripContainer.ContentPanel.ResumeLayout(false);
|
||||
this.topToolStripContainer.LeftToolStripPanel.ResumeLayout(false);
|
||||
this.topToolStripContainer.LeftToolStripPanel.PerformLayout();
|
||||
this.topToolStripContainer.TopToolStripPanel.ResumeLayout(false);
|
||||
this.topToolStripContainer.TopToolStripPanel.PerformLayout();
|
||||
this.topToolStripContainer.ResumeLayout(false);
|
||||
this.topToolStripContainer.PerformLayout();
|
||||
this.statusStrip1.ResumeLayout(false);
|
||||
this.statusStrip1.PerformLayout();
|
||||
this.tableLayoutPanel1.ResumeLayout(false);
|
||||
this.toolsToolStrip.ResumeLayout(false);
|
||||
this.toolsToolStrip.PerformLayout();
|
||||
this.menuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.PerformLayout();
|
||||
this.destinationsToolStrip.ResumeLayout(false);
|
||||
this.destinationsToolStrip.PerformLayout();
|
||||
this.propertiesToolStrip.ResumeLayout(false);
|
||||
this.propertiesToolStrip.PerformLayout();
|
||||
this.fileSavedStatusContextMenu.ResumeLayout(false);
|
||||
this.topToolStripContainer.BottomToolStripPanel.ResumeLayout(true);
|
||||
this.topToolStripContainer.ContentPanel.ResumeLayout(true);
|
||||
this.topToolStripContainer.LeftToolStripPanel.ResumeLayout(true);
|
||||
this.topToolStripContainer.TopToolStripPanel.ResumeLayout(true);
|
||||
this.topToolStripContainer.ResumeLayout(true);
|
||||
this.statusStrip1.ResumeLayout(true);
|
||||
this.tableLayoutPanel1.ResumeLayout(true);
|
||||
this.toolsToolStrip.ResumeLayout(true);
|
||||
this.menuStrip1.ResumeLayout(true);
|
||||
this.destinationsToolStrip.ResumeLayout(true);
|
||||
this.propertiesToolStrip.ResumeLayout(true);
|
||||
this.fileSavedStatusContextMenu.ResumeLayout(true);
|
||||
this.ResumeLayout(false);
|
||||
}
|
||||
private GreenshotPlugin.Controls.GreenshotToolStripMenuItem alignRightToolStripMenuItem;
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
<Compile Include="Controls\ColorButton.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Controls\CustomToolStripProfessionalRenderer.cs" />
|
||||
<Compile Include="Controls\NonJumpingPanel.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue