TAILIEUCHUNG - Visual Basic .NET at Work Building 10 Enterprise Projects phần 2

Bây giờ bạn có thể thêm bất kỳ hình thức nào bạn thích dựa trên các hình thức mà bạn chỉ cần nạp. Ví dụ, chúng ta sẽ tạo ra một hình thức dựa trên hình thức frmBase. Nhấp chuột phải vào tên dự án trong giao diện dự án và chọn Add / Thêm mẫu thừa kế. | 30 Project 1 Now you can add any forms you like based on the forms you just loaded. As an example we will create a form based on the frmBase form. Right-click on the project name in the Project view and select Add Add Inherited Form. Type in a name for the form and then click Open. On the next window as in Figure select the form from which you want to inherit. Select the frmBase form and click OK. Now you have an inherited form in your program. Even though you haven t done anything to it yet you ll see that the form has all the controls from the base form already in place. One important point to note here is that the controls from the base form are locked and cannot be edited in the Form Designer. You ll have to do it through properties or in code. Creating a Class Library The better way to incorporate these forms into your program is to build a class library that contains them. Didn t know you could do that did you WinForms are just classes like anything else now. We can place them in a DLL and use them in other programs. Here s the easy way to do it. Create a new Class Library project in Visual Studio. Name it prj01classes. When the project creation is complete delete the default class Class1 from the project and add the form files to the project. Right-click on the solution name in the solution explorer and from the context menu select Add Existing Item. Select all the form .VB and .RESX files and add them to the project. Build the project. When you re done you ll have a DLL you can add to any project. Want to try it out Create a new WinForms project naming it whatever you like. Right-click on the References section in Solution Explorer and from the context menu select Add Reference. In the dialog that appears click the Browse button and find the DLL we just created select it and click OK. Click OK on the original dialog. Now you can add a new inherited form to the project. When the Inherited Form dialog appears type in a new name for the form and click .

TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
34    211    1    20-04-2024
46    186    0    20-04-2024
8    170    0    20-04-2024
23    154    0    20-04-2024
10    115    0    20-04-2024
75    136    0    20-04-2024
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.