構造Pen的時候可以指定粗細,如果你指定為1,并且放大了10倍,最后就成10了,所以你指定小點就行了,比如 Dim p As New Pen(Color.Black, 0.01) 最終繪制的線的粗細不會小于1
為彭州等地區(qū)用戶提供了全套網(wǎng)頁設計制作服務,及彭州網(wǎng)站建設行業(yè)解決方案。主營業(yè)務為網(wǎng)站設計、做網(wǎng)站、彭州網(wǎng)站設計,以傳統(tǒng)方式定制建設網(wǎng)站,并提供域名空間備案等一條龍服務,秉承以專業(yè)、用心的態(tài)度為用戶提供真誠的服務。我們深信只要達到每一位用戶的要求,就會得到認可,從而選擇與我們長期合作。這樣,我們也可以走得更遠!
Private Sub PictureBox2_Paint(sender As Object, e As PaintEventArgs) Handles PictureBox2.Paint
Dim points As New List(Of Point)
points.Add(New Point(0, 0))
points.Add(New Point(1, 10))
points.Add(New Point(3, 15))
points.Add(New Point(14, 0))
points.Add(New Point(20, 60))
points.Add(New Point(40, 20))
points.Add(New Point(70, 50))
e.Graphics.DrawCurve(Pens.Red, points.ToArray)
End Sub
供參考,points可設為全局變量,那樣add隨便在哪增加,想要看見看上去動態(tài)的圖,那就在新增完n個后,繼續(xù)增加n+1個之時,放棄points中的第一個。
這個要用GDI+畫。要看你.net版本。
以下是VS2005中的一段代碼。
Me.PictureBox1.Height = 450
Me.PictureBox1.Width = 880
Dim gr As Graphics '定義畫布
Dim bp As New Bitmap(880, 450) '定義位圖,并進行賦值
Dim p As New Pen(Color.Black) '定義畫筆
p.Width = 2 '寬度2
p.DashStyle = Drawing2D.DashStyle.Solid '樣式直線
PictureBox1.Image = bp
gr = Graphics.FromImage(PictureBox1.Image)
gr.FillRectangle(Brushes.White, New Rectangle(0, 0, PictureBox1.Width, PictureBox1.Height))
gr.DrawLine(p, a, b, a, .Height - b) '繪制縱坐標
gr.DrawLine(p, a, .Height - b, .Width - a, .Height - b) '繪制橫坐標
您好,您是想問vb.net連續(xù)繪制曲線圖不消失怎么辦?b.net連續(xù)繪制曲線圖不消失的解決辦法如下:
1、首先必須創(chuàng)建bitmap,關聯(lián)到picturebox1.image上。
2、再在picturebox1.image上創(chuàng)建Graphics,再進行作圖。即可顯示線圖。
。net ?其實還是很好繪制圖形的
你可以看下?Graphics ?類
Dim d As New Bitmap(Me.Width, Me.Height) ?‘一個圖片吧
? Dim g As Graphics = Graphics.FromImage(d)’繪制 ?準備在這個圖片是進行
然后 ?就是你繪制的東西了
線 就是 ??g.DrawLine()
圓 弧度 ?就用 ?g.DrawArc(Pens.Black, New Rectangle(0, 0, 400, 200), 0, 360)
復雜的就是 ? ? ?g.DrawBezier()
等 ?如果你用的是 VS的 ?編譯 ?上面都有詳細的參數(shù)說明
Dim?d?As?New?Bitmap(Me.Width,?Me.Height)
Dim?g?As?Graphics?=?Graphics.FromImage(d)
g.DrawArc(Pens.Black,?New?Rectangle(0,?0,?200,?200),?0,?360)
g.DrawLine(Pens.Red,?New?Point(0,?0),?New?Point(200,?200))
g.DrawLines(Pens.Green,?New?Point()?{New?Point(0,?0),?New?Point(50,?40),?New?Point(50,?80),?New?Point(90,?70),?New?Point(100,?400)})
g.DrawBezier(Pens.Yellow,?New?Point(0,?100),?New?Point(0,?0),?New?Point(200,?0),?New?Point(200,?200))
g.Dispose()
Me.BackgroundImage?=?d
拖一個PictureBox1控件 創(chuàng)建一個Paint事件。在事件中加入 Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint ' Create pens. Dim redPen As New Pen(Color.Red, 3) Dim greenPen As New Pen(Color.Green, 3) ' Create points that define curve. Dim point1 As New Point(50, 50) Dim point2 As New Point(100, 25) Dim point3 As New Point(200, 5) Dim point4 As New Point(250, 50) Dim point5 As New Point(300, 100) Dim point6 As New Point(350, 200) Dim point7 As New Point(250, 250) Dim curvePoints As Point() = {point1, point2, point3, point4, _ point5, point6, point7} ' Draw lines between original points to screen. e.Graphics.DrawLines(redPen, curvePoints) ' Draw curve to screen. e.Graphics.DrawCurve(greenPen, curvePoints) End Sub 得到數(shù)據(jù)后,改point的數(shù)據(jù)。然后PictureBox1.Refresh()就行了