有些Opacity不为1的窗体,截屏时怎么才能截到它?

解决方案 »

  1.   

    不能调整 Opacity吗?如果是别的窗体 看看下面能不能帮你   [DllImport("user32.dll")]
            private static extern int SetWindowLong(IntPtr hwnd, int nIndex, int dwNewLong);
            [DllImport("user32.dll")]
            private static extern int SetLayeredWindowAttributes(IntPtr hwnd, int crKey, byte bAlpha, int dwFlags);        private void SetFromOpacity(IntPtr p_Handle, byte p_Numb)
            {
                SetWindowLong(this.Handle, (-20), 0x80000);
                SetLayeredWindowAttributes(this.Handle, 0, 50, 0x2);         }
        
      

  2.   

    错了
      [DllImport("user32.dll")]
            private static extern int SetWindowLong(IntPtr hwnd, int nIndex, int dwNewLong);
            [DllImport("user32.dll")]
            private static extern int SetLayeredWindowAttributes(IntPtr hwnd, int crKey, byte bAlpha, int dwFlags);        private void SetFromOpacity(IntPtr p_Handle, byte p_Numb)
            {
                SetWindowLong(p_Handle, (-20), 0x80000);
                SetLayeredWindowAttributes(p_Handle, 0, p_Numb, 0x2);         }
        
      

  3.   


    截图时调整为不透明,截园了再调回去或者用Control.DrawToBitmap看可不可以
      

  4.   

    使用GDI+,目前我还没找到更好的方法,按楼上zgke和cpio的建议,采用调整Opacity来达到目的。