public override void Update(double secondsElapsed, InputUtilities keyUtils, SharpDX.Vector2 cursorPoint, bool checkMouse = false)
 {
     base.Update(secondsElapsed, keyUtils, cursorPoint, checkMouse);
     if (listen)
     {
         if(skip > 0)
         {
             skip--;
             return;
         }
         WinAPI.VirtualKeyShort[] buttons = keyUtils.Keys.KeysThatWentUp();
         if (buttons.Length > 0)
         {
             Key = buttons[0];
             listen = false;
         }
     }
 }
        public override void Update(double secondsElapsed, InputUtilities inputUtils, SharpDX.Vector2 cursorPoint, bool checkMouse = false)
        {
            base.Update(secondsElapsed, inputUtils, cursorPoint, checkMouse);
            if (TabHeaders == null)
                return;

            float maxHeight = TabHeaders.Max(x => x.Height);
            this.Height = ChildControls[this.SelectedIndex].Height + maxHeight;
            this.ChildControls[this.SelectedIndex].Y = maxHeight;
            this.Width = TabHeaders[TabHeaders.Length - 1].X + TabHeaders[TabHeaders.Length - 1].Width;
        }
        public override void Update(double secondsElapsed, InputUtilities keyUtils, SharpDX.Vector2 cursorPoint, bool checkMouse = false)
        {
            base.Update(secondsElapsed, keyUtils, cursorPoint, checkMouse);
            if (this.Visible)
            {
                this.ContentLayout.ApplyLayout(this);
                float width = 0, height = 0;
                Control<SharpDXRenderer, Color, Vector2, TextFormat> lastControl = null;

                for (int i = 0; i < this.ChildControls.Count; i++)
                {
                    var control = this.ChildControls[i];
                    if (!control.Visible)
                        continue;

                    lastControl = control;
                    if (this.DynamicWidth)
                        if (control.Width + control.MarginLeft + control.MarginRight > width)
                            width = control.Width + control.MarginLeft + control.MarginRight;
                }

                if (this.DynamicHeight)
                {
                    if(ChildControls.Count(x=>x.Visible)>0)
                        height = ChildControls.Where(x => x.Visible).Max(x => x.Y + x.Height);
                }
                    //if (lastControl != null)
                    //    height = lastControl.Y + lastControl.Height + lastControl.MarginBottom;
                if (this.DynamicWidth)
                    this.Width = width + this.MarginLeft + this.MarginRight;
                if (this.DynamicHeight)
                    this.Height = height + this.MarginBottom;
            }
            else
            {
                this.Height = 0;
            }
        }
 public override void Update(double secondsElapsed, InputUtilities keyUtils, SharpDX.Vector2 cursorPoint, bool checkMouse = false)
 {
     if (this.Parent != null)
         this.Width = Parent.Width - this.MarginLeft - this.MarginRight - Parent.MarginLeft - Parent.MarginRight;
     base.Update(secondsElapsed, keyUtils, cursorPoint, checkMouse);
 }
 public override void Update(double secondsElapsed, InputUtilities keyUtils, Vector2 cursorPoint, bool checkMouse = false)
 {
     base.Update(secondsElapsed, keyUtils, cursorPoint, checkMouse);
 }
        static void Main(string[] args)
        {
            Console.WriteLine("Change overlay attached window by pressing F5");
            Console.WriteLine("It will attach to currently active window");
            Console.WriteLine("Trackbar can be controled with mouse wheel");
            System.Windows.Forms.Application.EnableVisualStyles();
            System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false);
            input = new InputUtilities();
            var hWnd = WinAPI.GetForegroundWindow();
            using (SHDXOverlay = new SharpDXOverlay())
            {
                SHDXOverlay.Attach(hWnd);
                SHDXOverlay.TickEvent += overlay_TickEvent;
                InitializeComponents();
                SharpDXRenderer renderer = SHDXOverlay.Renderer;
                TextFormat smallFont = renderer.CreateFont("smallFont", "Century Gothic", 10f);
                TextFormat largeFont = renderer.CreateFont("largeFont", "Century Gothic", 14f);
                TextFormat heavyFont = renderer.CreateFont("heavyFont", "Century Gothic", 14f, SharpDX.DirectWrite.FontStyle.Normal, FontWeight.Heavy);
                windowMenu.Font = smallFont;
                windowMenu.Caption.Font = largeFont;
                SHDXOverlay.ChildControls.Add(windowMenu);

                System.Windows.Forms.Application.Run(SHDXOverlay);
            }
        }