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:
RKrom 2014-06-02 14:51:28 +02:00
parent 85d73cd8e0
commit e75925018b
4 changed files with 40 additions and 31 deletions

View file

@ -739,6 +739,7 @@ namespace Greenshot.Drawing {
if (matrix == null) {
return;
}
SuspendLayout();
Point topLeft = new Point(Left, Top);
Point bottomRight = new Point(Left + Width, Top + Height);
Point[] points;
@ -757,6 +758,7 @@ namespace Greenshot.Drawing {
if (TargetGripper != null) {
TargetGripper.Location = points[points.Length-1];
}
ResumeLayout();
}
protected virtual ScaleHelper.IDoubleProcessor GetAngleRoundProcessor() {

View file

@ -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,9 +117,12 @@ namespace Greenshot.Drawing {
} else {
EllipseContainer.DrawEllipse(rect, graphics, rm, 0, Color.Transparent, fillColor, false);
}
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) {
Rectangle rect = GuiRectangle.GetGuiRectangle(Left, Top, Width, Height);

View file

@ -18,26 +18,27 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Greenshot.Configuration;
using Greenshot.Core;
using Greenshot.Drawing.Fields;
using Greenshot.Helpers;
using Greenshot.IniFile;
using Greenshot.Memento;
using Greenshot.Plugin;
using Greenshot.Plugin.Drawing;
using GreenshotPlugin.Controls;
using GreenshotPlugin.Core;
using log4net;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using System.Windows.Forms;
using Greenshot.Configuration;
using Greenshot.Drawing.Fields;
using Greenshot.Helpers;
using Greenshot.Plugin;
using Greenshot.Plugin.Drawing;
using GreenshotPlugin.Core;
using Greenshot.Memento;
using Greenshot.IniFile;
using GreenshotPlugin.Controls;
using Greenshot.Core;
using log4net;
using System.Drawing.Drawing2D;
namespace Greenshot.Drawing {

View file

@ -18,30 +18,29 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.IO;
using System.Windows.Forms;
using Greenshot.Configuration;
using Greenshot.Core;
using Greenshot.Destinations;
using Greenshot.Drawing;
using Greenshot.Drawing.Fields;
using Greenshot.Drawing.Fields.Binding;
using Greenshot.Forms;
using Greenshot.Help;
using Greenshot.Helpers;
using Greenshot.IniFile;
using Greenshot.Plugin;
using GreenshotPlugin.Controls;
using GreenshotPlugin.Core;
using Greenshot.IniFile;
using System.Threading;
using Greenshot.Core;
using log4net;
using Greenshot.Forms;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.IO;
using System.Threading;
using System.Windows.Forms;
namespace Greenshot {
/// <summary>