
用Pset函数啊、
下面是画一条正弦函数
Private
Sub
Command1_Click()
For
i
=
1
To
1000
Step
001
x
=
Sin(i)
1000
‘
可以把sin改成其他函数
Form1PSet
(i
1000,
x
+
Form1Height
/
2)
’具体的位置可以自己调整
Next
i
Form1Line
(0,
Form1Height
/
2)-(Form1Width,
Form1Height
/
2)
'横坐标
Form1Line
(Form1Width
/
2,
0)-(Form1Width
/
2,
Form1Height)
'纵坐标
End
Sub
在VB中如何获得tchart控件中图象的坐标值方法:
备注:Series(0)为相对误差系列,Series(1)为实测流量系列,Series(2)为雨量系列
'显示图2的坐标
Private
Sub
TChart2_OnMouseMove(ByVal
Shift
As
TeeChartEShiftState,
ByVal
X
As
Long,
ByVal
Y
As
Long)
Dim
somebar
As
Single
‘定义变量
With
TChart2Series(0)
somebar
=
Clicked(X,
Y)
’获得鼠标点击的地方的坐标
If
somebar
<>
-1
Then
‘判断,没有什么具体意义
Label27ForeColor
=
PointColor(somebar)
’标签中字体颜色和点击的系列相同
Label27Caption
=
Format(XValuesValue(somebar)
+
3,
"0000")
+
"相对误差:"
+
Format(YValuesValue(somebar),
"00")
+
"
%"
‘显示坐标
End
If
End
With
With
TChart2Series(1)
somebar
=
Clicked(X,
Y)
If
somebar
<>
-1
Then
Label27ForeColor
=
PointColor(somebar)
Label27Caption
=
Format(XValuesValue(somebar)
+
3,
"0000")
+
"计算流量:"
+
Format(YValuesValue(somebar),
"00")
+
"
m3/s"
End
If
End
With
With
TChart2Series(2)
somebar
=
Clicked(X,
Y)
If
somebar
<>
-1
Then
Label27ForeColor
=
PointColor(somebar)
Label27Caption
=
Format(XValuesValue(somebar)
+
3,
"0000")
+
"雨量:"
+
Format(YValuesValue(somebar),
"00")
+
"
mm"
End
If
End
With
End
Sub
以上显示的是三个系列的坐标。是以水文学及水资源专业为例的。仅供参考。
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Text1Text = X
Text2Text = Y
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
MeCaption = X & "," & Y
End Sub
Private Sub Form_Load()
ScaleMode = 3 '像素模式
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
MsgBox X & "," & Y
End Sub
获取的是相对窗体区域左上角(不含标题栏)
两种办法
第一种手工用鼠标选择多段线,然后输入list命令,d出一个窗口,然后复制那些坐标,粘到excel里面,在exel里面根据空格来分列,最后得到X,Y的数值
第二种就麻烦一些了,建立一个选择集,用lisp或者vba来写一个提取多段线的代码。我这里有网上的一个vba代码,如果你不会vba的话,最好不要用。
Option Explicit
Public Sub GetLWPOLYLINECoordinates()
Dim ss_dim As AcadSelectionSet, ent As AcadLWPolyline
Dim dxf_code() As Integer, dxf_value() As Variant
'Dim i As Long,
Dim j As Long
Dim dbCor As Variant, x As Double, y As Double, z As Double
Set ss_dim = ThisDrawingSelectionSetsAdd("ssLine1")
ReDim dxf_code(0), dxf_value(0)
dxf_code(0) = 0: dxf_value(0) = "LWPOLYLINE"
'ss_dimSelect acSelectionSetAll, , , dxf_code, dxf_value
ss_dimSelectOnScreen dxf_code, dxf_value
Open "d:\aaaaatxt" For Append As #1
For Each ent In ss_dim
For j = 0 To UBound(entCoordinates) \ 2
x = entCoordinates(j 2)
y = entCoordinates(j 2 + 1)
Print #1, (j); ",," & x & "," & y
Next
Next
Stop
Close #1
ss_dimClear
ss_dimDelete
End Sub
以上就是关于请教高手,用VB编程,怎样才能绘出函数曲线,必须要有对应坐标,函数公式已知,谢谢,请详细解答!全部的内容,包括:请教高手,用VB编程,怎样才能绘出函数曲线,必须要有对应坐标,函数公式已知,谢谢,请详细解答!、在VB中如何获得tchart控件中图象的坐标值、VB 如何实时获取鼠标坐标呢,然后点击一下坐标就输入到TEXT1 和 TEXT2 当中。等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)