vb.net系統(tǒng)屏幕畫圖 vbs編寫圖形窗口

VB.net中如何畫圖?

分類: 電腦/網(wǎng)絡(luò) 程序設(shè)計 其他編程語言

新蔡網(wǎng)站制作公司哪家好,找成都創(chuàng)新互聯(lián)!從網(wǎng)頁設(shè)計、網(wǎng)站建設(shè)、微信開發(fā)、APP開發(fā)、成都響應(yīng)式網(wǎng)站建設(shè)公司等網(wǎng)站項目制作,到程序開發(fā),運營維護。成都創(chuàng)新互聯(lián)2013年至今到現(xiàn)在10年的時間,我們擁有了豐富的建站經(jīng)驗和運維經(jīng)驗,來保證我們的工作的順利進行。專注于網(wǎng)站建設(shè)就選成都創(chuàng)新互聯(lián)。

問題描述:

VB6中的form1.circle (100,200),rgb(0,255,0)的語句如何在VB中使用???

急用?。。。。。。。?!

解析:

VB與VB不同。

VB已經(jīng)有專門繪圖的類。

可以定義筆刷然后用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

vb.net桌面中bitmap類如何直接繪制到屏幕?

可以直接顯示的。你看下面的示例,使用vb.net畫的齒輪:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

b = New Bitmap(PictureBox1.Width, PictureBox1.Height)

g = Graphics.FromImage(b)

'g.RotateTransform(90)

g.Clear(Color.White)

g.TranslateTransform(PictureBox1.Width / 2, PictureBox1.Height / 2)

g.ScaleTransform(1, -1)

'g.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias

g.SmoothingMode = Drawing2D.SmoothingMode.HighQuality

DrawCL(g, New PointF(Val(TextBox1.Text), Val(TextBox2.Text)), Val(TextBox3.Text), Val(TextBox4.Text), Val(TextBox5.Text), Val(TextBox6.Text), Val(TextBox7.Text), Val(TextBox8.Text), Val(TextBox9.Text))

DrawCL(g, New PointF(Val(TextBox18.Text), Val(TextBox17.Text)), Val(TextBox16.Text), Val(TextBox15.Text), Val(TextBox14.Text), Val(TextBox13.Text), Val(TextBox12.Text), Val(TextBox11.Text), Val(TextBox10.Text))

PictureBox1.Image = b

End Sub

vb.net繪圖問題

代碼:

Public?Class?Form1

'*********************************************************************???

'作者:章魚哥,QQ:3107073263?群:309816713???????

'如有疑問或好的建議請聯(lián)系我,大家一起進步?????

'*********************************************************************?????

'繪制圓角矩形函數(shù)

Private?Function?GetRoundedRectPath(ByVal?rect?As?Rectangle,?ByVal?radius?As?Integer)?As?System.Drawing.Drawing2D.GraphicsPath

rect.Offset(-1,?-1)

Dim?RoundRect?As?New?Rectangle(rect.Location,?New?Size(radius?-?1,?radius?-?1))

Dim?path?As?New?System.Drawing.Drawing2D.GraphicsPath

path.AddArc(RoundRect,?180,?90)?????'左上角

RoundRect.X?=?rect.Right?-?radius???'右上角

path.AddArc(RoundRect,?270,?90)

RoundRect.Y?=?rect.Bottom?-?radius??'右下角

path.AddArc(RoundRect,?0,?90)

RoundRect.X?=?rect.Left?????????????'左下角

path.AddArc(RoundRect,?90,?90)

path.CloseFigure()

Return?path

End?Function

'繪制矩形

Private?Sub?DrawingRect()

Dim?g?As?Graphics?=?Me.CreateGraphics

Dim?Pen?As?New?Pen(Brushes.DarkRed,?2)

Dim?Hei?As?Integer?=?Me.Height

Dim?Wid?As?Integer?=?Me.Width

'矩形的位置和長寬隨著窗體的變化而改變

Dim?Rec?As?New?Rectangle(Int(Wid?/?5),?Int(Hei?/?5),?Int(Wid?/?2),?Int(Hei?/?2))

'??g.DrawRectangle(Pen,?Rec)

'清楚現(xiàn)有的矩形

g.Clear(Me.BackColor)

g.DrawPath(Pen,?GetRoundedRectPath(Rec,?30))

End?Sub

Private?Sub?Form1_Paint(ByVal?sender?As?System.Object,?ByVal?e?As?System.Windows.Forms.PaintEventArgs)?Handles?MyBase.Paint

DrawingRect()

End?Sub

Private?Sub?Form1_SizeChanged(ByVal?sender?As?System.Object,?ByVal?e?As?System.EventArgs)?Handles?MyBase.SizeChanged

Me.Invalidate()?'此函數(shù)可引發(fā)Paint事件

End?Sub

End?Class

效果截圖:

原窗口:

縮小后:

文章標(biāo)題:vb.net系統(tǒng)屏幕畫圖 vbs編寫圖形窗口
文章轉(zhuǎn)載:http://muchs.cn/article48/dosdphp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供企業(yè)建站、品牌網(wǎng)站設(shè)計、Google、外貿(mào)建站、網(wǎng)站設(shè)計、標(biāo)簽優(yōu)化

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都做網(wǎng)站