LinearGradientBrush.RotateTransform 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将局部几何转换旋转指定大小。 此方法预先计算对转换的旋转。
重载
RotateTransform(Single) |
将局部几何转换旋转指定大小。 此方法预先计算对转换的旋转。 |
RotateTransform(Single, MatrixOrder) |
将局部几何转换以指定顺序旋转指定量。 |
RotateTransform(Single)
- Source:
- LinearGradientBrush.cs
- Source:
- LinearGradientBrush.cs
- Source:
- LinearGradientBrush.cs
将局部几何转换旋转指定大小。 此方法预先计算对转换的旋转。
public:
void RotateTransform(float angle);
public void RotateTransform (float angle);
member this.RotateTransform : single -> unit
Public Sub RotateTransform (angle As Single)
参数
- angle
- Single
旋转角度。
示例
有关示例,请参见 RotateTransform。
适用于
RotateTransform(Single, MatrixOrder)
- Source:
- LinearGradientBrush.cs
- Source:
- LinearGradientBrush.cs
- Source:
- LinearGradientBrush.cs
将局部几何转换以指定顺序旋转指定量。
public:
void RotateTransform(float angle, System::Drawing::Drawing2D::MatrixOrder order);
public void RotateTransform (float angle, System.Drawing.Drawing2D.MatrixOrder order);
member this.RotateTransform : single * System.Drawing.Drawing2D.MatrixOrder -> unit
Public Sub RotateTransform (angle As Single, order As MatrixOrder)
参数
- angle
- Single
旋转角度。
- order
- MatrixOrder
一个 MatrixOrder,它指定是在后面追加旋转矩阵还是在前面添加旋转矩阵。
示例
下面的代码示例旨在与 Windows 窗体 一起使用,它需要 PaintEventArgse
事件OnPaint对象。 代码
创建一个新的 LinearGradientBrush。
使用此画笔在屏幕上绘制一个椭圆。
LinearGradientBrush通过调用 RotateTransform 方法旋转 45 度。
使用旋转画笔将椭圆绘制到屏幕正下方的第一个椭圆。
请注意,下椭圆的渐变与上椭圆的 x 轴呈 45 度角。 另请注意,调用 TranslateTransform 方法用于使渐变填充的左边缘与下椭圆的左边缘对齐。
private:
void RotateTransformExample( PaintEventArgs^ e )
{
// Create a LinearGradientBrush.
Rectangle myRect = Rectangle(20,20,200,100);
LinearGradientBrush^ myLGBrush = gcnew LinearGradientBrush( myRect,Color::Blue,Color::Red,0.0f,true );
// Draw an ellipse to the screen using the LinearGradientBrush.
e->Graphics->FillEllipse( myLGBrush, myRect );
// Rotate the LinearGradientBrush.
myLGBrush->RotateTransform( 45.0f, MatrixOrder::Prepend );
// Rejustify the brush to start at the left edge of the ellipse.
myLGBrush->TranslateTransform( -100.0f, 0.0f );
// Draw a second ellipse to the screen using
// the transformed brush.
e->Graphics->FillEllipse( myLGBrush, 20, 150, 200, 100 );
}
private void RotateTransformExample(PaintEventArgs e)
{
// Create a LinearGradientBrush.
Rectangle myRect = new Rectangle(20, 20, 200, 100);
LinearGradientBrush myLGBrush = new LinearGradientBrush(
myRect, Color.Blue, Color.Red, 0.0f, true);
// Draw an ellipse to the screen using the LinearGradientBrush.
e.Graphics.FillEllipse(myLGBrush, myRect);
// Rotate the LinearGradientBrush.
myLGBrush.RotateTransform(45.0f, MatrixOrder.Prepend);
// Rejustify the brush to start at the left edge of the ellipse.
myLGBrush.TranslateTransform(-100.0f, 0.0f);
// Draw a second ellipse to the screen using
// the transformed brush.
e.Graphics.FillEllipse(myLGBrush, 20, 150, 200, 100);
}
Public Sub RotateTransformExample(ByVal e As PaintEventArgs)
' Create a LinearGradientBrush.
Dim myRect As New Rectangle(20, 20, 200, 100)
Dim myLGBrush As New LinearGradientBrush(myRect, Color.Blue, _
Color.Red, 0.0F, True)
' Draw an ellipse to the screen using the LinearGradientBrush.
e.Graphics.FillEllipse(myLGBrush, myRect)
' Rotate the LinearGradientBrush.
myLGBrush.RotateTransform(45.0F, MatrixOrder.Prepend)
' Rejustify the brush to start at the left edge of the ellipse.
myLGBrush.TranslateTransform(-100.0F, 0.0F)
' Draw a second ellipse to the screen using the transformed brush.
e.Graphics.FillEllipse(myLGBrush, 20, 150, 200, 100)
End Sub
适用于
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈