Few drop form changes

This commit is contained in:
Jaex 2014-07-05 21:28:30 +03:00
parent 523f6ddbbb
commit 111d44e11f
3 changed files with 13 additions and 8 deletions

View file

@ -504,7 +504,10 @@ public static void DrawTextWithOutline(Graphics g, string text, PointF position,
using (GraphicsPath gp = new GraphicsPath())
{
gp.AddString(text, font.FontFamily, (int)font.Style, font.Size, position, new StringFormat());
using (StringFormat sf = new StringFormat())
{
gp.AddString(text, font.FontFamily, (int)font.Style, font.Size, position, sf);
}
using (Pen borderPen = new Pen(borderColor, 2) { LineJoin = LineJoin.Round })
{

View file

@ -57,16 +57,16 @@ public static DropForm GetInstance(int size, int offset, ContentAlignment alignm
private DropForm(int size, int offset, ContentAlignment alignment, int opacity, int hoverOpacity)
{
InitializeComponent();
DropSize = size.Between(10, 300);
DropOffset = offset;
DropAlignment = alignment;
DropOpacity = opacity.Between(1, 255);
DropHoverOpacity = hoverOpacity.Between(1, 255);
backgroundImage = DrawDropImage(size);
backgroundImage = DrawDropImage(DropSize);
Point position = Helpers.GetPosition(DropAlignment, new Point(DropOffset, DropOffset), Screen.PrimaryScreen.WorkingArea.Size, backgroundImage.Size);
Location = position;
Location = Helpers.GetPosition(DropAlignment, new Point(DropOffset, DropOffset), Screen.PrimaryScreen.WorkingArea.Size, backgroundImage.Size);
SelectBitmap(backgroundImage, DropOpacity);
}
@ -87,10 +87,10 @@ private Bitmap DrawDropImage(int size)
g.DrawRectangleProper(pen, rect.RectangleOffset(-1));
}
string text = "Drag\n&\nDrop";
StringFormat sf = new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center };
string text = "Drop\nhere";
using (Font font = new Font("Arial", 20, FontStyle.Bold))
using (StringFormat sf = new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center })
{
g.DrawString(text, font, Brushes.Black, rect.LocationOffset(1), sf);
g.DrawString(text, font, Brushes.White, rect, sf);
@ -174,7 +174,9 @@ protected override void Dispose(bool disposing)
{
components.Dispose();
}
if (backgroundImage != null) backgroundImage.Dispose();
base.Dispose(disposing);
}
@ -186,6 +188,7 @@ private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Cursor = Cursors.SizeAll;
this.Text = "DropForm";
this.AllowDrop = true;

View file

@ -438,8 +438,7 @@ public static string CheckFilePath(string folder, string filename, TaskSettings
public static void OpenDropWindow()
{
DropForm.GetInstance(Program.Settings.DropSize, Program.Settings.DropOffset, Program.Settings.DropAlignment, Program.Settings.DropOpacity,
Program.Settings.DropHoverOpacity).ShowActivate();
DropForm.GetInstance(Program.Settings.DropSize, Program.Settings.DropOffset, Program.Settings.DropAlignment, Program.Settings.DropOpacity, Program.Settings.DropHoverOpacity).ShowActivate();
}
public static void DoScreenRecorder(TaskSettings taskSettings = null)