窗体控件打印
在窗体上有2个控件:Botton1 和 groupbox1 ;我想点击 Botton1 就直接打印groupbox1 界面 出来,可以办到吗?请高手指点,谢谢! 打印
[解决办法]
当然可以。借助 PictureBox。
把你想打印的控件放到 Picture1 中,通过 Picture2 的中介进行打印。两个 PictureBox 大小相同,可以重叠。
Picture1.SetFocus
Picture2.AutoRedraw = True
rv = SendMessage(Picture1.hwnd, WM_PAINT, Picture2.hDC, 0)
rv = SendMessage(Picture1.hwnd, WM_PRINT, Picture2.hDC, _
PRF_CHILDREN + PRF_CLIENT + PRF_OWNED)
Picture2.Picture = Picture2.Image
Picture2.AutoRedraw = False
Printer.Print ""
Printer.PaintPicture Picture2.Picture, 0, 0
Printer.EndDoc