新聞中心
在向大家詳細介紹用VB.NET繪制GDI圖形之前,首先讓大家了解下VB.NET是什么,然后全面介紹VB.NET繪制GDI圖形。

創(chuàng)新互聯(lián)是網(wǎng)站建設(shè)專家,致力于互聯(lián)網(wǎng)品牌建設(shè)與網(wǎng)絡(luò)營銷,專業(yè)領(lǐng)域包括成都網(wǎng)站設(shè)計、做網(wǎng)站、電商網(wǎng)站制作開發(fā)、成都小程序開發(fā)、微信營銷、系統(tǒng)平臺開發(fā),與其他網(wǎng)站設(shè)計及系統(tǒng)開發(fā)公司不同,我們的整合解決方案結(jié)合了恒基網(wǎng)絡(luò)品牌建設(shè)經(jīng)驗和互聯(lián)網(wǎng)整合營銷的理念,并將策略和執(zhí)行緊密結(jié)合,且不斷評估并優(yōu)化我們的方案,為客戶提供全方位的互聯(lián)網(wǎng)品牌整合方案!
Visual Basic.NET是基于微軟.NET Framework之上的面向?qū)ο蟮闹虚g解釋性語言,可以看作是Visual Basic在.Net Framework平臺上的升級版本,增強了對面向?qū)ο蟮闹С?。但由于改動太大,?dǎo)致VB.net對VB的向后兼容性不好,在業(yè)界引起不小的爭議。
大多的VB.Net程序員使用Visual Studio .Net作為IDE(integrated development environment). SharpDevelop是另一種可用的開源的IDE。VB.Net需要在.Net Framework平臺上才能執(zhí)行。 VB.NET的主頁http://msdn.microsoft.com/vbasic
用VB.NET繪制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)
- '繪制矩形(任意直線構(gòu)成的封閉圖形)
- 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!"
- Dim solidbrush As SolidBrush = New SolidBrush(Color.Red)
- Dim pr As PointF = New PointF(100, 10)
- e.Graphics.DrawString(text, font, solidbrush, pr)
- '平面繪制
- Dim rec As RectangleF = New RectangleF(10, 10, 200, 100)
- g.DrawPie(mypen, rec, 150, 150)
- '封閉圖形,0.7應(yīng)該是個圓
- g.DrawClosedCurve(mypen, curvepoints, 0.7,
- Drawing.Drawing2D.FillMode.Alternate)
- '大家自己試試看吧
- g.DrawArc(mypen, 300, 300, 200, 200, 100, 100)
- g.DrawCurve(mypen, curvepoints)
- g.DrawBezier(mypen, 50, 50, 100, 50, 100, 100, 50, 100)
- g.DrawBeziers(mypen, curvepoints)
- '這可是一個圓
- Dim rec1 As RectangleF = New RectangleF(10, 10, 100, 100)
- g.DrawEllipse(mypen, rec1)
- '這是一個橢圓
- Dim rec2 As RectangleF = New RectangleF(10, 10, 200, 100)
- g.DrawEllipse(mypen, rec2)
- End Sub
以上介紹VB.NET繪制GDI圖形,這些是我自己試驗出來的,當(dāng)然了,還有好多,我只是開了一個頭,大家要是發(fā)現(xiàn)什么好東東,別忘了通知一下。
標題名稱:淺析VB.NET繪制GDI圖形的方法
文章出自:http://www.5511xx.com/article/cociooc.html


咨詢
建站咨詢
