量化软件下载:赫兹股票期货量化软件文本标签控件
首先,将图形元素类型设置到所有父类,并为对象设置 WinForms 标签库对象类型。 接下来,设置对象和坐标,并调用虚拟方法来设置函数库图形元素的主要参数。 该方法在类中重新定义,因为它与基准对象的相同方法略有不同。 我们将在下面考虑它。 如果对象自动调整大小标志设置为适配文本,则调用相应的方法调整对象的大小(该标志目前始终处于禁用状态,但稍后可以更改)。 调整大小之后(设置标志),设置初始对象大小,及其初始坐标. 最后重新绘制整个对象。
虚拟方法初始化变量:
//+------------------------------------------------------------------+ //| Initialize the variables | //+------------------------------------------------------------------+ void CLabel::Initialize(void) { //--- Clear all object lists and set sorted list flags for them this.m_list_elements.Clear(); this.m_list_elements.Sort(); this.m_list_tmp.Clear(); this.m_list_tmp.Sort(); //--- Text label has no shadow object this.m_shadow_obj=NULL; this.m_shadow=false; //--- The width of the object frame on each side is 1 pixel by default this.m_frame_width_right=1; this.m_frame_width_left=1; this.m_frame_width_top=1; this.m_frame_width_bottom=1; //--- The object does not have a gradient filling (neither vertical, nor horizontal) this.m_gradient_v=false; this.m_gradient_c=false; //--- Reset all "working" flags and variables this.m_mouse_state_flags=0; this.m_offset_x=0; this.m_offset_y=0; CGCnvElement::SetInteraction(false); //--- Create an animation object and add it to the list for storing such objects this.m_animations=new CAnimations(CGCnvElement::GetObject()); this.m_list_tmp.Add(this.m_animations); //--- Set the transparent color for the object background this.SetColorBackground(CLR_CANV_NULL); this.SetOpacity(0); //--- Set the default color and text opacity, as well as the absence of the object frame this.SetForeColor(CLR_DEF_FORE_COLOR); this.SetForeColorOpacity(CLR_DEF_FORE_COLOR_OPACITY); this.SetBorderStyle(FRAME_STYLE_NONE); //--- Set the default text parameters this.SetFont(DEF_FONT,DEF_FONT_SIZE); this.SetText(""); this.SetTextAnchor(FRAME_ANCHOR_LEFT_TOP); this.SetTextAlign(ANCHOR_LEFT_UPPER); //--- Set the default object parameters this.SetAutoSize(false,false); this.SetMargin(3,0,3,0); this.SetPaddingAll(0); this.SetEnabled(true); this.SetVisible(true,false); } //+------------------------------------------------------------------+