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

View file

@ -48,17 +48,21 @@ namespace Greenshot.Drawing {
InitContent(); InitContent();
} }
public override Size DefaultSize {
get {
return new Size(30, 30);
}
}
public override bool InitContent() { public override bool InitContent() {
_defaultEditMode = EditStatus.IDLE; _defaultEditMode = EditStatus.IDLE;
_stringFormat.Alignment = StringAlignment.Center; _stringFormat.Alignment = StringAlignment.Center;
_stringFormat.LineAlignment = StringAlignment.Center; _stringFormat.LineAlignment = StringAlignment.Center;
// Set defaults // Set defaults
Width = 30; Width = DefaultSize.Width;
Height = 30; Height = DefaultSize.Height;
using (FontFamily fam = new FontFamily(FontFamily.GenericSansSerif.Name)) {
_font = new Font(fam, 12, FontStyle.Bold, GraphicsUnit.Pixel);
}
return true; return true;
} }
@ -113,8 +117,11 @@ namespace Greenshot.Drawing {
} else { } else {
EllipseContainer.DrawEllipse(rect, graphics, rm, 0, Color.Transparent, fillColor, false); EllipseContainer.DrawEllipse(rect, graphics, rm, 0, Color.Transparent, fillColor, false);
} }
using (FontFamily fam = new FontFamily(FontFamily.GenericSansSerif.Name)) {
TextContainer.DrawText(graphics, rect, 0, lineColor, false, _stringFormat, text, _font); 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) { public override bool ClickableAt(int x, int y) {

View file

@ -18,26 +18,27 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* 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 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;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.IO; using System.IO;
using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Serialization.Formatters.Binary;
using System.Windows.Forms; 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 { namespace Greenshot.Drawing {

View file

@ -18,30 +18,29 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* 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 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.Configuration;
using Greenshot.Core;
using Greenshot.Destinations; using Greenshot.Destinations;
using Greenshot.Drawing; using Greenshot.Drawing;
using Greenshot.Drawing.Fields; using Greenshot.Drawing.Fields;
using Greenshot.Drawing.Fields.Binding; using Greenshot.Drawing.Fields.Binding;
using Greenshot.Forms;
using Greenshot.Help; using Greenshot.Help;
using Greenshot.Helpers; using Greenshot.Helpers;
using Greenshot.IniFile;
using Greenshot.Plugin; using Greenshot.Plugin;
using GreenshotPlugin.Controls; using GreenshotPlugin.Controls;
using GreenshotPlugin.Core; using GreenshotPlugin.Core;
using Greenshot.IniFile;
using System.Threading;
using Greenshot.Core;
using log4net; 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 { namespace Greenshot {
/// <summary> /// <summary>