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
|
|
|
|
|
{
|
2020-03-28 22:48:06 +00:00
|
|
|
|
//private bool windowDragging = false;
|
|
|
|
|
//private Point windowOffset = new Point();
|
2020-03-28 02:54:08 +00:00
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//protected override void OnPaint(PaintEventArgs e)
|
|
|
|
|
//{
|
|
|
|
|
// base.OnPaint(e);
|
|
|
|
|
|
|
|
|
|
// if (this.BackgroundImage == null)
|
|
|
|
|
// {
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// Graphics g = e.Graphics;
|
|
|
|
|
|
|
|
|
|
// g.TextRenderingHint = TextRenderingHint.AntiAlias;
|
|
|
|
|
// g.InterpolationMode = InterpolationMode.HighQualityBilinear;
|
|
|
|
|
// g.PixelOffsetMode = PixelOffsetMode.HighQuality;
|
|
|
|
|
// g.SmoothingMode = SmoothingMode.HighQuality;
|
|
|
|
|
|
|
|
|
|
// g.DrawImage(this.BackgroundImage, Point.Empty);
|
|
|
|
|
//}
|
|
|
|
|
|
2020-03-28 22:48:06 +00:00
|
|
|
|
//protected void windowMoveControl_MouseDown(object sender, MouseEventArgs e)
|
|
|
|
|
//{
|
|
|
|
|
// if (e.Button != MouseButtons.Left)
|
|
|
|
|
// {
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
2020-03-28 02:54:08 +00:00
|
|
|
|
|
2020-03-28 22:48:06 +00:00
|
|
|
|
// windowDragging = true;
|
|
|
|
|
// windowOffset = e.Location;
|
|
|
|
|
//}
|
2020-03-28 02:54:08 +00:00
|
|
|
|
|
2020-03-28 22:48:06 +00:00
|
|
|
|
//protected void windowMoveControl_MouseUp(object sender, MouseEventArgs e)
|
|
|
|
|
//{
|
|
|
|
|
// windowDragging = false;
|
|
|
|
|
//}
|
2020-03-28 02:54:08 +00:00
|
|
|
|
|
2020-03-28 22:48:06 +00:00
|
|
|
|
//protected void windowMoveControl_MouseMove(object sender, MouseEventArgs e)
|
|
|
|
|
//{
|
|
|
|
|
// if (windowDragging)
|
|
|
|
|
// {
|
|
|
|
|
// Point pos = this.PointToScreen(e.Location);
|
2020-03-28 02:54:08 +00:00
|
|
|
|
|
2020-03-28 22:48:06 +00:00
|
|
|
|
// int y = Math.Max((pos.Y - windowOffset.Y), Screen.PrimaryScreen.WorkingArea.Y);
|
|
|
|
|
// y = Math.Min(y, (Screen.PrimaryScreen.WorkingArea.Y + Screen.PrimaryScreen.WorkingArea.Height) - this.Height);
|
2020-03-28 02:54:08 +00:00
|
|
|
|
|
2020-03-28 22:48:06 +00:00
|
|
|
|
// this.Location = new Point(Screen.PrimaryScreen.WorkingArea.X, y);
|
|
|
|
|
// }
|
|
|
|
|
//}
|
2020-03-28 02:54:08 +00:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|