vb截图保存的问题

Me.AutoRedraw=TrueBitBltMe.hDC,sux,suy,picWidth,picHeight,GetDC(0),sux,suy,vbSrcCopyS... Me.AutoRedraw = True
BitBlt Me.hDC, sux, suy, picWidth, picHeight, GetDC(0), sux, suy, vbSrcCopy
SavePicture Me.Image, "D:\gua\pic\1.jpg"

怎么保存出来的图片会是这样?
sux,suy是要截图片左上端的坐标```已定义
程序主要是要截取指定的屏幕(非全屏),并保存到文件。
展开
 我来答
nefu_20061617
2010-04-14 · TA获得超过2342个赞
知道大有可为答主
回答量:1064
采纳率:72%
帮助的人:1483万
展开全部
窗体的Image属性就是一个全屏图像。
用 图片框 存图像,再保存。添加一个 Picture1
Me.AutoRedraw = True
Me.ScaleMode = 3
With Picture1
.AutoRedraw = True
.BorderStyle = 0
.Width = picWidth
.Height = picHeight
.Visible = False
.PaintPicture Me.Image, 0, 0
BitBlt .hdc, sux, suy, picWidth, picHeight, GetDC(0), sux, suy, vbSrcCopy
SavePicture .Image, "D:\gua\pic\1.jpg"
End With
'SavePicture保存的图片是bmp格式,与扩展名无关。
luomandick
2010-04-14 · TA获得超过1175个赞
知道小有建树答主
回答量:902
采纳率:0%
帮助的人:719万
展开全部
sux 和 suy 是什么?你要保存桌面场景的什么?
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
haokeyy
2010-04-14 · TA获得超过1487个赞
知道小有建树答主
回答量:1002
采纳率:0%
帮助的人:1141万
展开全部
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Private Const SRCCOPY = &HCC0020 ' (DWORD) dest = source

Private Sub Command1_Click()
Dim pic As PictureBox
Set pic = Me.Controls.Add("VB.PictureBox", "pic1")
pic.AutoRedraw = True
pic.BorderStyle = 0

Dim dc As Long
dc = GetDC(0)

Dim sux As Integer, suy As Integer
Dim picWidth As Integer, picHeight As Integer
sux = 300
suy = 300
picWidth = 300
picHeight = 300

pic.Width = picWidth * Screen.TwipsPerPixelX
pic.Height = picHeight * Screen.TwipsPerPixelY
Call BitBlt(pic.hdc, 0, 0, picWidth, picHeight, dc, sux, suy, vbSrcCopy)

'Me.AutoRedraw = True
'Set Me.Picture = pic.Image
SavePicture pic.Image, "c:\test.bmp"
ReleaseDC 0, dc
Me.Controls.Remove "pic1"
Set pic = Nothing
End Sub
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式