public Form1() { InitializeComponent(); plot_obj = new List <Vector2>(); StartPosition = FormStartPosition.CenterScreen; follower = new Utilities.FollowWindow.FW(this.Handle, Globals.winHandle, false); follower.Start(); Utilities.WinControl.RECT rect; Utilities.WinControl.WC.GetWindowRect(Globals.winHandle, out rect); this.width = rect.Width; this.height = rect.Height; Size = new System.Drawing.Size(this.width, this.height); FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; // no borders TopMost = true; // make the form allways on top Visible = true; // Important! if this isn't set, then the form is not shown at all // Set the form click-through int initialStyle = GetWindowLong(this.Handle, -20); SetWindowLong(this.Handle, -20, initialStyle | 0x80000 | 0x20); // Create device presentation parameters PresentationParameters p = new PresentationParameters(); p.IsFullScreen = false; p.DeviceWindowHandle = this.Handle; p.BackBufferFormat = SurfaceFormat.Vector4; p.PresentationInterval = PresentInterval.One; // Create XNA graphics device dev = new GraphicsDevice(GraphicsAdapter.DefaultAdapter, GraphicsProfile.Reach, p); // Init basic effect effect = new BasicEffect(dev); // Extend aero glass style on form init OnResize(null); minimapCenter = CalcMinimapCenter(); using (FileStream fileStream = new FileStream(@"..\..\icons\red_icon.png", FileMode.Open)) { fileTexture = Texture2D.FromStream(dev, fileStream); } }
public Form1() { InitializeComponent(); plot_obj = new List<Vector2>(); StartPosition = FormStartPosition.CenterScreen; follower = new Utilities.FollowWindow.FW(this.Handle, Globals.winHandle, false); follower.Start(); Utilities.WinControl.RECT rect; Utilities.WinControl.WC.GetWindowRect(Globals.winHandle, out rect); this.width = rect.Width; this.height = rect.Height; Size = new System.Drawing.Size(this.width, this.height); FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; // no borders TopMost = true; // make the form allways on top Visible = true; // Important! if this isn't set, then the form is not shown at all // Set the form click-through int initialStyle = GetWindowLong(this.Handle, -20); SetWindowLong(this.Handle, -20, initialStyle | 0x80000 | 0x20); // Create device presentation parameters PresentationParameters p = new PresentationParameters(); p.IsFullScreen = false; p.DeviceWindowHandle = this.Handle; p.BackBufferFormat = SurfaceFormat.Vector4; p.PresentationInterval = PresentInterval.One; // Create XNA graphics device dev = new GraphicsDevice(GraphicsAdapter.DefaultAdapter, GraphicsProfile.Reach, p); // Init basic effect effect = new BasicEffect(dev); // Extend aero glass style on form init OnResize(null); minimapCenter = CalcMinimapCenter(); using (FileStream fileStream = new FileStream(@"..\..\icons\red_icon.png", FileMode.Open)) { fileTexture = Texture2D.FromStream(dev, fileStream); } }
private void Form1_Load(object sender, EventArgs e) { // Following thread to stalk a window or make a window stalk you follower = new Utilities.FollowWindow.FW(this.Handle, Globals.winHandle, false); follower.Start(); // set the window to the same size as D3 Utilities.WinControl.RECT rect; Utilities.WinControl.WC.GetWindowRect(Globals.winHandle, out rect); this.Width = rect.Width; this.Height = rect.Height; // all mouseclicks on the window fall through to the window(s) behind Utilities.WinControl.WC.SetWindowLayeredMode(Globals.winHandle); // set this window's style to d3's window's style for perfect match up of client space. //Utilities.WinControl.WC.SetWindowLong(this.Handle, 0, Utilities.WinControl.WC.GetWindowLong(Globals.winHandle, 0)); Utilities.WinControl.WC.winSetTopMost(this.Handle); }