[PersistChildren(), ParseChildren(), PermissionSet(SecurityAction.LinkDemand, XML=), PermissionSet(SecurityAction.InheritanceDemand, XML=)] WebControl : Control, IAttributeAccessor { int accessKeySet = ; AttributeCollection attrColl; StateBag attrState; Style controlStyle; int deferStyleLoadViewState = ; int disabled = ; int disabledDirty = ; SimpleBitVector32 flags; int tabIndexSet = ; HtmlTextWriterTag tagKey; string tagName; int toolTipSet = ; WebControl() : this(HtmlTextWriterTag.Span) { } WebControl(string tag) { .tagKey = HtmlTextWriterTag.Unknown; .tagName = tag; } WebControl(HtmlTextWriterTag tag) { .tagKey = tag; } void AddAttributesToRender(HtmlTextWriter writer) { string accessKey; (.ID != ) { writer.AddAttribute(HtmlTextWriterAttribute.Id, .ClientID); } (.flags[]) { accessKey = .AccessKey; (accessKey.Length > ) { writer.AddAttribute(HtmlTextWriterAttribute.Accesskey, accessKey); } } (!.Enabled) { writer.AddAttribute(HtmlTextWriterAttribute.Disabled, ); } (.flags[]) { int tabIndex = .TabIndex; (tabIndex != ) { writer.AddAttribute(HtmlTextWriterAttribute.Tabindex, tabIndex.ToString(NumberFormatInfo.InvariantInfo)); } } (.flags[]) { accessKey = .ToolTip; (accessKey.Length > ) { writer.AddAttribute(HtmlTextWriterAttribute.Title, accessKey); } } (.ControlStyleCreated && !.ControlStyle.IsEmpty) { .ControlStyle.AddAttributesToRender(writer, ); } (.attrState != ) { AttributeCollection attributes = .Attributes; IEnumerator enumerator = attributes.Keys.GetEnumerator(); (enumerator.MoveNext()) { string current = (string) enumerator.Current; writer.AddAttribute(current, attributes[current]); } } } void ApplyStyle(Style s) { ((s != ) && !s.IsEmpty) { .ControlStyle.CopyFrom(s); } } void CopyBaseAttributes(WebControl controlSrc) { (controlSrc.flags[]) { .AccessKey = controlSrc.AccessKey; } (!controlSrc.Enabled) { .Enabled = ; } (controlSrc.flags[]) { .ToolTip = controlSrc.ToolTip; } (controlSrc.flags[]) { .TabIndex = controlSrc.TabIndex; } (string str controlSrc.Attributes.Keys) { .Attributes[str] = controlSrc.Attributes[str]; } } Style CreateControlStyle() { Style(.ViewState); } void LoadViewState(object savedState) { (savedState != ) { Pair pair = (Pair) savedState; .LoadViewState(pair.First); (.ControlStyleCreated || (.ViewState[] != )) { .ControlStyle.LoadViewState(); } { .flags[] = ; } (pair.Second != ) { (.attrState == ) { .attrState = StateBag(); .attrState.TrackViewState(); } .attrState.LoadViewState(pair.Second); } } object obj2 = .ViewState[]; (obj2 != ) { .flags[] = !((bool) obj2); .flags[] = ; } (((IDictionary) .ViewState).Contains()) { .flags[] = ; } (((IDictionary) .ViewState).Contains()) { .flags[] = ; } (((IDictionary) .ViewState).Contains()) { .flags[] = ; } } void MergeStyle(Style s) { ((s != ) && !s.IsEmpty) { .ControlStyle.MergeWith(s); } } void Render(HtmlTextWriter writer) { .RenderBeginTag(writer); .RenderContents(writer); .RenderEndTag(writer); } void RenderBeginTag(HtmlTextWriter writer) { .AddAttributesToRender(writer); HtmlTextWriterTag tagKey = .TagKey; (tagKey != HtmlTextWriterTag.Unknown) { writer.RenderBeginTag(tagKey); } { writer.RenderBeginTag(.TagName); } } void RenderContents(HtmlTextWriter writer) { .Render(writer); } void RenderEndTag(HtmlTextWriter writer) { writer.RenderEndTag(); } object SaveViewState() { Pair pair = ; (.flags[]) { .ViewState[] = !.flags[]; } (.ControlStyleCreated) { .ControlStyle.SaveViewState(); } object x = .SaveViewState(); object y = ; (.attrState != ) { y = .attrState.SaveViewState(); } ((x == ) && (y == )) { pair; } Pair(x, y); } string IAttributeAccessor.GetAttribute(string name) { (.attrState == ) { ; } (string) .attrState[name]; } void IAttributeAccessor.SetAttribute(string name, string value) { .Attributes[name] = value; } void TrackViewState() { .TrackViewState(); (.ControlStyleCreated) { .ControlStyle.TrackViewState(); } (.attrState != ) { .attrState.TrackViewState(); } } [WebSysDescription(), DefaultValue(), Bindable(), WebCategory()] string AccessKey { { (.flags[]) { string str = (string) .ViewState[]; (str != ) { str; } } string.Empty; } { (( != ) && (.Length > )) { ArgumentOutOfRangeException(); } .ViewState[] = ; .flags[] = ; } } [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), WebSysDescription(), Browsable()] AttributeCollection Attributes { { (.attrColl == ) { (.attrState == ) { .attrState = StateBag(); (.IsTrackingViewState) { .attrState.TrackViewState(); } } .attrColl = AttributeCollection(.attrState); } .attrColl; } } [WebCategory(), DefaultValue((Color), ), WebSysDescription(), TypeConverter((WebColorConverter)), Bindable()] Color BackColor { { (!.ControlStyleCreated) { Color.Empty; } .ControlStyle.BackColor; } { .ControlStyle.BackColor = ; } } [Bindable(), WebCategory(), WebSysDescription(), TypeConverter((WebColorConverter)), DefaultValue((Color), )] Color BorderColor { { (!.ControlStyleCreated) { Color.Empty; } .ControlStyle.BorderColor; } { .ControlStyle.BorderColor = ; } } [DefaultValue(), Bindable(), WebCategory(), WebSysDescription()] BorderStyle BorderStyle { { (!.ControlStyleCreated) { BorderStyle.NotSet; } .ControlStyle.BorderStyle; } { .ControlStyle.BorderStyle = ; } } [Bindable(), DefaultValue((Unit), ), WebSysDescription(), WebCategory()] Unit BorderWidth { { (!.ControlStyleCreated) { Unit.Empty; } .ControlStyle.BorderWidth; } { (.Value < ) { ArgumentOutOfRangeException(); } .ControlStyle.BorderWidth = ; } } [WebSysDescription(), Browsable(), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] Style ControlStyle { { (.controlStyle == ) { .controlStyle = .CreateControlStyle(); (.IsTrackingViewState) { .controlStyle.TrackViewState(); } (.flags[]) { .flags[] = ; .controlStyle.LoadViewState(); } } .controlStyle; } } [Browsable(), WebSysDescription(), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] bool ControlStyleCreated { { (.controlStyle != ); } } [WebCategory(), DefaultValue(), WebSysDescription(), Bindable()] string CssClass { { (!.ControlStyleCreated) { string.Empty; } .ControlStyle.CssClass; } { .ControlStyle.CssClass = ; } } [WebCategory(), DefaultValue(), WebSysDescription(), Bindable()] bool Enabled { { !.flags[]; } { bool flag = !.flags[]; (flag != ) { .flags[] = !; (.IsTrackingViewState) { .flags[] = ; } } } } [NotifyParentProperty(), DefaultValue((string) ), WebSysDescription(), DesignerSerializationVisibility(DesignerSerializationVisibility.Content), WebCategory()] FontInfo Font { { .ControlStyle.Font; } } [WebSysDescription(), TypeConverter((WebColorConverter)), Bindable(), WebCategory(), DefaultValue((Color), )] Color ForeColor { { (!.ControlStyleCreated) { Color.Empty; } .ControlStyle.ForeColor; } { .ControlStyle.ForeColor = ; } } bool HasAttributes { { (((.attrColl != ) && (.attrColl.Count > )) || ((.attrState != ) && (.attrState.Count > ))); } } [WebCategory(), WebSysDescription(), DefaultValue((Unit), ), Bindable()] Unit Height { { (!.ControlStyleCreated) { Unit.Empty; } .ControlStyle.Height; } { (.Value < ) { ArgumentOutOfRangeException(); } .ControlStyle.Height = ; } } [WebSysDescription(), Browsable(), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] CssStyleCollection Style { { .Attributes.CssStyle; } } [WebCategory(), DefaultValue((short) ), WebSysDescription()] short TabIndex { { (.flags[]) { object obj2 = .ViewState[]; (obj2 != ) { (short) obj2; } } ; } { .ViewState[] = ; .flags[] = ; } } [Browsable(), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] HtmlTextWriterTag TagKey { { .tagKey; } } [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable()] string TagName { { ((.tagName == ) && (.tagKey != HtmlTextWriterTag.Unknown)) { .tagName = Enum.Format((HtmlTextWriterTag), .tagKey, ).ToLower(CultureInfo.InvariantCulture); } .tagName; } } [Bindable(), DefaultValue(), WebSysDescription(), WebCategory()] string ToolTip { { (.flags[]) { string str = (string) .ViewState[]; (str != ) { str; } } string.Empty; } { .ViewState[] = ; .flags[] = ; } } [DefaultValue((Unit), ), WebSysDescription(), Bindable(), WebCategory()] Unit Width { { (!.ControlStyleCreated) { Unit.Empty; } .ControlStyle.Width; } { (.Value < ) { ArgumentOutOfRangeException(); } .ControlStyle.Width = ; } } }
转载于:https://www.cnblogs.com/sincerefire/archive/2010/02/21/1670596.html