Tài liệu Creating Custom .NET Controls with C#

Thảo luận trong 'Lập Trình' bắt đầu bởi Thúy Viết Bài, 5/12/13.

  1. Thúy Viết Bài

    Thành viên vàng

    Bài viết:
    198,891
    Được thích:
    173
    Điểm thành tích:
    0
    Xu:
    0Xu
    Windows programmers have a wide variety of controls to choose from in the System.Windows.Forms
    namespace in .NET's Framework class library. You have controls as simple as Label, TextBox, and CheckBox,
    as well as controls as sophisticated as the MonthCalendar and ColorDialog controls. These Windows controls
    are more than enough for most applications; however, sometimes you need controls that are not available from
    the standard library. In these circumstances, you have to roll up your sleeves and write your own. This article
    shows you how to develop a custom control with C# and presents a simple custom control.
    Before you start writing the first line of code for your custom control, you should familiarize yourself with two
    classes in the System.Windows.Forms namespace: Control and UserControl. The Control class is important
    because it is the parent class of Windows visual components. Your custom class will be a descendent of the
    Control class as well. Your custom controls, however, don't normally inherit directly from the Control class.
    Instead, you extend the UserControl class. The first two sections of this article discuss these two classes. In
    the final section, you'll build your own custom control, the RoundButton control.
     

    Các file đính kèm:

Đang tải...