Windows Forms control Development example
Duncan Macenzie
Microsoft Developer Network
May 2002
Abstract: This article describes how to add the data binding function to the TreeView control. It is one of a series of Microsoft Windows control Development examples. You can read this article in conjunction with the relevant summary article.
You can download the WinFormControls.exe source Code from the MSDN Code Center. (Note that in the example file, the comments of programmers are in English. In this document, the comments are translated into Chinese to facilitate your understanding .)
This document describes how to use. the fourth article (five in total) in the control development series in. NET: Developing Custom Windows Controls Using Visual Basic. NET (overview) (English) Adding Regular Expression Validation (English) Combining Multiple Controls into One (English) extended TreeView control Drawing Your Own Controls Using GDI + (English) directory introduction design data binding tree view implement data binding use the CurrencyManager object to convert DataSource into a tree example application summary introduction
When possible, you should first use some ready-made controls because the provided Microsoft® Windows® forms controls contain a large number of codes and test results. If you want to discard them from the beginning, it is undoubtedly a huge waste. Based on this, in this example, I will inherit an existing Windows Forms control TreeView and then customize it. When downloading the code of the TreeView control, you will also get an additional control Development example and a sample application that demonstrates how to use the enhanced TreeView together with other data binding controls. Design the data binding tree view
For Windows developers, adding data binding to the TreeView control is a common problem, but because of the TreeView and other controls (such as ListBox or DataGrid) there is a major difference (that is, the TreeView displays hierarchical data), so the basic control currently does not support this function (that is, we must also use it ). Given a data table, you will know how to display this information in ListBox or DataGrid. However, it is not so easy to use the layered features of TreeView to display the same data. Personally, I have applied many different methods when using TreeView to display data. However, one of the most common methods is to group data in a table by certain fields, as shown in Figure 1.
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.