mirror of
https://github.com/greenshot/greenshot
synced 2025-07-16 10:03:44 -07:00
Modified the enumeration to resize the font, depending on the size. Also made sure the suspend/resume layout is called when transforming containers.
This commit is contained in:
parent
85d73cd8e0
commit
e75925018b
4 changed files with 40 additions and 31 deletions
|
@ -48,17 +48,21 @@ namespace Greenshot.Drawing {
|
|||
InitContent();
|
||||
}
|
||||
|
||||
public override Size DefaultSize {
|
||||
get {
|
||||
return new Size(30, 30);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool InitContent() {
|
||||
_defaultEditMode = EditStatus.IDLE;
|
||||
_stringFormat.Alignment = StringAlignment.Center;
|
||||
_stringFormat.LineAlignment = StringAlignment.Center;
|
||||
|
||||
// Set defaults
|
||||
Width = 30;
|
||||
Height = 30;
|
||||
using (FontFamily fam = new FontFamily(FontFamily.GenericSansSerif.Name)) {
|
||||
_font = new Font(fam, 12, FontStyle.Bold, GraphicsUnit.Pixel);
|
||||
}
|
||||
Width = DefaultSize.Width;
|
||||
Height = DefaultSize.Height;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -113,8 +117,11 @@ namespace Greenshot.Drawing {
|
|||
} else {
|
||||
EllipseContainer.DrawEllipse(rect, graphics, rm, 0, Color.Transparent, fillColor, false);
|
||||
}
|
||||
|
||||
TextContainer.DrawText(graphics, rect, 0, lineColor, false, _stringFormat, text, _font);
|
||||
using (FontFamily fam = new FontFamily(FontFamily.GenericSansSerif.Name)) {
|
||||
float factor = (((float)Width / DefaultSize.Width) + ((float)Height / DefaultSize.Height)) / 2;
|
||||
_font = new Font(fam, 16 * factor, FontStyle.Bold, GraphicsUnit.Pixel);
|
||||
TextContainer.DrawText(graphics, rect, 0, lineColor, false, _stringFormat, text, _font);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool ClickableAt(int x, int y) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue