Alsing.Drawing.DrawingTools.DrawControl C# (CSharp) Method

DrawControl() public static method

public static DrawControl ( Control control ) : Bitmap
control System.Windows.Forms.Control
return System.Drawing.Bitmap
        public static Bitmap DrawControl(Control control)
        {
            var b = new Bitmap(control.Width, control.Height);
            Graphics g = Graphics.FromImage(b);
            IntPtr hdc = g.GetHdc();
            NativeMethods.SendMessage(control.Handle, (int) WindowMessage.WM_PRINT, (int) hdc,
                                              (int) (WMPrintFlags.PRF_CLIENT | WMPrintFlags.PRF_ERASEBKGND));
            g.ReleaseHdc(hdc);
            g.Dispose();

            return b;
        }

Same methods

DrawingTools::DrawControl ( Control control, Bitmap b ) : bool