在程序中,我设计新建一个窗口,窗口上按要求划线与点,然后把画的内容存为一张图片。请问:如果能把窗口内容存为一个图片文件?
解决方案 »
- VB 如何向 EXCEL 中多次写入数据?
- 如何在VB里制作DLL文件
- 如何使程序界面随屏目分辩率自动变化????
- 怎幺竖向打印,搞死了!
- 如何遍历TreeView的子节点???在线等待。
- 初次发表自己的软件,望大家找出不足,多多指教,以便互相提高,谢谢!
- 按钮控件在图片框中拖动,如何使它不越界?
- 简单的送分问题(只是我不懂)
- 用VB写的ACTIVE DLL组件,其中一个方法是的参数是个VARIANT数组,当在ASP中使用这个DLL的时候,需要把一个树组传进去,总报错,这是为什么?????
- 如何用VB6.0编写一个能在ASP中使用的组件,请赐详细步骤,谢谢!
- 想双击listviwe中的任意一行打开对应的窗体!请大家帮帮忙!谢谢!
- 求查询ACCESS某字段 字符具体位置的方法?譬如 第N行第M个字符是否匹配
然后把图像从内存中保存为一个图片文件就OK了
Me.AutoRedraw = True
Me.Line (0, 0)-(1000, 1000)
Me.AutoRedraw = False
SavePicture Me.Image, "E:\aa.bmp"
End Sub
Dim nWidth As Long, nHeight As Long
Picture1.Width = Me.ScaleWidth
Picture1.Height = Me.ScaleHeight
nWidth = Me.ScaleWidth / Screen.TwipsPerPixelX
nHeight = Me.ScaleHeight / Screen.TwipsPerPixelY
Picture1.AutoRedraw = True
BitBlt Picture1.hDC, 0, 0, nWidth, nHeight, Me.hDC, 0, 0, SRCCOPY
Picture1.AutoRedraw = False
SavePicture Picture1.Image, "e:\bb.bmp"
End Sub设置visible属性把Picture1隐藏。
Sub 保存图片(f As Form, savefile As String)
Dim nWidth As Long, nHeight As LongfrmMain.Picture1.Width = f.ScaleWidth
frmMain.Picture1.Height = f.ScaleHeight
nWidth = f.ScaleWidth / Screen.TwipsPerPixelX
nHeight = f.ScaleHeight / Screen.TwipsPerPixelY
frmMain.Picture1.AutoRedraw = True
BitBlt frmMain.Picture1.hDC, 0, 0, nWidth, nHeight, f.hDC, 0, 0, SRCCOPY
frmMain.Picture1.AutoRedraw = False
SavePicture frmMain.Picture1.Image, savefile
DoEvents
Set frmMain.Picture1.Picture = Nothing
End Sub
如果哪个窗口名为 form1,则:call 保存图片(form1,"....")