这一篇在新浪博客发表过,这里再记录一遍,新浪博客地址
CITECT2018R2过程分析器设置游标粗细和颜色_来自金沙江的小鱼_新浪博客 (sina.com.cn)
在前一个练习基础上设置一下游标的粗细和颜色,让其更加醒目。在过程分析器初始化脚本中设置游标位置添加后面设置游标粗细和颜色
hCursor.width=5 hCursor.color=255 游标粗细数值范围是1至8,颜色按照VB函数RGB的计算结果来写颜色对应的数值。整个控件初始化脚本如下: Sub PAIni() '趋势控件初始化,现时显示游标、数据板命名、趋势笔命名,标签位置规范排列 Dim pa As Object Dim hPanes As Object Dim hPane As Object Dim hPens As Object Dim hPen As Object Dim hcursor As Object Dim value1,value2 Dim asLocal As Boolean Dim cursorTime As Date Dim milli As Integer Dim cursorValue As String asLocal = -1 '取本地时间 Set pa=trend1_AN4'趋势控件 Set hCursor=pa.cursors.create("游标处的数值",500) hCursor.visible=true hCursor.width=5 hCursor.color=255 Set hPanes=pa.Panes Set hPane=hPanes.item(1) hPane.Name="趋势笔标签自定义单位练习" Set hPens=hPane.Pens Set hPen=hPens.item(1) hCursor.PenlabelX(hPen)=100 hCursor.PenlabelY(hPen)=40 hPen.Name="流量1" hCursor.PenLabelHeight(hPen)=100 hCursor.PenLabelWidth(hPen)=150 hPen.VerticalAxisLabelType=35 Set hPen=hPens.item(2) hCursor.PenlabelX(hPen)=300 hCursor.PenlabelY(hPen)=40 hPen.Name="浓度1" hCursor.PenLabelHeight(hPen)=100 hCursor.PenLabelWidth(hPen)=150 hPen.VerticalAxisLabelType=35 End Sub 最终效果是这样子的![](/i/l/?n=23&i=blog/2292137/202309/2292137-20230903181147136-1398850321.png)
标签:CITECT2018R2,Set,Dim,hCursor,Object,游标,分析器,hPen From: https://www.cnblogs.com/fishingsriver/p/17675306.html