在VB中怎样将PictureBox内显示的内容(包括里边的控件)保存为图片文件?
展开全部
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的改的就多了。。不知需要否。。
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
网易云信
2023-12-06 广告
2023-12-06 广告
UIkit是一套轻量级、模块化且易于使用的开源UI组件库,由YOOtheme团队开发。它提供了丰富的界面元素,包括按钮、表单、表格、对话框、滑块、下拉菜单、选项卡等等,适用于各种类型的网站和应用程序。UIkit还支持响应式设计,可以根据不同...
点击进入详情页
本回答由网易云信提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询