WINFORM properties of the UserControl property

Source: Internet
Author: User

The custom control is very flexible and I replace the picture of the control with the field {Get;set;}. However, because it is a relative path, during the IDE editing process, the drag control enters with an error that the picture cannot be accessed. The reason is that all public fields are automatically assigned the initial value (Bool,enum) when you drag the control. To solve this problem, I'm looking for ways to prevent certain fields from being assigned automatically when the control is dragged into the IDE. Finally, the ReadOnly features in the UserControl feature are found:[ReadOnly (true)]Public bool Isselected{get;set;Cnblog PS: Found that there are many things can not be used, too ashamed. Fill it up quickly. 1. BindableThis attribute indicates whether a property can be bound to a valid data source. It is usually set with a Boolean value. For example: Bindable (True). If you use the value true to mark a property, the property can be bound to a valid data source, and the property change notification should be raised for that property. 2. browsableSpecifies whether the property should be displayed in the property browser, using a Boolean setting. Typically, the function properties and those properties that you want to display in the property browser are set to Browsable (true), read-only properties, and those properties that you do not want to see in the property browser are set to Browsable (false). 3. CategorySpecifies the category in which properties are grouped in the property browser. This design-time feature helps the visual editor logically group properties. This is typically divided into: appearance (appearance), Behavior (Behavior), layout, data, action (action), keyboard (key), and mouse (Mouse). In addition, you can customize the grouping category. 4. DescriptionWhether the control or event is displayed in the IntelliSense window.  Never not shown, always shown, advanced is only shown in advanced user mode, advanced user mode can be tools| Options | TextEditor | Start in C #. 5. EditorbrowsableWhether the control or event is displayed in the IntelliSense window.  Never not shown, always shown, advanced is only shown in advanced user mode, advanced user mode can be tools| Options | TextEditor | Start in C #. 6. DesignerSerializationVisibilityAn enumeration value that specifies whether and how the property is serialized in code with a value of designerserializationvisibility. There are 3 ways to set up: DesignerSerializationVisibility (Designerserializationvisibility.hidden) specifies that the serializer should not serialize property values ; DesignerSerializationVisibility (designerserializationvisibility.visible) specifies that the serializer should be allowed to serialize the value of the property ; DesignerSerializationVisibility (designerserializationvisibility.content) specifies that the serializer should serialize the contents of the property, not the property itself. This field is read-only: Visible is its default value. 7. NotifyparentpropertyIndicates that the Parent property is notified when the value of the property to which this attribute is applied is modified. In other words, if the parent property of the property should be notified when the property value is changed, the Notifyparentproperty attribute is applied to the property. It is usually set with a Boolean value. 8. ParseChildrenUse this attribute to indicate whether an XML element nested within a server control tag should be treated as a property or as a child control when the control is used declaratively on a page. Typically, there are two ways of declaring: ①parsechildren (true), which parses a child XML element as a child control of a server control; ②parsechildren (bool Childrenasproperty, string Defaultproperty), where Childrenasproperty and mode ① have the same meaning as the Boolean parameter, Defaultproperty defines the child control as the collection property of the server control by default. 9. PersistChildrenThis attribute indicates whether the child controls of the server control should be persisted as internal nested controls at design time. If the attribute is PersistChildren (true), the child control of the server control is persisted as a nested server control tag. If PersistChildren (false), the control's properties are persisted as nested elements. Ten. PersistenceModeSpecifies how to persist server control properties or events to the metadata property of an ASP. Coexistence in 4 enumeration settings: ①persistencemode (Persistencemode.attribute), specifying that properties or events remain as attributes; ②persistencemode ( Persistencemode.encodedinnerdefaultproperty), which specifies that the property value is HTML-encoded and can only be specified for the string as the only internal text of the server control; ③persistencemode ( Persistencemode.innerdefaultproperty), specifies that the property remains internal to the server control, that the property is defined as the default property of the element, and that only one property is specified as the default property; ④persistencemode ( Persistencemode.innerproperty), specifies that properties are persisted as nested tags in server controls, which are typically used for complex objects that have their own persistence properties.
Defaultproperty.Specifies the default properties of the server control, such as [Defaultproperty ("MyProperty")]. Defaultproperty.Specifies the default properties of the server control, such as [Defaultproperty ("MyProperty")]. ReadOnly.Specifies whether the sex is read-only. <true/false> TypeConverter.Specifies the type of converter to be used as the object to which this attribute is bound. The class used for the transformation must inherit from TypeConverter. Use the Convertertypename property to get the class name that provides the data transformation for the object to which the attribute is bound. 15. Cases. For example, the witfieldname of the control is shown in the "Cswit" group with the initial value "", described as "the name of the field in the control's library" [Bindable (True),Category ("Cswit"),DefaultValue ("") Description ("The name of the field in the control's repository. ")]Public string Witfieldname  {Get          {return strfieldname;          } Set         {strfieldname = value;          }  }

WINFORM properties of the UserControl property

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.