自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

迅速掌握VB.NET操作GDI圖形

開發(fā) 后端
VB.NET操作GDI圖形的操作方法有很多種,運用VB.NET對這一類型的圖像進行操作,可以幫助開發(fā)人員輕松的完成各種功能需求。

VB.NET編程語言在對圖形的操作上可以體現(xiàn)出其全面和靈活性。我們可以通過VB.NET操作GDI圖形的相關操作方法和實現(xiàn)的功能來對這一方面的知識進行一個系統(tǒng)的認識,了解VB.NET在操作中的簡便靈活性。#t#

下面的例子通過重載Form1窗體的OnPaint()方法繪制GDI圖形

  1. Protected Overrides Sub onpaint
    (ByVal e As System.Windows.
    Forms.PaintEventArgs) 

注釋://///////////VB.NET操作GDI圖形繪制任意直線

  1. Dim g As Graphics = 
    e.Graphics  
  2. Dim mypen As Pen = 
    New Pen(Color.Red, 2)  
  3. g.DrawLine(mypen, 
    100, 100, 10, 10) 

注釋://///////////繪制矩形(任意直線構成的封閉圖形)

  1. Dim point1 As PointF = 
    New PointF(100F, 100F)  
  2. Dim point2 As PointF = 
    New PointF(200F, 100F)  
  3. Dim point3 As PointF = 
    New PointF(200F, 200F)  
  4. Dim point4 As PointF = 
    New PointF(100F, 200F)  
  5. Dim curvepoints As PointF() 
    = {point1, point2,
     point3, point4}  
  6. g.DrawPolygon(New 
    Pen(Color.Blue, 2), 
    curvepoints) 

注釋:////////////VB.NET操作GDI圖形文本表示

  1. Dim FFamily As FontFamily = 
    New FontFamily("Arial")  
  2. Dim font As Font = New Font
    (FFamily, "20", FontStyle.
    Bold, FontStyle.Italic, 
    GraphicsUnit.Pixel)  
  3. Dim text As String =
     
    "I love you!" 
  4. Dim solidbrush As SolidBrush 
    New SolidBrush(Color.Red)  
  5. Dim pr As PointF = 
    New PointF(100, 10)  
  6. e.Graphics.DrawString
    (text, font, solidbrush, pr) 

注釋:////////////VB.NET操作GDI圖形平面繪制

  1. Dim rec As RectangleF = 
    New RectangleF(10, 10, 
    200, 100)  
  2. g.DrawPie(mypen, rec, 
    150, 150) 

注釋:///////////封閉圖形,0.7應該是個圓

  1. g.DrawClosedCurve(mypen, 
    curvepoints, 0.7, Drawing.
    Drawing2D.FillMode.Alternate) 

注釋:///////////大家自己試試看吧

  1. g.DrawArc(mypen, 300, 300, 
    200, 200, 100, 100)  
  2. g.DrawCurve(mypen, curvepoints)  
  3. g.DrawBezier(mypen, 50, 50, 
    100, 50, 100, 100, 50, 100)  
  4. g.DrawBeziers(mypen, curvepoints) 

注釋://////////這可是一個圓

  1. Dim rec1 As RectangleF = 
    New RectangleF(10, 10, 100, 100)  
  2. g.DrawEllipse(mypen, rec1) 

注釋://////////這是一個橢圓

  1. Dim rec2 As RectangleF = 
    New RectangleF(10, 10, 200, 100)  
  2. g.DrawEllipse(mypen, rec2)  
  3. End Sub  

VB.NET操作GDI圖形的各種操作技巧就為大家介紹到這里。

責任編輯:曹凱 來源: 博客園
相關推薦

2010-01-11 14:28:14

VB.NET操作Exc

2009-10-29 13:38:05

VB.NET Shar

2010-01-07 11:07:20

VB.NET讀取INI

2009-10-16 10:36:35

VB.NET繪制GDI

2009-10-30 16:40:04

VB.NET Inte

2010-01-11 10:34:41

VB.NET圖像操作

2010-01-08 18:10:44

VB.NET實現(xiàn)任務欄

2010-01-11 15:54:48

VB.NET操作縮放圖

2009-10-29 09:06:26

VB.NET Web

2010-01-22 18:08:18

VB.NET與GDI結

2011-05-20 16:56:11

VB.NETGDI

2009-10-29 14:16:32

VB.NET讀寫文本文

2010-01-13 17:47:59

VB.NET拖放

2010-01-14 13:59:01

2010-01-08 18:16:52

VB.NET變量

2009-10-09 16:54:03

VB.NET窗體

2009-11-02 10:42:04

VB.NET EXCE

2010-01-18 19:36:52

VB.NET調(diào)整控件

2009-10-27 14:50:25

VB.NET控件數(shù)組

2009-11-10 13:43:28

VB.NET Comm
點贊
收藏

51CTO技術棧公眾號