VB.NET中的BitBlt 问题 50

PublicClassForm1ConstNOTSRCCOPY=&H33008ConstNOTSRCERASE=&H1100A6PrivateConstSRCAND=&H... Public Class Form1
Const NOTSRCCOPY = &H33008
Const NOTSRCERASE = &H1100A6
Private Const SRCAND = &H8800C6
Private Const SRCCOPY = &HCC0020
Private Const SRCERASE = &H440328
Private Const SRECINVERT = &HEE0086
Private Declare Sub Sleep Lib "Kernel32" (ByVal dwMilliseconds 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 Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim ret As Long
Dim hdc2 As IntPtr
Dim hdc1 As IntPtr
Dim i, j As Integer
hdc2 = Me.PictureBox2.CreateGraphics.GetHdc
hdc1 = Me.PictureBox1.CreateGraphics.GetHdc
Dim w As Integer
Dim h As Integer
w = Me.PictureBox1.Size.Width
h = Me.PictureBox1.Size.Height
i = w / 2
j = h / 2
While (i > 0)
ret = BitBlt(hdc2, i, j, w - 2 * i, h - 2 * j, hdc1, i, j, SRCCOPY)
i = i - 2
j = j - 2 * h / w
End While
Me.Text = ret
End Sub

函数执行成功 可是PIctureBox2就是不显示图形 求助高手啊。。。。急
展开
 我来答
lwjohn
2017-10-03
知道答主
回答量:35
采纳率:0%
帮助的人:5.4万
展开全部
可能这是我见过的最成功VBnet的BITBLT示例。
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.PictureBox1.Image = Image.FromFile("E:\程序语言\VBpic\输入文件名.BMP")
End Sub
运行,点击你的Button2按钮(窗体Form1上加两个图片框和一个命令按钮搞成Button2)
PictureBox2就有受控的图片出来了。
百度网友d1855349d
2009-09-22 · TA获得超过430个赞
知道小有建树答主
回答量:425
采纳率:0%
帮助的人:0
展开全部
试试PictureBox1.Refresh()
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 1条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

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

类别

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

说明

0/200

提交
取消

辅 助

模 式