求一个用visual basic画直角坐标系的方法,坐标系上有刻度显示,并且刻度可以根据自己的需要改动;
1个回答
展开全部
Option Explicit
'x,y 为圆点坐标
'jg 为一个间隔多少象素
'td 多少次短线一次长线
Sub SetPoint(x As Integer, y As Integer, Optional jg As Integer = 10, Optional TD As Integer = 5)
If Me.ScaleMode <> 3 Then Me.ScaleMode = 3
If Me.AutoRedraw = False Then Me.AutoRedraw = True
Me.Circle (x, y), 2
'DrawX
Me.Line (0, y)-(Me.ScaleWidth, y)
Dim i As Integer, t As Integer
For i = x To Me.ScaleWidth Step jg
t = t + 1
Me.Line (i, y)-(i, y - IIf(t Mod TD = 0, 10, 5))
Next
t = 0
For i = x To 0 Step -jg
t = t + 1
Me.Line (i, y)-(i, y - IIf(t Mod TD = 0, 10, 5))
Next
'DrawY
t = 0
Me.Line (x, 0)-(x, Me.ScaleHeight)
For i = y To Me.ScaleHeight Step jg
t = t + 1
Me.Line (x, i)-(x + IIf(t Mod TD = 0, 10, 5), i)
Next
t = 0
For i = y To 0 Step -jg
t = t + 1
Me.Line (x, i)-(x + IIf(t Mod TD = 0, 10, 5), i)
Next
End Sub
Private Sub Form_Load()
Me.Show
SetPoint 200, 100
End Sub
长荣科机电
2024-10-27 广告
2024-10-27 广告
直角坐标机器人,作为深圳市长荣科机电设备有限公司的明星产品之一,以其高精度、高稳定性在自动化生产线上发挥着关键作用。该机器人采用直线电机或精密导轨驱动,能在电商平台Y、Z三个直角坐标轴上实现精准定位与运动控制,广泛应用于电子装配、包装、检测...
点击进入详情页
本回答由长荣科机电提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询