public virtual void InitialLabelText(XmlLabel label) { // 一点点差异 if (this.Name.Length > 0 && this.Name[0] == '#') label.Text = this.Name; else label.Text = "? " + this.Name; }
public virtual void InitialLabelText(XmlLabel label) { // 一点点差异 if (this.Name.Length > 0 && this.Name[0] == '#') { label.Text = this.Name; } else { label.Text = "? " + this.Name; } }
// 本函数对于派生类来说一般不要重载。一般重载InitialVisualSpecial()即可。 // 因为本函数代码前后部分基本是共用的,只有中段采用调用InitialVisualSpecial()的办法。 // 不过如果重载了本函数,并且不想在其中调用InitialVisualSpecial(),则需要自行实现全部功能 public override void InitialVisual() { if (this.childrenVisual != null) { this.childrenVisual.Clear(); } // 加Label XmlLabel label = new XmlLabel(); label.container = this; InitialLabelText(label); this.AddChildVisual(label); // 定义一个总框 Box boxTotal = new Box(); boxTotal.Name = "BoxTotal"; boxTotal.container = this; this.AddChildVisual(boxTotal); // 外面总框的layoutStyle样式为竖排 boxTotal.LayoutStyle = LayoutStyle.Vertical; /// InitialVisualSpecial(boxTotal); /// //如果boxTotal只有一个box,则设为横排 if (boxTotal.childrenVisual != null && boxTotal.childrenVisual.Count == 1) { boxTotal.LayoutStyle = LayoutStyle.Horizontal; } /* * Comment comment = new Comment (); * comment.container = this; * this.AddChildVisual(comment); */ }
// 得到childrenVisual中的Label对象 public XmlLabel GetLable() { if (this.childrenVisual == null) { return(null); } XmlLabel label = null; for (int i = 0; i < this.childrenVisual.Count; i++) { Visual visual = (Visual)this.childrenVisual[i]; if (visual is XmlLabel) { label = (XmlLabel)visual; break; } } return(label); }
// 本函数对于派生类来说一般不要重载。一般重载InitialVisualSpecial()即可。 // 因为本函数代码前后部分基本是共用的,只有中段采用调用InitialVisualSpecial()的办法。 // 不过如果重载了本函数,并且不想在其中调用InitialVisualSpecial(),则需要自行实现全部功能 public override void InitialVisual() { if (this.childrenVisual != null) this.childrenVisual.Clear(); // 加Label XmlLabel label = new XmlLabel(); label.container = this; InitialLabelText(label); this.AddChildVisual(label); // 定义一个总框 Box boxTotal = new Box (); boxTotal.Name = "BoxTotal"; boxTotal.container = this; this.AddChildVisual (boxTotal); // 外面总框的layoutStyle样式为竖排 boxTotal.LayoutStyle = LayoutStyle.Vertical; /// InitialVisualSpecial(boxTotal); /// //如果boxTotal只有一个box,则设为横排 if (boxTotal.childrenVisual != null && boxTotal.childrenVisual .Count == 1) boxTotal.LayoutStyle = LayoutStyle.Horizontal ; /* Comment comment = new Comment (); comment.container = this; this.AddChildVisual(comment); */ }
// 完成重载基类的InitialVisual() public override void InitialVisual() { bool bHasVisual = false; XmlLabel label = this.GetLable(); if (label == null) { // 加Label label = new XmlLabel(); label.container = this; label.Text = this.Name; this.AddChildVisual(label); } else { label.Text = this.Name; bHasVisual = true; } Box boxTotal = null; if (bHasVisual == false) { // 定义一个总框 boxTotal = new Box (); boxTotal.Name = "BoxTotal"; boxTotal.container = this; this.AddChildVisual (boxTotal); // 外面总框的layoutStyle样式为竖排 boxTotal.LayoutStyle = LayoutStyle.Vertical; } else { boxTotal = this.GetBoxTotal(); if (boxTotal == null) { Debug.Assert(false,"有Lable对象,不可能没有BoxTotal对象"); throw new Exception("有Lable对象,不可能没有BoxTotal对象"); } } /// if (boxTotal != null) InitialVisualSpecial(boxTotal); /// /* if (bHasLable == false) { //如果boxTotal只有一个box,则设为横排 if (boxTotal.childrenVisual != null && boxTotal.childrenVisual .Count == 1) boxTotal.LayoutStyle = LayoutStyle.Horizontal ; Comment comment = new Comment (); comment.container = this; this.AddChildVisual(comment); } */ this.m_strTempURI = null; }
public override void InitialLabelText(XmlLabel label) { label.Text = "&" + this.Name + ";"; }
public override void InitialLabelText(XmlLabel label) { label.Text = "&" + this.Name + ";"; }