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