vb.net

位置:IT落伍者 >> vb.net >> 浏览文章

用VB.NET绘制GDI图形


发布日期:2019年04月10日
 
用VB.NET绘制GDI图形
下面的例子通过重载Form窗体的OnPaint()方法绘制GDI图形

Protected Overrides Sub onpaint(ByVal e As SystemWindowsFormsPaintEventArgs)

注释/////////////绘制任意直线

Dim g As Graphics = eGraphics

Dim mypen As Pen = New Pen(ColorRed )

gDrawLine(mypen )

注释/////////////绘制矩形(任意直线构成的封闭图形)

Dim point As PointF = New PointF(F F)

Dim point As PointF = New PointF(F F)

Dim point As PointF = New PointF(F F)

Dim point As PointF = New PointF(F F)

Dim curvepoints As PointF() = {point point point point}

gDrawPolygon(New Pen(ColorBlue ) curvepoints)

注释////////////文本表示

Dim FFamily As FontFamily = New FontFamily(Arial)

Dim font As Font = New Font(FFamily FontStyleBold FontStyleItalic GraphicsUnitPixel)

Dim text As String = I love you!

Dim solidbrush As SolidBrush = New SolidBrush(ColorRed)

Dim pr As PointF = New PointF( )

eGraphicsDrawString(text font solidbrush pr)

注释////////////平面绘制

Dim rec As RectangleF = New RectangleF( )

gDrawPie(mypen rec )

注释///////////封闭图形应该是个圆

gDrawClosedCurve(mypen curvepoints DrawingDrawingDFillModeAlternate)

注释///////////大家自己试试看吧

gDrawArc(mypen )

gDrawCurve(mypen curvepoints)

gDrawBezier(mypen )

gDrawBeziers(mypen curvepoints)

注释//////////这可是一个圆

Dim rec As RectangleF = New RectangleF( )

gDrawEllipse(mypen rec)

注释//////////这是一个椭圆

Dim rec As RectangleF = New RectangleF( )

gDrawEllipse(mypen rec)

End Sub

这些是我自己试验出来的当然了还有好多我只是开了一个头大家要是发现什么好东东别忘了通知一下

上一篇:罕见的VB.NET复制删除文件完整示例

下一篇:如何应用VB.NET MonthCalendar控件