mirror of
https://github.com/ShareX/ShareX.git
synced 2024-07-04 22:21:23 +12:00
Added BorderColor option to ColorButton
This commit is contained in:
parent
f342308c34
commit
d146ab68d5
|
@ -88,8 +88,9 @@ private void PrepareRecentColors()
|
||||||
{
|
{
|
||||||
Color = new HSB(i / 32d, 1d, 1d),
|
Color = new HSB(i / 32d, 1d, 1d),
|
||||||
Size = new Size(16, 16),
|
Size = new Size(16, 16),
|
||||||
Offset = 2,
|
Offset = 0,
|
||||||
Margin = new Padding(0),
|
BorderColor = Color.FromArgb(100, 100, 100),
|
||||||
|
Margin = new Padding(1),
|
||||||
ManualButtonClick = true
|
ManualButtonClick = true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,9 @@ public Color Color
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[DefaultValue(typeof(Color), "DarkGray")]
|
||||||
|
public Color BorderColor { get; set; } = Color.DarkGray;
|
||||||
|
|
||||||
[DefaultValue(3)]
|
[DefaultValue(3)]
|
||||||
public int Offset { get; set; } = 3;
|
public int Offset { get; set; } = 3;
|
||||||
|
|
||||||
|
@ -85,7 +88,10 @@ public void ShowColorDialog()
|
||||||
|
|
||||||
protected override void OnPaint(PaintEventArgs pevent)
|
protected override void OnPaint(PaintEventArgs pevent)
|
||||||
{
|
{
|
||||||
base.OnPaint(pevent);
|
if (Offset > 0)
|
||||||
|
{
|
||||||
|
base.OnPaint(pevent);
|
||||||
|
}
|
||||||
|
|
||||||
int boxSize = ClientRectangle.Height - Offset * 2;
|
int boxSize = ClientRectangle.Height - Offset * 2;
|
||||||
Rectangle boxRectangle = new Rectangle(ClientRectangle.Width - Offset - boxSize, Offset, boxSize, boxSize);
|
Rectangle boxRectangle = new Rectangle(ClientRectangle.Width - Offset - boxSize, Offset, boxSize, boxSize);
|
||||||
|
@ -108,7 +114,10 @@ protected override void OnPaint(PaintEventArgs pevent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g.DrawRectangleProper(Pens.DarkGray, boxRectangle);
|
using (Pen borderPen = new Pen(BorderColor))
|
||||||
|
{
|
||||||
|
g.DrawRectangleProper(borderPen, boxRectangle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue