扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流
这个要用GDI+画。要看你.net版本。
成都创新互联公司是一家网站设计公司,集创意、互联网应用、软件技术为一体的创意网站建设服务商,主营产品:成都响应式网站建设公司、品牌网站建设、成都营销网站建设。我们专注企业品牌在网站中的整体树立,网络互动的体验,以及在手机等移动端的优质呈现。成都做网站、网站制作、移动互联产品、网络运营、VI设计、云产品.运维为核心业务。为用户提供一站式解决方案,我们深知市场的竞争激烈,认真对待每位客户,为客户提供赏析悦目的作品,网站的价值服务。
以下是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) '绘制横坐标
Dim Points1(30) As Point
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Timer1.Enabled = True
Timer1.Interval = 200
For i = 0 To 30
Points1(i) = New Point(i * 45, Math.Sin(i) * (PictureBox1.Height - 50) / 9)
Points1(i).Offset(-450, Math.Abs(Points1(i).Y - (PictureBox1.Height - 50) / 9) * 3.55 + 43)
Next
End Sub
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Static j As Long
j = j + 1
PictureBox1.Image = x_y(PictureBox1, j)
End Sub
Private Function x_y(ByVal pic As PictureBox, ByVal x As Long) As Bitmap
Dim b As New Bitmap(pic.Width, pic.Height)
Dim g As Graphics = Graphics.FromImage(b)
Dim c
Dim j
g.Clear(Color.YellowGreen)
Dim p As New Pen(Color.WhiteSmoke)
p.EndCap = Drawing2D.LineCap.ArrowAnchor
g.DrawLine(p, 20, pic.Height - 20, 20, 10)
g.DrawLine(p, 20, pic.Height - 20, pic.Width - 20, pic.Height - 20)
Dim i As Double
Dim bs As New SolidBrush(Color.Red)
Dim po As New Point
g.DrawString(-2, Me.Font, bs, 12, pic.Height - 18)
po.X = 0
po.Y = pic.Height - 45
For i = -1.6 To 4 Step 0.4
g.DrawString(Math.Round(i, 1), Me.Font, bs, po.X, po.Y)
g.DrawLine(p, po.X + 18, po.Y + 5, po.X + 20, po.Y + 5)
Dim p1 As New Pen(Color.Blue)
p1.DashStyle = Drawing2D.DashStyle.Dash
g.DrawLine(p1, po.X + 28, po.Y + 5, pic.Width - 20, po.Y + 5)
po.Y -= (pic.Height - 50) / 9
Next
po.X = 20
po.Y = pic.Height - 20
For c = 0 To 14400 Step 1200
If (c / 1200) 0 Then
g.DrawString((c / 1200) + x, Me.Font, bs, po.X - j, po.Y + 5)
End If
g.DrawLine(p, po.X, po.Y + 2, po.X, po.Y)
po.X += (pic.Width - 50) / 12
Next
For i = 0 To Points1.Count - 1
Points1(i).Offset(45, 0)
Next
If x Mod 6 = 0 Then
For i = 0 To Points1.Count - 1
Points1(i).Offset(-270, 0)
Next
End If
g.DrawCurve(Pens.Red, Points1)
'For i = 0 To Points1.Count - 1
'g.DrawString(Math.Sin(i), Me.Font, Brushes.Red, Points1(i))
'Next
Return b
End Function
。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的 编译 上面都有详细的参数说明
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
您好,您是想问vb.net连续绘制曲线图不消失怎么办?b.net连续绘制曲线图不消失的解决办法如下:
1、首先必须创建bitmap,关联到picturebox1.image上。
2、再在picturebox1.image上创建Graphics,再进行作图。即可显示线图。
Beginning VB 2008 从入门到精通 ;ID=181830 Pro VB 2008 and the .NET 3.5 Platform ;ID=184746 Visual Basic 2008 Programmerss Reference ;ID=181605 Apress Accelerated VB 2008 ;ID=181504 Visual Basic 2008 Step by Step Wrox Professional VB 2005 with .NET 3.0 ;ID=158893 Build A Program Now Visual Basic 2005 ;ID=146029 .NET游戏编程入门经典—VB.NET篇 ;ID=158821 O'Reilly Visual Basic 2005 Cookbook ;ID=160654 .NET Insight for Classic VB Developers ;ID=162041 Fast Track Visual Basic.NET ;ID=161990 Security for Microsoft Visual Basic.NET ;ID=175012 Visual Basic.NET How to Program 第二版 ;ID=173182 Visual Basic 2005 简明教程 ;ID=173180 Visual Basic 2005傻瓜书 ;ID=173178 Programming Visual Basic.NET ;ID=173164 Visual Basic .NET Tips and Techniques ;ID=176561 VB开发人员SQL Sever指南 ;ID=173176 How to Code .NET ;ID=145559 Essential .NET, Volume I ;ID=176152 ADO.NET全攻略 . 查看原帖
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流