在vb中如何旋转图片?
一个picturebox读入一张jpg图,如何在这个picturebox中实现jpg图90度和180度旋转?...
一个picturebox读入一张jpg图,如何在这个picturebox中实现jpg图90度和180度旋转?
展开
2个回答
展开全部
逆时针旋转90度
Dim p()
ScaleMode = 3
Picture1.AutoRedraw = True
Picture1.ScaleMode = 3
w = Picture1.ScaleWidth
h = Picture1.ScaleHeight
ReDim p(w - 1, h - 1)
For i = 0 To w - 1
For j = 0 To h - 1
p(i, j) = Picture1.Point(i, j)
Next j
Next i
Picture1.Width = h + 4 * Picture1.BorderStyle
Picture1.Height = w + 4 * Picture1.BorderStyle
For i = 0 To h - 1
For j = 0 To w - 1
Picture1.PSet (i, w - j - 1), p(j, i)
Next j
Next i
顺时针旋转90度把Picture1.PSet (i, w - j - 1), p(j, i)
改为Picture1.PSet (h - i - 1, j), p(j, i)
旋转180度把最后七行改为
For i = 0 To w - 1
For j = 0 To h - 1
Picture1.PSet (i, j), p(w - i - 1, h - j - 1)
Next j
Next i
Dim p()
ScaleMode = 3
Picture1.AutoRedraw = True
Picture1.ScaleMode = 3
w = Picture1.ScaleWidth
h = Picture1.ScaleHeight
ReDim p(w - 1, h - 1)
For i = 0 To w - 1
For j = 0 To h - 1
p(i, j) = Picture1.Point(i, j)
Next j
Next i
Picture1.Width = h + 4 * Picture1.BorderStyle
Picture1.Height = w + 4 * Picture1.BorderStyle
For i = 0 To h - 1
For j = 0 To w - 1
Picture1.PSet (i, w - j - 1), p(j, i)
Next j
Next i
顺时针旋转90度把Picture1.PSet (i, w - j - 1), p(j, i)
改为Picture1.PSet (h - i - 1, j), p(j, i)
旋转180度把最后七行改为
For i = 0 To w - 1
For j = 0 To h - 1
Picture1.PSet (i, j), p(w - i - 1, h - j - 1)
Next j
Next i
墨刀Modao
2024-12-06 广告
2024-12-06 广告
在制作原型图时,可以选择多种软件工具来满足不同的需求和偏好。以下是一些常见的原型图软件:墨刀 :墨刀是一款在线原型设计工具,界面友好,易于上手,适合产品经理快速创建移动应用和网页的低保真原型。其协作功能便于团队实时共享设计和反馈。Sketc...
点击进入详情页
本回答由墨刀Modao提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询