重慶分公司,新征程啟航
為企業提供網站建設、域名注冊、服務器等服務
為企業提供網站建設、域名注冊、服務器等服務
分類: 電腦/網絡 程序設計 其他編程語言枝渣改
思禮網站制作公司哪家好,找成都創新互聯!從網頁設計、網站建設、微信開發、APP開發、成都響應式網站建設等網站項目制作,到程序開發,運營維護。成都創新互聯從2013年創立到現在10年的時間,我們擁有了豐富的建站經驗和運維經驗,來保證我們的工作的順利進行。專注于網站建設就選成都創新互聯。
問題描述:
VB6中的form1.circle (100,200),rgb(0,255,0)的語句如何在VB中使用啊?
急用啊!梁早!!!!!!!
解析:
VB與VB不同。
VB已經有專門繪圖的類。
可以定義筆刷然后用Drawing類中的方法繪猛判制。
Private Sub DrawEllipse()
Dim myPen As New System.Drawing.Pen(System.Drawing.Color.Red)
Dim formGraphics as System.Drawing.Graphics
formGraphics = Me.CreateGraphics()
formGraphics.DrawEllipse(myPen, New Rectangle(0,0,200,300))
myPen.Dispose()
formGraphics.Dispose()
End Sub
Private Sub DrawRectangle()
Dim myPen As New System.Drawing.Pen(System.Drawing.Color.Red)
Dim formGraphics as System.Drawing.Graphics
formGraphics = Me.CreateGraphics()
formGraphics.DrawRectangle(myPen, New Rectangle(0,0,200,300))
myPen.Dispose()
formGraphics.Dispose()
End Sub
下面的例子通過重載Form 窗體的OnPaint()方法繪制GDI圖形Protected Overrides Sub onpaint(ByVal e As System Windows Forms PaintEventArgs)注釋 /////////////繪制任意直線Dim g As Graphics = e GraphicsDim mypen As Pen = New Pen(Color Red )g DrawLine(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 }g DrawPolygon(New Pen(Color Blue ) curvepoints)注釋 ////////////文本表示Dim FFamily As FontFamily = New FontFamily( Arial )Dim font As Font = New Font(FFamily 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( )e Graphics DrawString(text font solidbrush pr)注釋攔橘 ////////////平面繪制燃差Dim rec As RectangleF = New RectangleF( )g DrawPie(mypen rec )注釋 ///////////封閉圖形 應該是個圓g DrawClosedCurve(mypen curvepoints Drawing Drawing D FillMode Alternate)注釋 ///////////大家自己試試看吧g DrawArc(mypen )g DrawCurve(mypen curvepoints)g DrawBezier(mypen )g DrawBeziers(mypen curvepoints)注釋 //////////這可是一個圓Dim rec As RectangleF = New RectangleF( )g DrawEllipse(mypen rec )注釋 //////////這是一個橢圓簡段團Dim rec As RectangleF = New RectangleF( )g DrawEllipse(mypen rec )End Sub 這些是我自己試驗出來的 當然了 還有好多 我只是開了一個頭 大家要是發現什么好東東 別忘了通知一下 ) lishixinzhi/Article/program/net/201311/11800
這問題有點籠統,軟旁跡胡糖來說說把:
圖像處理由System.Drawing命名空間負責。
主要是Bitmap類和Graphics類。
Bitmap表示一個位圖,可以是BMP,JPG,PNG等文件。
裝載位圖
Dim?位圖?As?Bitmap?=?Bitmap.FromFile("C:\Image1.PNG")
Graphics表示一州悔張畫紙,能夠進行繪制操作。
它可以被窗體、控件、位圖調用CreateGraphics()方法來創建。
然后調用Graphics.Draw開頭的一系列函數來繪制圖像和圖形,Fill開頭的填充圖形。
創建畫紙并繪制位圖
Dim?畫紙?As?Graphics?=?Me.CreateGraphics()
畫紙.DrawImage(位圖,?100,?100,?256,?256)
可以將上面三行放到Form1_Load中測試運攔,把路徑改一下,
還可以把Me改為能在上面繪圖的控件的名稱。
更多內容請看MSDN的System.Drawing命名空間。
如滿意,請采納,謝謝。