mirror of
https://github.com/greenshot/greenshot
synced 2025-08-19 13:10:00 -07:00
FEATURE-1196 (#339)
* FEATURE-1196: Double clicking on the colour square chooses the color and closes the color window * BUG-2565: Tooltip on recent colors is not representing the color.
This commit is contained in:
parent
7839fe5e2f
commit
e06c3e8510
2 changed files with 33 additions and 6 deletions
12
src/Greenshot.Base/Controls/GreenshotDoubleClickButton.cs
Normal file
12
src/Greenshot.Base/Controls/GreenshotDoubleClickButton.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
using System.Windows.Forms;
|
||||
|
||||
namespace Greenshot.Base.Controls
|
||||
{
|
||||
public class GreenshotDoubleClickButton : Button
|
||||
{
|
||||
public GreenshotDoubleClickButton()
|
||||
{
|
||||
SetStyle(ControlStyles.StandardClick | ControlStyles.StandardDoubleClick, true);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -21,10 +21,12 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using Greenshot.Base.Controls;
|
||||
using Greenshot.Base.IniFile;
|
||||
using Greenshot.Editor.Configuration;
|
||||
using Greenshot.Editor.Controls;
|
||||
|
@ -114,7 +116,7 @@ namespace Greenshot.Editor.Forms
|
|||
|
||||
private Button CreateColorButton(Color color, int x, int y, int w, int h)
|
||||
{
|
||||
Button b = new Button
|
||||
Button b = new GreenshotDoubleClickButton
|
||||
{
|
||||
BackColor = color,
|
||||
FlatStyle = FlatStyle.Flat,
|
||||
|
@ -124,10 +126,17 @@ namespace Greenshot.Editor.Forms
|
|||
};
|
||||
b.FlatAppearance.BorderSize = 0;
|
||||
b.Click += ColorButtonClick;
|
||||
_toolTip.SetToolTip(b, ColorTranslator.ToHtml(color) + " | R:" + color.R + ", G:" + color.G + ", B:" + color.B);
|
||||
b.DoubleClick += ColorButtonDoubleClick;
|
||||
SetButtonTooltip(b, color);
|
||||
return b;
|
||||
}
|
||||
|
||||
private void ColorButtonDoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
ColorButtonClick(sender, e);
|
||||
BtnApplyClick(sender, e);
|
||||
}
|
||||
|
||||
private void CreateLastUsedColorButtonRow(int x, int y, int w, int h)
|
||||
{
|
||||
for (int i = 0; i < 12; i++)
|
||||
|
@ -147,6 +156,7 @@ namespace Greenshot.Editor.Forms
|
|||
{
|
||||
_recentColorButtons[i].BackColor = EditorConfig.RecentColors[i];
|
||||
_recentColorButtons[i].Enabled = true;
|
||||
SetButtonTooltip(_recentColorButtons[i], EditorConfig.RecentColors[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -245,6 +255,11 @@ namespace Greenshot.Editor.Forms
|
|||
PreviewColor(b.BackColor, b);
|
||||
}
|
||||
|
||||
private void SetButtonTooltip(Button colorButton, Color color)
|
||||
{
|
||||
_toolTip.SetToolTip(colorButton, ColorTranslator.ToHtml(color) + " | R:" + color.R + ", G:" + color.G + ", B:" + color.B);
|
||||
}
|
||||
|
||||
private void BtnTransparentClick(object sender, EventArgs e)
|
||||
{
|
||||
ColorButtonClick(sender, e);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue