老师现在又出现了一种报错,原始图片为横向显示的,
msgbox显示为:"方向 :1"
出现报错内容:
.NET Framework 版本:2.0.50727.9035
Foxtable 版本:2018.10.9.1
错误所在事件:窗口,上传永久素材,图片旋转,Click
详细错误信息:
GDI+ 中发生一般性错误。
我的代码如下:
Dim pbx As WinForm.PictureBox = e.form.Controls("PictureBox3")
Dim pth as string = ProjectPath & "Attachments\wx_images_tptw\"
Dim bh1 As String = "100.png"
If FileSys.FileExists(pth & bh1) Then
Dim bmp As Image = Image.FromFile(pth & bh1)
Dim pt As PropertyItem() = bmp.PropertyItems
For i As Integer = 0 To pt.Length - 1
Dim p As PropertyItem = pt(i)
Select Case pt(i).Id
Case 274
Dim s = p.value(0)
msgbox("方向: " & s)
Select Case s
Case 2
bmp.RotateFlip(RotateFlipType.RotateNoneFlipX)
Case 3
bmp.RotateFlip(RotateFlipType.Rotate180FlipNone)
Case 4
bmp.RotateFlip(RotateFlipType.RotateNoneFlipY)
Case 5
bmp.RotateFlip(RotateFlipType.Rotate90FlipX)
Case 6
bmp.RotateFlip(RotateFlipType.Rotate90FlipNone)
Case 7
bmp.RotateFlip(RotateFlipType.Rotate270FlipX)
Case 8
bmp.RotateFlip(RotateFlipType.Rotate270FlipNone)
End Select
End Select
Next
bmp.save(pth & bh1)
pbx.image = GetImage(pth & bh1)
End If