2020-03-28 02:54:08 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Drawing.Drawing2D;
|
|
|
|
|
using System.Drawing.Text;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace AppLauncher.Windows.Forms
|
|
|
|
|
{
|
|
|
|
|
public class AForm : Form
|
|
|
|
|
{
|
|
|
|
|
public AForm() : base()
|
|
|
|
|
{
|
|
|
|
|
if (!this.DesignMode)
|
|
|
|
|
{
|
|
|
|
|
this.FormBorderStyle = FormBorderStyle.None;
|
|
|
|
|
this.StartPosition = FormStartPosition.Manual;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnLoad(EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.OnLoad(e);
|
|
|
|
|
|
|
|
|
|
if (this.DesignMode)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-10 10:03:55 +00:00
|
|
|
|
//int requestedHeight = (int)Math.Floor(decimal.Divide((Screen.PrimaryScreen.WorkingArea.Height - this.Height), 2));
|
|
|
|
|
//this.Location = new Point(Screen.PrimaryScreen.WorkingArea.X, (Screen.PrimaryScreen.WorkingArea.Y + requestedHeight));
|
|
|
|
|
|
|
|
|
|
//Point newPosition = new Point(Cursor.Position.X, Cursor.Position.Y);
|
|
|
|
|
//newPosition.X -= (this.Width / 2);
|
|
|
|
|
//newPosition.Y -= (this.Height / 2);
|
2020-03-28 02:54:08 +00:00
|
|
|
|
|
2020-05-10 10:03:55 +00:00
|
|
|
|
//this.Location = newPosition;
|
2020-03-28 02:54:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnPaintBackground(PaintEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.OnPaintBackground(e);
|
|
|
|
|
|
|
|
|
|
Graphics g = e.Graphics;
|
|
|
|
|
g.TextRenderingHint = TextRenderingHint.AntiAlias;
|
|
|
|
|
g.InterpolationMode = InterpolationMode.HighQualityBilinear;
|
|
|
|
|
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
|
|
|
|
|
g.SmoothingMode = SmoothingMode.HighQuality;
|
|
|
|
|
|
|
|
|
|
//g.FillRectangle(new LinearGradientBrush(this.DisplayRectangle, Color.FromArgb(76, 83, 93), Color.FromArgb(255, 255, 255), -30F), this.DisplayRectangle);
|
|
|
|
|
|
|
|
|
|
//g.DrawRectangle(new Pen(new SolidBrush(Color.Red), 1), this.DisplayRectangle);
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-10 10:03:55 +00:00
|
|
|
|
protected Point DefaultLocation
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
Point newPosition = new Point(Cursor.Position.X, Cursor.Position.Y);
|
|
|
|
|
newPosition.X -= (this.Width / 2);
|
|
|
|
|
newPosition.Y -= (this.Height / 2);
|
2020-03-28 02:54:08 +00:00
|
|
|
|
|
2020-05-10 10:03:55 +00:00
|
|
|
|
newPosition.X = Math.Max(newPosition.X, Screen.PrimaryScreen.WorkingArea.Left);
|
|
|
|
|
newPosition.Y = Math.Max(newPosition.Y, Screen.PrimaryScreen.WorkingArea.Top);
|
2020-03-28 02:54:08 +00:00
|
|
|
|
|
2020-05-10 10:03:55 +00:00
|
|
|
|
return newPosition;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-03-28 02:54:08 +00:00
|
|
|
|
|
|
|
|
|
}
|
2020-05-10 10:03:55 +00:00
|
|
|
|
}
|