public FormDrag(Addon addon)
{
InitializeComponent();
this.addon = addon;
Addon.SetShortcuts(false);
this.settings = new Settings("settings.txt");
this.Screens = new Rectangle[Screen.AllScreens.Length];
for (int i = 0; i < this.Screens.Length; i++)
this.Screens[i] = Screen.AllScreens[i].Bounds;
this.Width = this.Screens[0].Width;
this.Height = this.Screens[0].Height;
// This works because WinForms has an internal way of setting the maximum width/height of a Control (Form)
// Check it with ILSpy, System.Windows.Forms.Control.Width (set)
for (int i = 0; i < Screen.AllScreens.Length; i++) {
if (Screen.AllScreens[i].Bounds.Left < this.Left) {
this.Width += this.Left - Screen.AllScreens[i].Bounds.Left;
this.Left = Screen.AllScreens[i].Bounds.Left;
} else
this.Width += Screen.AllScreens[i].Bounds.Width;
if (Screen.AllScreens[i].Bounds.Top < this.Top) {
this.Height += this.Top - Screen.AllScreens[i].Bounds.Top;
this.Top = Screen.AllScreens[i].Bounds.Top;
} else
this.Height += Screen.AllScreens[i].Bounds.Height;
}
this.Opacity = 0.5f;
//this.TopMost = true;
this.beginImage = new Bitmap(this.Width, this.Height, System.Drawing.Imaging.PixelFormat.Format32bppRgb);
Graphics beginGfx = Graphics.FromImage(this.beginImage);
beginGfx.CopyFromScreen(this.Location, Point.Empty, this.Size);
beginGfx.Dispose();
}