最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
VB.NET中使用GDI画图具体应用。
时间:2022-07-02 11:31:15 编辑:袖梨 来源:一聚教程网
下面的例子通过重载Form1窗体的OnPaint()方法绘制GDI图形
Protected Overrides Sub onpaint(ByVal e As System.Windows.Forms.PaintEventArgs)
'/////////////绘制任意直线
Dim g As Graphics = e.Graphics
Dim mypen As Pen = New Pen(Color.Red, 2)
g.DrawLine(mypen, 100, 100, 10, 10)
'/////////////绘制矩形(任意直线构成的封闭图形)
Dim point1 As PointF = New PointF(100F, 100F)
Dim point2 As PointF = New PointF(200F, 100F)
Dim point3 As PointF = New PointF(200F, 200F)
Dim point4 As PointF = New PointF(100F, 200F)
Dim curvepoints As PointF() = {point1, point2, point3, point4}
g.DrawPolygon(New Pen(Color.Blue, 2), curvepoints)
'////////////文本表示
Dim FFamily As FontFamily = New FontFamily("Arial")
Dim font As Font = New Font(FFamily, "20", FontStyle.Bold, FontStyle.Italic, GraphicsUnit.Pixel)
Dim text As String = "I love you!"
Protected Overrides Sub onpaint(ByVal e As System.Windows.Forms.PaintEventArgs)
'/////////////绘制任意直线
Dim g As Graphics = e.Graphics
Dim mypen As Pen = New Pen(Color.Red, 2)
g.DrawLine(mypen, 100, 100, 10, 10)
'/////////////绘制矩形(任意直线构成的封闭图形)
Dim point1 As PointF = New PointF(100F, 100F)
Dim point2 As PointF = New PointF(200F, 100F)
Dim point3 As PointF = New PointF(200F, 200F)
Dim point4 As PointF = New PointF(100F, 200F)
Dim curvepoints As PointF() = {point1, point2, point3, point4}
g.DrawPolygon(New Pen(Color.Blue, 2), curvepoints)
'////////////文本表示
Dim FFamily As FontFamily = New FontFamily("Arial")
Dim font As Font = New Font(FFamily, "20", FontStyle.Bold, FontStyle.Italic, GraphicsUnit.Pixel)
Dim text As String = "I love you!"
相关文章
- 云星穹铁道权益升级怎么玩 云崩铁权益升级活动介绍 12-03
- 以闪亮之名山中绘梦怎么玩 以闪亮之名滢然花梦套装活动介绍 12-03
- 以闪亮之名绿野梦歌礼包怎么样 以闪亮之名绿野梦歌拍照礼包介绍 12-03
- 光遇12.6有什么更新 光遇12月6日更新内容介绍 12-03
- 伍六七暗影交锋测试资格怎么获得 伍六七暗影交锋内测资格获取方法 12-03
- 无限暖暖晶莹诗集怎么样 12-03