Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/274.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 旋转按钮中的图像_C# - Fatal编程技术网

C# 旋转按钮中的图像

C# 旋转按钮中的图像,c#,C#,我想旋转一个完整的按钮,在同一时间内的图像。 我用这个代码向左旋转我的按钮 int y = button1.Size.Width; //i'm taking position y int x = button1.Height; //i'm taking position x button1.Size = new Size((x+y)-y , (x + y) - x); //now i rotate it 但里面的图像保持不变。 如何使用按钮同时旋转内部图像。如何拍摄图像位置。

我想旋转一个完整的按钮,在同一时间内的图像。 我用这个代码向左旋转我的按钮

 int y = button1.Size.Width; //i'm taking  position y
 int x = button1.Height;     //i'm taking  position x
 button1.Size = new Size((x+y)-y , (x + y) - x); //now i rotate it
但里面的图像保持不变。 如何使用按钮同时旋转内部图像。如何拍摄图像位置。(我的意思是它是否旋转)

使用此技术:
按钮1.Image.RotateFlip((RotateFlipType.Rotate90FlipXY))

你并不是真的在旋转按钮,你只是在改变宽度和高度。你可以用WPF,但不能用WinForms。如果适用,请将“winforms”指定为标记。以下是在winforms中旋转图像的一些答案:--但是旋转整个控件可能超出框架所能承受的范围。它是否足以支持0/90/180/270度的旋转?然后我建议只提供2-4个预旋转版本的图像,并在更改按钮大小时重新指定图像属性。@dlatikay:但是这些旋转在运行时非常简单有效,并且不会在过程中引入失真,可能比从磁盘读取额外图像还要快。分配
Image
属性时,只需调用
RotateFlip
方法。