Exemplo n.º 1
0
        private static Bitmap GetScreenShot(Titlebarinfoex pti)
        {
            var bmpScreenshot = new Bitmap(pti.rcTitleBar.Width,
                                           pti.rcTitleBar.Height,
                                           PixelFormat.Format32bppArgb);

            // Create a graphics object from the bitmap.
            using (var g = Graphics.FromImage(bmpScreenshot))
            {
                g.CopyFromScreen(pti.rcTitleBar.X,
                                 pti.rcTitleBar.Y,
                                 0,
                                 0,
                                 pti.rcTitleBar.Size,
                                 CopyPixelOperation.SourceCopy);
                var scr = Screen.FromPoint(Cursor.Position);
                using (var bmp2 = new Bitmap(scr.Bounds.Width, scr.Bounds.Height))
                {
                    using (var g2 = Graphics.FromImage(bmp2))
                    {
                        g2.FillRectangle(Brushes.Red,
                                         pti.rgrect[(int)CchildrenTitlebarConstants.CchildrenTitlebarMinimizeButton]);
                    }

                    g.DrawImage(bmp2, new Rectangle(0, 0, pti.rcTitleBar.Width, pti.rcTitleBar.Height),
                                new Rectangle(pti.rcTitleBar.X, pti.rcTitleBar.Y, pti.rcTitleBar.Width, pti.rcTitleBar.Height),
                                GraphicsUnit.Pixel);
                }
            }

            return(bmpScreenshot);
        }
Exemplo n.º 2
0
        public static bool GetTitleBarInfoEx(IntPtr hWnd, out Titlebarinfoex pwi)
        {
            var ex = new Titlebarinfoex();

            ex.cbSize = (uint)Marshal.SizeOf(ex);
            var result = SendMessage(hWnd, WmGettitlebarinfoex, 0, ref ex);

            pwi = ex;
            return(result.ToInt32() != 0);
        }
Exemplo n.º 3
0
 public static extern IntPtr SendMessage(IntPtr hWnd, uint msg, int wParam, ref Titlebarinfoex lParam);