求vb的picture1怎么让图片旋转的代码

 我来答
你猜我猜哇擦猜
2015-07-29 · TA获得超过2.8万个赞
知道大有可为答主
回答量:2万
采纳率:0%
帮助的人:6645万
展开全部
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 Const srcopy = &HCC0020 Private Sub Form_Load() Picture2.Picture = LoadPicture(App.Path & "\a01.bmp") '导入图片 h = Picture1.Height w = Picture1.Width End Sub Private Sub Command1_Click() '旋转180度 Picture2.Picture = LoadPicture("") For j = 0 To h Step 1 For i = 0 To w Step 1 BitBlt Picture2.hDC, i, j, 1, 1, Picture1.hDC, w - i, h - j, srcopy Next i Next j End Sub Private Sub Command2_Click() '顺时针旋转90度 Picture2.Picture = LoadPicture("") For i = h To 0 Step -1 For j = 0 To w Step 1 BitBlt Picture2.hDC, i, j, 1, 1, Picture1.hDC, w - j, h - i, srcopy Next j Next i End Sub Private Sub Command3_Click() '逆时针旋转90度 Picture2.Picture = LoadPicture("") For j = w To 0 Step -1 For i = 0 To h Step 1 BitBlt Picture2.hDC, i, j, 1, 1, Picture1.hDC, j, i, srcopy Next i Next j End Sub Private Sub Command4_Click() '水平翻转 Picture2.Picture = LoadPicture("") For i = w To 0 Step -1 For j = 0 To h Step 1 BitBlt Picture2.hDC, i, j, 1, 1, Picture1.hDC, i, j, srcopy Next j Next i End Sub Private Sub Command5_Click() '垂直翻转 Picture2.Picture = LoadPicture("") For j = 0 To h Step 1 For i = 0 To w Step 1 BitBlt Picture2.hDC, i, j, 1, 1, Picture1.hDC, w - i, h - j, srcopy Next i Next j End Sub 不知道这样行不行 这是简单的固定角度的旋转的
追问
大哥,你写代码的时候是不用分行的吗?
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

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

类别

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

说明

0/200

提交
取消

辅 助

模 式