/// <devdoc> /// Copies non-blank elements from the specified style, but will not overwrite /// any existing style elements. /// </devdoc> public override void MergeWith(Style s) { if (s != null) { if (IsEmpty) { // Merging with an empty style is equivalent to copying, // which is more efficient. CopyFrom(s); return; } base.MergeWith(s); TreeNodeStyle tns = s as TreeNodeStyle; if (tns != null && !tns.IsEmpty) { // Since we're already copying the registered CSS class in base.MergeWith, we don't // need to any attributes that would be included in that class. if (s.RegisteredCssClass.Length == 0) { if (tns.IsSet(PROP_VPADDING) && !this.IsSet(PROP_VPADDING)) { this.VerticalPadding = tns.VerticalPadding; } if (tns.IsSet(PROP_HPADDING) && !this.IsSet(PROP_HPADDING)) { this.HorizontalPadding = tns.HorizontalPadding; } } if (tns.IsSet(PROP_NODESPACING) && !this.IsSet(PROP_NODESPACING)) { this.NodeSpacing = tns.NodeSpacing; } if (tns.IsSet(PROP_CHILDNODESPADDING) && !this.IsSet(PROP_CHILDNODESPADDING)) { this.ChildNodesPadding = tns.ChildNodesPadding; } if (tns.IsSet(PROP_IMAGEURL) && !this.IsSet(PROP_IMAGEURL)) { this.ImageUrl = tns.ImageUrl; } } } }
public override void MergeWith(Style s) { if (s != null) { if (this.IsEmpty) { this.CopyFrom(s); } else { base.MergeWith(s); TreeNodeStyle style = s as TreeNodeStyle; if ((style != null) && !style.IsEmpty) { if (s.RegisteredCssClass.Length == 0) { if (style.IsSet(0x10000) && !base.IsSet(0x10000)) { this.VerticalPadding = style.VerticalPadding; } if (style.IsSet(0x20000) && !base.IsSet(0x20000)) { this.HorizontalPadding = style.HorizontalPadding; } } if (style.IsSet(0x40000) && !base.IsSet(0x40000)) { this.NodeSpacing = style.NodeSpacing; } if (style.IsSet(0x80000) && !base.IsSet(0x80000)) { this.ChildNodesPadding = style.ChildNodesPadding; } if (style.IsSet(0x100000) && !base.IsSet(0x100000)) { this.ImageUrl = style.ImageUrl; } } } } }
/// <devdoc> /// Copies non-blank elements from the specified style, overwriting existing /// style elements if necessary. /// </devdoc> public override void CopyFrom(Style s) { if (s != null) { base.CopyFrom(s); TreeNodeStyle tns = s as TreeNodeStyle; if (tns != null && !tns.IsEmpty) { // Only copy the paddings if they aren't in the source Style's registered CSS class if (s.RegisteredCssClass.Length != 0) { if (tns.IsSet(PROP_VPADDING)) { ViewState.Remove("VerticalPadding"); ClearBit(PROP_VPADDING); } if (tns.IsSet(PROP_HPADDING)) { ViewState.Remove("HorizontalPadding"); ClearBit(PROP_HPADDING); } } else { if (tns.IsSet(PROP_VPADDING)) { this.VerticalPadding = tns.VerticalPadding; } if (tns.IsSet(PROP_HPADDING)) { this.HorizontalPadding = tns.HorizontalPadding; } } if (tns.IsSet(PROP_NODESPACING)) { this.NodeSpacing = tns.NodeSpacing; } if (tns.IsSet(PROP_CHILDNODESPADDING)) { this.ChildNodesPadding = tns.ChildNodesPadding; } if (tns.IsSet(PROP_IMAGEURL)) { this.ImageUrl = tns.ImageUrl; } } } }
public override void CopyFrom(Style s) { if (s != null) { base.CopyFrom(s); TreeNodeStyle style = s as TreeNodeStyle; if ((style != null) && !style.IsEmpty) { if (s.RegisteredCssClass.Length != 0) { if (style.IsSet(0x10000)) { base.ViewState.Remove("VerticalPadding"); base.ClearBit(0x10000); } if (style.IsSet(0x20000)) { base.ViewState.Remove("HorizontalPadding"); base.ClearBit(0x20000); } } else { if (style.IsSet(0x10000)) { this.VerticalPadding = style.VerticalPadding; } if (style.IsSet(0x20000)) { this.HorizontalPadding = style.HorizontalPadding; } } if (style.IsSet(0x40000)) { this.NodeSpacing = style.NodeSpacing; } if (style.IsSet(0x80000)) { this.ChildNodesPadding = style.ChildNodesPadding; } if (style.IsSet(0x100000)) { this.ImageUrl = style.ImageUrl; } } } }