- Dim mypen As New Pen(Color.Red, 10) '定义以红色为线条,10个像素粗的画笔对象
- Dim g As Graphics = Me.CreateGraphics
- g.DrawEllipse(mypen, 10, 10, 100, 100) '画正圆
- '---------------------------------
- Dim mypen As New Pen(Color.blue, 10) '定义以蓝色为线条的画笔对象
- Dim g As Graphics = Me.CreateGraphics
- g.DrawEllipse(mypen, 10, 10, 100, 200) '画椭圆
- '---------------------------------
- 最大限度的填充一个黄色的椭圆
- Dim mybrush As New SolidBrush(Color.Yellow)
- Dim g As Graphics = Me.CreateGraphics
- g.FillEllipse(mybrush, ClientRectangle)
- '--------------------------------
- 直接在窗体上绘制文本
- Dim afont As New System.Drawing.Font("arial", 22, FontStyle.Bold)
- Dim g As Graphics = Me.CreateGraphics
- g.DrawString("Graphics are fun!", afont, Brushes.Brown, 20, 10)
- g.DrawString("Keenweiwei!", afont, Brushes.BlueViolet, 40, 40)
- '--------------------------
- 旋转文本
- 'g.RotateTransform(20) '顺时针旋转20度
- 'g.DrawString("Tuo JINGJING!", afont, Brushes.DeepPink, 100, 40)
- g.RotateTransform(-20) '逆时针旋转20度
- g.DrawString("Tuo JINGJING!", afont, Brushes.DeepPink, 40, 150)
画笔对象,画刷对象
最新推荐文章于 2022-03-23 23:40:08 发布