VB.Net绘制多段线 vb怎么画曲线
谁能提供一段vb在CAD中绘制多段线的实例代码作参考!
多线段没画过,
成都创新互联-专业网站定制、快速模板网站建设、高性价比保康网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式保康网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖保康地区。费用合理售后完善,十载实体公司更值得信赖。
线倒是画过,二话不说直接上代码你参考一下
绘制边框
Private Sub Command4_Click()
Set acadDoc = acadApp.ActiveDocument
link2
acadDoc.ActiveLayer = acadlay(0)
With adoRes
While Not .EOF
pt1(0) = !X: pt1(1) = !Y: pt1(2) = !z: pt2(0) = !X1: pt2(1) = !Y1: pt2(2) = !z1
draw pt1, pt2
.MoveNext
Wend
End With
pt1(0) = 0: pt1(1) = 0: pt1(2) = 0
pt2(0) = 20: pt2(1) = 10: pt2(2) = 0
draw pt1, pt2
'在坡
pt1(0) = 0: pt1(1) = 0: pt1(2) = 0
pt2(0) = 20: pt2(1) = 10: pt2(2) = 0
draw pt1, pt2
For c = 0 To 50 Step 10
pt1(0) = 0: pt1(1) = c: pt1(2) = 0
pt2(0) = 270: pt2(1) = c: pt2(2) = 0
draw pt1, pt2
Next c
pt1(0) = 20: pt1(1) = 0: pt1(2) = 0
pt2(0) = 20: pt2(1) = 190: pt2(2) = 0
draw pt1, pt2
pt1(0) = 0: pt1(1) = 0: pt1(2) = 0
pt2(0) = 0: pt2(1) = -10: pt2(2) = 0
draw pt1, pt2
pt1(0) = 0: pt1(1) = -10: pt1(2) = 0
pt2(0) = 270: pt2(1) = -10: pt2(2) = 0
draw pt1, pt2
pt1(0) = 270: pt1(1) = -10: pt1(2) = 0
pt2(0) = 270: pt2(1) = 0: pt2(2) = 0
draw pt1, pt2
pt3(0) = 5: pt3(1) = -7
acadDoc.ModelSpace.AddText t, pt3, 4
pt3(0) = 55: pt3(1) = -7
acadDoc.ModelSpace.AddText t1, pt3, 4
a = 0
For c = 60 To 100 Step 10
pt1(0) = 20: pt1(1) = c: pt1(2) = 0
pt2(0) = 23: pt2(1) = c: pt2(2) = 0
draw pt1, pt2
pt1(0) = 10: pt1(1) = c - 1.6: pt1(2) = 0
acadDoc.ModelSpace.AddText a, pt1, 3.2
a = a + 2
Next c
'在图中加入地面高程
acadDoc.ActiveTextStyle = acadDoc.TextStyles.Add("楷体")
pt1(0) = 1: pt1(1) = 13: pt1(2) = 0
Set acadtext = acadDoc.ModelSpace.AddText("地面高程", pt1, 3.2)
Call rote1(acadtext, pt1)
'在图中加入设计高程
Call rote1(acadtext, pt1)
pt1(0) = 1: pt1(1) = 23: pt1(2) = 0
Set acadtext = acadDoc.ModelSpace.AddText("设计高程", pt1, 3.2)
Call rote1(acadtext, pt1)
'在图中加入填挖高
pt1(0) = 1: pt1(1) = 33: pt1(2) = 0
Set acadtext = acadDoc.ModelSpace.AddText("填 挖 高", pt1, 3.2)
Call rote1(acadtext, pt1)
'在图中加入坡度/坡长
pt1(0) = 0: pt1(1) = 5.5: pt1(2) = 0
Set acadtext = acadDoc.ModelSpace.AddText("坡 度", pt1, 3.2)
Call rote1(acadtext, pt1)
pt1(0) = 9: pt1(1) = 1: pt1(2) = 0
Set acadtext = acadDoc.ModelSpace.AddText("坡 长", pt1, 3.2)
Call rote1(acadtext, pt1)
'在图中加入桩号
pt1(0) = 1: pt1(1) = 43: pt1(2) = 0
Set acadtext = acadDoc.ModelSpace.AddText("桩 号", pt1, 3.2)
Call rote1(acadtext, pt1)
Call Command5_Click
End Sub
Private Sub draw(pt1, pt2)
Set AcadLine = acadDoc.ModelSpace.AddLine(pt1, pt2)
acadDoc.Regen acActiveViewport
End Sub
线倒是画过,二话不说直接上代码你参考一下
请问在VB6中该如何画多条曲线呢
Private Sub Form_Load()
MSChart1.chartType = VtChChartType2dLine
Dim arrValues()
ReDim arrValues(1 To 5, 1 To 6)
Dim i As Integer
For i = 1 To 5
arrValues(i, 1) = "t" i 'x轴
arrValues(i, 2) = 0 + Rnd * 100 '第一条线
arrValues(i, 3) = 0 + Rnd * 100 '第二条线
arrValues(i, 4) = 0 + Rnd * 100 '第三条线
arrValues(i, 5) = 0 + Rnd * 100 '第四条线
arrValues(i, 6) = 0 + Rnd * 100 '第五条线
Next i
MSChart1.ChartData = arrValues
vb.net绘制曲线图
。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中如何在picturebox画线,有什么函数?
Dim b As New Bitmap(PictureBox1.Width, PictureBox1.Height)
Dim g As Graphics = Graphics.FromImage(b)
g.Clear(Color.White)
Dim p As New Pen(Color.Black)
p.EndCap = Drawing2D.LineCap.ArrowAnchor
g.DrawLine(p, 30, PictureBox1.Height - 30, 30, 30)
g.DrawLine(p, 30, PictureBox1.Height - 30, PictureBox1.Width - 30, PictureBox1.Height - 30)
Dim i As Integer
Dim bs As New SolidBrush(Color.Green)
Dim po As New Point
po.X = 0
po.Y = PictureBox1.Height - 35
For i = 700 To 1000 Step 50
g.DrawString(i, Me.Font, bs, po.X, po.Y)
g.DrawLine(p, po.X + 28, po.Y + 5, po.X + 30, po.Y + 5)
po.Y -= (PictureBox1.Height - 100) / 6
Next
po.X = 30
po.Y = PictureBox1.Height - 30
For i = 0 To 40 Step 5
g.DrawString(i, Me.Font, bs, po.X, po.Y + 5)
g.DrawLine(p, po.X, po.Y + 2, po.X, po.Y)
po.X += (PictureBox1.Width - 100) / 8
Next
PictureBox1.Image = b
分享名称:VB.Net绘制多段线 vb怎么画曲线
文章来源:http://pwwzsj.com/article/dosjcjd.html