如图,上面一根线是用程序的画线工具画的,下面的一根是自己用VBS代码画的,但在窗格的右边,上面的一根过Y轴右边的部分不可见,而下面的一根过Y轴右边是看得见的。不知有什么方法,使下面的自己画的线在Y轴右边也不可见?
VBS代码如下:
Sub Technic_Paint()
set Grid = technic.ActiveGrid
start_x = Grid.PelsByPos(3600,false)
start_y = Grid.PriceToPels(5.20)
end_x = Grid.PelsByPos(3660,false)
end_y = Grid.PriceToPels(4.20)
call Grid.DrawLine (start_x, start_y, end_x, end_y)
End Sub
TopHeight 当前窗格上边距高度,以象素表示,该边距通常用来显示公式数据,可读写。
LeftWidth 当前窗格左边距宽度,以象素表示,该边距通常用来显示左Y坐标,可读写。
RightWidth 当前窗格右边距宽度,以象素表示,该边距通常用来显示右Y坐标,可读写。
BottomHeight 当前窗格下边距高度,以象素表示,该边距通常用来显示X坐标,可读写。
将上述属性考虑进去即可。
Sub Technic_Paint()
set Grid = technic.ActiveGrid
start_x = Grid.PelsByPos(3600,false)
start_y = Grid.PriceToPels(5.20)
end_x = Grid.PelsByPos(3660,false)
end_y = Grid.PriceToPels(4.20)
if end_x > Grid.Width - Grid.RightWidth then
end_x = Grid.Width - Grid.RightWidth
end if
'其他限制代码,自己加上去即可
call Grid.DrawLine (start_x, start_y, end_x, end_y)
End Sub
TopHeight 当前窗格上边距高度,以象素表示,该边距通常用来显示公式数据,可读写。
LeftWidth 当前窗格左边距宽度,以象素表示,该边距通常用来显示左Y坐标,可读写。
RightWidth 当前窗格右边距宽度,以象素表示,该边距通常用来显示右Y坐标,可读写。
BottomHeight 当前窗格下边距高度,以象素表示,该边距通常用来显示X坐标,可读写。
将上述属性考虑进去即可。
Sub Technic_Paint()
set Grid = technic.ActiveGrid
start_x = Grid.PelsByPos(3600,false)
start_y = Grid.PriceToPels(5.20)
end_x = Grid.PelsByPos(3660,false)
end_y = Grid.PriceToPels(4.20)
if end_x > Grid.Width - Grid.RightWidth then
end_x = Grid.Width - Grid.RightWidth
end if
'其他限制代码,自己加上去即可
call Grid.DrawLine (start_x, start_y, end_x, end_y)
End Sub
将4个坐标数字都进行坐标范围的规范
if start_x < 0 then
start_x = 0
end if
if start_x > Grid.Height - Grid.BottomHeight
start_x = Grid.Height - Grid.BottomHeight
end if
if start_x > Grid.Width - Grid.RightWidth then
start_x = Grid.Width - Grid.RightWidth
end if
start_y 其余参数依次类推
没有什么办法,我们编程序都需要自己处理边界问题的
(链接的图形质量好差啊)
显示问题已解决,谢谢版主解答。
但还需两个转换函数,用于获取数据,但编译器通不过:
FrameToGrid(x1, y1, x2, y2)
ValueByPoint(x, y, Date, ydata, false)
上面两个都通不过。