如何在VB.net中旋转RectangleShape?

时间:2011-08-03 04:21:06

标签: vb.net drawing

是否可以在VB.net中旋转矩形形状? 我的矩形形状的代码就是这个

baseDice.Parent = shapeContainer
baseDice.CornerRadius = 5
baseDice.Height = 50
baseDice.Width = 50
baseDice.BackColor = Color.Blue
baseDice.BackStyle = BackStyle.Opaque
baseDice.Left = 50
baseDice.Top = 50
baseDice.Name = "baseDice"

baseDiceMicrosoft.VisualBasic.PowerPacks.RecntangleShape

的对象

1 个答案:

答案 0 :(得分:1)

使用VB Class Matrix,这是一个例子

Dim myPen As New Pen(Color.Blue, 1)
Dim myPen2 As New Pen(Color.Red, 1)
e.Graphics.DrawRectangle(myPen, 150, 50, 200, 100)
Dim myMatrix As New Matrix()
myMatrix.Rotate(45, MatrixOrder.Append)
e.Graphics.Transform = myMatrix
e.Graphics.DrawRectangle(myPen2, 150, 50, 200, 100)

在Matrix.Rotate中,你给它一个角度和变换的类型(你可以使用Append来不断旋转一个角度)

是PaintEventArgs类型