VB.net與VB不同。

網(wǎng)站建設(shè)哪家好,找創(chuàng)新互聯(lián)!專注于網(wǎng)頁設(shè)計(jì)、網(wǎng)站建設(shè)、微信開發(fā)、小程序定制開發(fā)、集團(tuán)企業(yè)網(wǎng)站建設(shè)等服務(wù)項(xiàng)目。為回饋新老客戶創(chuàng)新互聯(lián)還提供了上城免費(fèi)建站歡迎大家使用!
VB.net已經(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
'繪制圖形的三步曲
'1,獲得一個Graphics對象
Dim MyGraphics As Graphics
MyGraphics = Me.CreateGraphics
'2,定義一個Pen對象,用于繪制圖形(輪廓線)
Dim MyPen As New Pen(Color.Black)
'3,定義一個Brush對象,用于填充圖形(如果需要填充的話)
Dim MyBrush As New SolidBrush(Color.Orange)
MyGraphics.FillEllipse(MyBrush, 200, 200, 100, 100) '繪制一個實(shí)心圓,該圓在:直線x=200,y=200,x=200+100,y=200+100所劃的矩形區(qū)域內(nèi)
MyGraphics.DrawEllipse(MyPen, 200, 200, 100, 100) '繪制一個空心圓,該圓在:直線x=200,y=200,x=200+100,y=200+100所劃的矩形區(qū)域內(nèi)
可以直接顯示的。你看下面的示例,使用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
picture本身不是文本控件,文本是“畫”上去的,換行需要用代碼測量每個字在指定字體下的寬度,判斷在當(dāng)前picture的寬度之下,一行能容納多少文字,剩下的文字就在下一行繪制。
網(wǎng)頁題目:包含vb.net瀑布圖的詞條
網(wǎng)站地址:http://chinadenli.net/article40/dsgioho.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供ChatGPT、品牌網(wǎng)站設(shè)計(jì)、全網(wǎng)營銷推廣、、品牌網(wǎng)站制作、網(wǎng)站維護(hù)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)