Source code analysis of list controls of issuevision

Source: Internet
Author: User

========================================================== ======

Me. setstyle why is there no smart awareness?

========================================================== ======

Datarowview: when data is displayed (for example, in the DataGrid Control), only one version is displayed for each row. The displayed row is datarowview.

Datarowview can have one of the following four different versions: Default, original, current, and proposed.

After beginedit is called for datarow, any edited value is changed to the proposed value. Before canceledit or endedit is called, the row has the original and proposed versions. If canceledit is called, the recommended version is discarded and the value is restored to the original value. If endedit is called, datarowview no longer has the proposed version. On the contrary, the recommended value is the current value. The default value is only available for rows with defined default values.

========================================================== ======

<Category ("data"), designerserializationvisibility (designerserializationvisibility. Content)>

========================================================== ======

When serialization Program When the design pattern document remains sustainable, it is usually added to the component's Initialization Method Code To keep the attribute values that have been set at design time. If you have not set a feature to indicate other behaviors, this is the case for most base types by default.

Designerserializationvisibilityattribute allows you to indicate whether the attribute value is visible, whether it should be kept in the initialization code, hidden, whether it should not be kept in the initialization code, and whether it is composed of content, it should have the initialization code generated for each public attribute (rather than hidden attribute) of the object assigned to this property.

Members without designerserializationvisibilityattribute are considered to have a designerserializationvisibilityattribute with a value of visible. If possible, the serialization program serializes the property value marked as visible to this type. To specify custom serialization for a specific type or attribute, use designerserializerattribute.

========================================================== ======

Control. suspendlayout Method

The layout logic of the control is suspended until the resumelayout method is called.

When you adjust multiple attributes of a control, multiple layout events are canceled by using the suspendlayout and resumelayout methods. For example, we usually call the suspendlayout method first, then set the size, location, anchor, or dock attribute of the control, and finally call the resumelayout method for the change to take effect.

========================================================== ======

Directcast keyword introduces the type conversion operation. This keyword is used in the same way as the ctype keyword, as shown in the following code:

Dim Q as object = 2.37 'requires option strict to be off.

Dim I as integer = ctype (Q, integer) 'succeeds.

Dim J as integer = directcast (Q, integer) 'fails.

The expression to be converted between the two keywords is used as the first parameter, and the type to be converted is used as the second parameter. If the conversion between the data type of the undefined expression and the data type specified by the second parameter fails, both types of conversion will fail.

The difference between the two keywords is that, as long as a valid Conversion Between Expressions and types is defined, ctype can be successful, while directcast requires that the runtime type of the object variable be the same as the specified type. However, if the specified expression type and runtime type are the same, the running performance of directcast is better than that of ctype.

========================================================== ========

Why are controls added in reverse order?

'Add Reversely

For I as integer = Al. Count to 0 step-1

Controls. Add (directcast (Al (I), control ))

Next

========================================================== ========

Set the relationship between the dual buffer and graphic release. Do not release graphic immediately if the dual buffer is set. Otherwise, an error occurs when the drawing is not completed.

The above records mainly the learning notes based on code. Later, I carefully analyzed the structure at night. I really think this control is well designed. Let's talk about the structure below.

The entire list is actually composed of different sectioncontrol and spliter controls. Why is spliter used to control the scaling of each sectioncontrol? This method saves a lot of work. The enabled attribute of spliter is false, which makes it useless if you place the mouse over it. It is hard to understand this without looking at the code.

The processing of each sectioncontrol is also clever. First, a picturebox is arranged on the interface to display the "+" "-" icon. Second, you can use a paint brush to draw the header and each item.

The most important thing is the event trigger process. The onpaint of sectioncontrol is the basis. It sends the draw message to the upper-layer control, thus driving the message driver of the entire control.

In terms of the upstream icon control, it is actually implemented by rewriting the drawing.

Now we can see that the entire list is actually composed of different parts. With the help of event message delivery, we can draw the entire interface and extend the list function by rewriting some specific functions.

Of course, the above section does not involve data processing, because it hasn't been read yet. Here, take a note to avoid forgetting it later.

View code + write code + msdn + Google = the best way to learn


Related Article

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.