Esempio n. 1
0
 public CrosshairCanvas()
 {
     this.DoubleBuffered  = true;
     this.FormBorderStyle = FormBorderStyle.None;
     this.ShowInTaskbar   = false;
     this.TransparencyKey = ColorTranslator.FromHtml(FromOption("TransparencyKey", "#000000"));
     this.BackColor       = TransparencyKey;
     this.ScaledSize      = int.Parse(FromOption("Scale", "32"));
     this.Size            = ScaledSize < 64 ? new Size(64, 64) : new Size(ScaledSize, ScaledSize);
     this.Paint          += new PaintEventHandler(Render);
     this.Enabled         = false;
     NativeAccess.SetWindowLongA(Handle, -20, NativeAccess.GetWindowLongA(Handle, -20) | 0x80000 | 0x20);
 }
Esempio n. 2
0
 private void OnThreadLayer()
 {
     GameHandle = SearchGameHandle("Counter-Strike: Global Offensive");
     ToggleBind = AwaitToggleBind();
     while (Running)
     {
         Thread.Sleep(128);
         NativeAccess.RectStruct parent;
         NativeAccess.RectStruct client;
         NativeAccess.GetWindowRect(GameHandle, out parent);
         NativeAccess.GetClientRect(GameHandle, out client);
         parent.Left += ((parent.Right - parent.Left) - (client.Right - client.Left)) / 2;
         parent.Top  += ((parent.Bottom - parent.Top) - (client.Bottom - client.Top)) / 2;
         Canvas.Update(IsForeground && Visible, parent);
     }
 }
Esempio n. 3
0
        protected IntPtr SearchGameHandle(string title)
        {
            Console.WriteLine("Press any key fetch the Game-Process.");
            Console.ReadKey();
            Console.Write("\r" + new string(' ', Console.WindowWidth) + "\r");
            IntPtr Temp = NativeAccess.FindWindow(null, title);

            if (Temp != IntPtr.Zero)
            {
                return(Temp);
            }
            else
            {
                Console.WriteLine("ERROR: Couldn't find: \"" + title + '\"');
                return(SearchGameHandle(title));
            }
        }