public formWindowSizeOverlay(formWindowSize parent, bool showInfo, int captionHeight, int borderSize)
        {
            InitializeComponent();

            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);

            this.parent = parent;

            this.captionHeight = captionHeight;
            this.borderSize    = borderSize;
            this.showInfo      = showInfo;

            pen = new Pen(brush = new SolidBrush(parent.ForeColor));

            sizeInfo = TextRenderer.MeasureText(TEXT_INFO, this.Font);

            this.ForeColor       = parent.ForeColor;
            this.BackColor       = parent.BackColor;
            this.TransparencyKey = parent.BackColor;

            int initialStyle = GetWindowLong(this.Handle, GWL_EXSTYLE);

            SetWindowLong(this.Handle, GWL_EXSTYLE, initialStyle | WS_EX_LAYERED | WS_EX_TRANSPARENT);
            SetWindowPos(this.Handle, (IntPtr)WindowZOrder.HWND_TOPMOST, 0, 0, 0, 0, SetWindowPosFlags.SWP_FRAMECHANGED | SetWindowPosFlags.SWP_NOSIZE | SetWindowPosFlags.SWP_NOMOVE);

            parent.LocationChanged += parent_LocationChanged;
            parent.SizeChanged     += parent_SizeChanged;
        }
Exemplo n.º 2
0
        public formWindowSizeOverlay(formWindowSize parent)
        {
            InitializeComponent();

            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);

            this.parent = parent;

            pen = new Pen(brush = new SolidBrush(parent.ForeColor));

            sizeInfo = TextRenderer.MeasureText(TEXT_INFO, this.Font);

            this.ForeColor = parent.ForeColor;
            this.BackColor = parent.BackColor;
            this.TransparencyKey = parent.BackColor;

            int initialStyle = GetWindowLong(this.Handle, GWL_EXSTYLE);
            SetWindowLong(this.Handle, GWL_EXSTYLE, initialStyle | WS_EX_LAYERED | WS_EX_TRANSPARENT);
            SetWindowPos(this.Handle, (IntPtr)WindowZOrder.HWND_TOPMOST, 0, 0, 0, 0, SetWindowPosFlags.SWP_FRAMECHANGED | SetWindowPosFlags.SWP_NOSIZE | SetWindowPosFlags.SWP_NOMOVE);

            parent.LocationChanged += parent_LocationChanged;
            parent.SizeChanged += parent_SizeChanged;
        }
Exemplo n.º 3
0
        private void buttonWindowed_Click(object sender, EventArgs e)
        {
            using (formWindowSize f = new formWindowSize(true))
            {
                Rectangle r = FixSize(ParseWindowSize(textWindowed.Text));

                f.SetBounds(r.X, r.Y, r.Width, r.Height);
                f.ShowDialog(this);

                textWindowed.Text = ToString(f.Bounds);
            }
        }