Another fix for the visual artifact in the editor, removed the rounded corner of the toolstrips and made the overflow button even more "invisible". [skip ci]

This commit is contained in:
RKrom 2014-11-04 21:24:28 +01:00
parent d3dce880dd
commit 768efcf7fe

View file

@ -17,46 +17,51 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
namespace Greenshot.Controls { namespace Greenshot.Controls {
/// <summary> /// <summary>
/// Prevent having a gradient background in the toolstrip, and the overflow button /// Prevent having a gradient background in the toolstrip, and the overflow button
/// See: http://stackoverflow.com/a/16926979 /// See: http://stackoverflow.com/a/16926979
/// </summary> /// </summary>
internal class CustomProfessionalColorTable : ProfessionalColorTable { internal class CustomProfessionalColorTable : ProfessionalColorTable {
public override Color ToolStripGradientBegin { public override Color ToolStripGradientBegin {
get { return SystemColors.Control; } get { return SystemColors.Control; }
} }
public override Color ToolStripGradientMiddle { public override Color ToolStripGradientMiddle {
get { return SystemColors.Control; } get { return SystemColors.Control; }
} }
public override Color ToolStripGradientEnd { public override Color ToolStripGradientEnd {
get { return SystemColors.Control; } get { return SystemColors.Control; }
} }
public override Color OverflowButtonGradientBegin { public override Color OverflowButtonGradientBegin {
get { return SystemColors.ControlDark; } get { return SystemColors.Control; }
} }
public override Color OverflowButtonGradientMiddle { public override Color OverflowButtonGradientMiddle {
get { return SystemColors.ControlDark; } get { return SystemColors.Control; }
} }
public override Color OverflowButtonGradientEnd { public override Color OverflowButtonGradientEnd {
get { return SystemColors.ControlDark; } get { return SystemColors.Control; }
} }
} }
/// <summary> /// <summary>
/// ToolStripProfessionalRenderer without having a visual artifact /// ToolStripProfessionalRenderer without having a visual artifact
/// See: http://stackoverflow.com/a/16926979 /// See: http://stackoverflow.com/a/16926979 and http://stackoverflow.com/a/13418840
/// </summary> /// </summary>
public class CustomToolStripProfessionalRenderer : ToolStripProfessionalRenderer { public class CustomToolStripProfessionalRenderer : ToolStripProfessionalRenderer {
public CustomToolStripProfessionalRenderer() : base(new CustomProfessionalColorTable()) { public CustomToolStripProfessionalRenderer() : base(new CustomProfessionalColorTable()) {
} RoundedEdges = false;
protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e) { }
// Don't draw a border /// <summary>
} /// By overriding the OnRenderToolStripBorder we can make the ToolStrip without border
} /// </summary>
} /// <param name="e"></param>
protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e) {
// Don't draw a border
}
}
}