Foxtable(狐表)用户栏目专家坐堂 → 请教:窗口查看PDF文件时,如何实现左转或右转(旋转)?


  共有3105人关注过本帖树形打印复制链接

主题:请教:窗口查看PDF文件时,如何实现左转或右转(旋转)?

帅哥哟,离线,有人找我吗?
有点蓝
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110574 积分:562760 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/10/11 16:38:00 [显示全部帖子]

Dim pic As WinForm.PictureBox = e.Form.Controls("PictureBox1")
Dim img As Image = pic.Image
Dim degree = 90
Dim ImgTarget As Bitmap
Dim alpha As Double = (degree / 180) * math.PI

Dim iWidth As Integer = img.Width * Math.Cos(alpha) + img.Height * Math.Sin(alpha)
Dim iHeight As Integer = img.Width * Math.Sin(alpha) + img.Height * Math.Cos(alpha)

ImgTarget = New Bitmap(iWidth, iHeight, Drawing.Imaging.PixelFormat.Format24bppRgb)
Dim g As Graphics
g = Graphics.FromImage(ImgTarget)

g.TranslateTransform(img.Height * Math.Sin(alpha), 0)

g.RotateTransform(degree)
'ImgTarget.MakeTransparent(ImgTarget.GetPixel(1, 1))
g.DrawImage(img, New Rectangle(0, 0, img.Width, img.Height))
pic.Image = ImgTarget

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110574 积分:562760 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/10/11 22:28:00 [显示全部帖子]


Dim pic As WinForm.PictureBox = e.Form.Controls("PictureBox1")
Dim img As Image = pic.Image
Dim degree = 270
Dim ImgTarget As Bitmap
Dim alpha As Double = ((degree - 180) / 180) * math.PI

Dim iWidth As Integer = img.Width * Math.Cos(alpha) + img.Height * Math.Sin(alpha)
Dim iHeight As Integer = img.Width * Math.Sin(alpha) + img.Height * Math.Cos(alpha)

ImgTarget = New Bitmap(iWidth, iHeight, Drawing.Imaging.PixelFormat.Format24bppRgb)
Dim g As Graphics
g = Graphics.FromImage(ImgTarget)

g.TranslateTransform(img.Width * Math.Cos(alpha), iHeight)

g.RotateTransform(degree)
'ImgTarget.MakeTransparent(ImgTarget.GetPixel(1, 1))
g.DrawImage(img, New Rectangle(0, 0, img.Width, img.Height))

pic.Image = ImgTarget

 回到顶部