在VB中怎样将PictureBox内显示的内容(包括里边的控件)保存为图片文件?
1个回答
展开全部
Private Declare Function GetDC Lib "user32" (ByVal hWnd As Long) As Long
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 ReleaseDC Lib "user32" (ByVal hWnd As Long, ByVal hdc As Long) As Long
Private Sub Command1_Click()
Dim hdc As Long
hdc = GetDC(0)
BitBlt Picture2.hdc, 0, 0, Me.Picture1.Width, Picture1.Height, hdc, Me.Left / 15 + 8 + Picture1.Left, Me.Top / 15 + 30 + Me.Picture1.Top, vbSrcCopy
ReleaseDC 0, hdc
End Sub一个按钮 两个picturebox
不知你有没有边框。。我这个是加了边框的(边框就是标题栏什么的。。)不加边框的话把8,30去掉即可。。
还有假如是.net的改的就多了。。不知需要否。。
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 ReleaseDC Lib "user32" (ByVal hWnd As Long, ByVal hdc As Long) As Long
Private Sub Command1_Click()
Dim hdc As Long
hdc = GetDC(0)
BitBlt Picture2.hdc, 0, 0, Me.Picture1.Width, Picture1.Height, hdc, Me.Left / 15 + 8 + Picture1.Left, Me.Top / 15 + 30 + Me.Picture1.Top, vbSrcCopy
ReleaseDC 0, hdc
End Sub一个按钮 两个picturebox
不知你有没有边框。。我这个是加了边框的(边框就是标题栏什么的。。)不加边框的话把8,30去掉即可。。
还有假如是.net的改的就多了。。不知需要否。。
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询