如何使用vb.net在Windows窗体上旋转PictureBox

use*_*035 6 vb.net

当满足if语句中的条件时,我需要将图片框旋转180度.这可能吗?

Tho*_*mas 9

我假设你想要在里面旋转图像,因为旋转盒子本身没有多大意义(无论如何都是不可能的).

试试这个:

myPictureBox.Image.RotateFlip(RotateFlipType.Rotate180FlipNone);
Run Code Online (Sandbox Code Playgroud)


小智 5

PictureBox1.Image.RotateFlip(RotateFlipType.Rotate180FlipNone)
PictureBox1.Refresh()
Run Code Online (Sandbox Code Playgroud)

当您尝试使用以下方法旋转图像时:

PictureBox1.Image.RotateFlip(RotateFlipType.Rotate180FlipNone)
Run Code Online (Sandbox Code Playgroud)

在关闭表单并再次打开它(不是项目,只是表单)之前,什么都不会发生。如果您想立即旋转,那么您应该使用PictureBox1.Refresh().