期货量化软件:赫兹量化中“动画框”对象类及其衍生对象
方法逻辑与上面研究过的方法之一雷同。 该方法接收对象 ID、绘制的形状 X 和 Y 坐标、颜色和不透明度、如若这个 ID 的对象不在列表中,则指示需要创建指定 ID 新对象的标志,以及 图表重绘标志。 接下来,获取指向所需对象的指针(如果不存在,则创建该对象)。 如果获取指针失败,则返回 false。 如果收到指针,则返回所获取动画矩形框对象的 SetPixelOnBG() 方法的结果。
绘制图元的其它方法。
其余造型绘制方法的逻辑与上面研究的方法的逻辑雷同。 我们来看看它们的清单:
//+------------------------------------------------------------------+ //| Draw a segment of a vertical line | //+------------------------------------------------------------------+ bool CAnimations::DrawLineVerticalOnBG(const int id, // Frame ID const int x, // Segment X coordinate const int y1, // Y coordinate of the segment first point const int y2, // Y coordinate of the segment second point const color clr, // Color const uchar opacity=255, // Opacity const bool create_new=true, // New object creation flag const bool redraw=false) // Chart redraw flag { CFrameQuad *frame=this.GetOrCreateFrame(DFUN,id,ANIMATION_FRAME_TYPE_QUAD,create_new); if(frame==NULL) return false; return frame.DrawLineVerticalOnBG(x,y1,y2,clr,opacity,redraw); } //+------------------------------------------------------------------+ //| Draw a segment of a horizontal line | //+------------------------------------------------------------------+ bool CAnimations::DrawLineHorizontalOnBG(const int id, // Frame ID