mirror of
https://github.com/greenshot/greenshot
synced 2025-08-24 23:26:24 -07:00
Small fix for the color dialog, this is still WIP
This commit is contained in:
parent
505ca91b9c
commit
c3cd00b482
2 changed files with 14 additions and 18 deletions
|
@ -19,6 +19,8 @@
|
||||||
* 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 Dapplo.Windows.Dpi;
|
||||||
|
|
||||||
namespace Greenshot.Addons.Controls {
|
namespace Greenshot.Addons.Controls {
|
||||||
public partial class ColorDialog {
|
public partial class ColorDialog {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -37,7 +39,6 @@ namespace Greenshot.Addons.Controls {
|
||||||
components.Dispose();
|
components.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_dpiSubscription.Dispose();
|
|
||||||
base.Dispose(disposing);
|
base.Dispose(disposing);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,6 +49,8 @@ namespace Greenshot.Addons.Controls {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
|
float fontSize = (float) DpiHandler.ScaleWithDpi(11d, DpiHandler.DefaultScreenDpi);
|
||||||
|
|
||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ColorDialog));
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ColorDialog));
|
||||||
this.btnTransparent = new GreenshotButton();
|
this.btnTransparent = new GreenshotButton();
|
||||||
this.colorPanel = new System.Windows.Forms.Panel();
|
this.colorPanel = new System.Windows.Forms.Panel();
|
||||||
|
@ -89,7 +92,7 @@ namespace Greenshot.Addons.Controls {
|
||||||
//
|
//
|
||||||
// labelHtmlColor
|
// labelHtmlColor
|
||||||
//
|
//
|
||||||
this.labelHtmlColor.Font = new System.Drawing.Font("Tahoma", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World);
|
this.labelHtmlColor.Font = new System.Drawing.Font("Tahoma", fontSize, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World);
|
||||||
this.labelHtmlColor.LanguageKey = "colorpicker_htmlcolor";
|
this.labelHtmlColor.LanguageKey = "colorpicker_htmlcolor";
|
||||||
this.labelHtmlColor.Location = new System.Drawing.Point(210, 57);
|
this.labelHtmlColor.Location = new System.Drawing.Point(210, 57);
|
||||||
this.labelHtmlColor.Name = "labelHtmlColor";
|
this.labelHtmlColor.Name = "labelHtmlColor";
|
||||||
|
@ -110,7 +113,7 @@ namespace Greenshot.Addons.Controls {
|
||||||
//
|
//
|
||||||
// labelRed
|
// labelRed
|
||||||
//
|
//
|
||||||
this.labelRed.Font = new System.Drawing.Font("Tahoma", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World);
|
this.labelRed.Font = new System.Drawing.Font("Tahoma", fontSize, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World);
|
||||||
this.labelRed.LanguageKey = "colorpicker_red";
|
this.labelRed.LanguageKey = "colorpicker_red";
|
||||||
this.labelRed.Location = new System.Drawing.Point(210, 98);
|
this.labelRed.Location = new System.Drawing.Point(210, 98);
|
||||||
this.labelRed.Name = "labelRed";
|
this.labelRed.Name = "labelRed";
|
||||||
|
@ -120,7 +123,7 @@ namespace Greenshot.Addons.Controls {
|
||||||
//
|
//
|
||||||
// labelGreen
|
// labelGreen
|
||||||
//
|
//
|
||||||
this.labelGreen.Font = new System.Drawing.Font("Tahoma", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World);
|
this.labelGreen.Font = new System.Drawing.Font("Tahoma", fontSize, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World);
|
||||||
this.labelGreen.LanguageKey = "colorpicker_green";
|
this.labelGreen.LanguageKey = "colorpicker_green";
|
||||||
this.labelGreen.Location = new System.Drawing.Point(210, 122);
|
this.labelGreen.Location = new System.Drawing.Point(210, 122);
|
||||||
this.labelGreen.Name = "labelGreen";
|
this.labelGreen.Name = "labelGreen";
|
||||||
|
@ -130,7 +133,7 @@ namespace Greenshot.Addons.Controls {
|
||||||
//
|
//
|
||||||
// labelBlue
|
// labelBlue
|
||||||
//
|
//
|
||||||
this.labelBlue.Font = new System.Drawing.Font("Tahoma", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World);
|
this.labelBlue.Font = new System.Drawing.Font("Tahoma", fontSize, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World);
|
||||||
this.labelBlue.LanguageKey = "colorpicker_blue";
|
this.labelBlue.LanguageKey = "colorpicker_blue";
|
||||||
this.labelBlue.Location = new System.Drawing.Point(210, 146);
|
this.labelBlue.Location = new System.Drawing.Point(210, 146);
|
||||||
this.labelBlue.Name = "labelBlue";
|
this.labelBlue.Name = "labelBlue";
|
||||||
|
@ -197,7 +200,7 @@ namespace Greenshot.Addons.Controls {
|
||||||
//
|
//
|
||||||
// labelAlpha
|
// labelAlpha
|
||||||
//
|
//
|
||||||
this.labelAlpha.Font = new System.Drawing.Font("Tahoma", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World);
|
this.labelAlpha.Font = new System.Drawing.Font("Tahoma", fontSize, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World);
|
||||||
this.labelAlpha.LanguageKey = "colorpicker_alpha";
|
this.labelAlpha.LanguageKey = "colorpicker_alpha";
|
||||||
this.labelAlpha.Location = new System.Drawing.Point(210, 170);
|
this.labelAlpha.Location = new System.Drawing.Point(210, 170);
|
||||||
this.labelAlpha.Name = "labelAlpha";
|
this.labelAlpha.Name = "labelAlpha";
|
||||||
|
|
|
@ -43,23 +43,17 @@ namespace Greenshot.Addons.Controls
|
||||||
{
|
{
|
||||||
private readonly ToolTip _toolTip = new ToolTip();
|
private readonly ToolTip _toolTip = new ToolTip();
|
||||||
private bool _updateInProgress;
|
private bool _updateInProgress;
|
||||||
private readonly IDisposable _dpiSubscription;
|
|
||||||
|
|
||||||
public ColorDialog(IGreenshotLanguage greenshotLanguage) : base(greenshotLanguage)
|
public ColorDialog(IGreenshotLanguage greenshotLanguage) : base(greenshotLanguage)
|
||||||
{
|
{
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
ResumeLayout();
|
ResumeLayout();
|
||||||
|
|
||||||
_dpiSubscription = FormDpiHandler.OnDpiChangeInfo.Subscribe(info =>
|
|
||||||
{
|
|
||||||
Redraw();
|
|
||||||
});
|
|
||||||
Redraw();
|
|
||||||
//UpdateRecentColorsButtonRow();
|
//UpdateRecentColorsButtonRow();
|
||||||
|
Load += (sender, args) => DrawButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Redraw()
|
private void DrawButtons()
|
||||||
{
|
{
|
||||||
int pos = FormDpiHandler.ScaleWithCurrentDpi(5);
|
int pos = FormDpiHandler.ScaleWithCurrentDpi(5);
|
||||||
int size = FormDpiHandler.ScaleWithCurrentDpi(15);
|
int size = FormDpiHandler.ScaleWithCurrentDpi(15);
|
||||||
|
@ -67,7 +61,6 @@ namespace Greenshot.Addons.Controls
|
||||||
var buttons = CreateColorPalette(pos, pos, size, size);
|
var buttons = CreateColorPalette(pos, pos, size, size);
|
||||||
var lastUsedButtons = CreateLastUsedColorButtonRow(pos, lastColorY, size, size);
|
var lastUsedButtons = CreateLastUsedColorButtonRow(pos, lastColorY, size, size);
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
Controls.Clear();
|
|
||||||
Controls.AddRange(buttons.ToArray());
|
Controls.AddRange(buttons.ToArray());
|
||||||
Controls.AddRange(lastUsedButtons.ToArray());
|
Controls.AddRange(lastUsedButtons.ToArray());
|
||||||
ResumeLayout();
|
ResumeLayout();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue