量化軟件下載:赫茲股票期貨量化軟件文本標(biāo)簽控件
首先,將圖形元素類型設(shè)置到所有父類,并為對象設(shè)置 WinForms 標(biāo)簽庫對象類型。 接下來,設(shè)置對象和坐標(biāo),并調(diào)用虛擬方法來設(shè)置函數(shù)庫圖形元素的主要參數(shù)。 該方法在類中重新定義,因?yàn)樗c基準(zhǔn)對象的相同方法略有不同。 我們將在下面考慮它。 如果對象自動調(diào)整大小標(biāo)志設(shè)置為適配文本,則調(diào)用相應(yīng)的方法調(diào)整對象的大?。ㄔ摌?biāo)志目前始終處于禁用狀態(tài),但稍后可以更改)。 調(diào)整大小之后(設(shè)置標(biāo)志),設(shè)置初始對象大小,及其初始坐標(biāo). 最后重新繪制整個(gè)對象。
虛擬方法初始化變量:
//+------------------------------------------------------------------+ //| 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); ?} //+------------------------------------------------------------------+