tailieunhanh - Beginning Microsoft Visual Basic 2008 phần 7

Bây giờ bạn biết rằng bạn có thể lựa chọn màu sắc từ một danh sách các khả năng cũng như định nghĩa của riêng bạn. Điều cuối cùng bạn cần phải tìm hiểu về màu sắc là ý tưởng màu sắc hệ thống. Khi sử dụng Windows, người dùng có khả năng xác định tất cả các màu sắc được sử dụng cho những thứ như các nút, menu, chú thích, | Chapter 15 Programming Custom Graphics Using System Colors Now you know that you can choose colors from a list of possibilities as well as define your own. The final thing you need to learn about colors is the idea of system colors. When using Windows the user has the ability to define all of the colors that are used for things like buttons menus captions and so on. If you re building the UI for your own controls it s reasonable to assume that from time to time you ll need to know what these colors are so that your controls have the same look and feel as the existing controls in the system. System colors are exposed through the class. If you want to find a list of all the system colors look in the MSDN documentation under class. Alternatively use IntelliSense when in the Code Editor or the Object Browser. In this Try It Out you ll add a button to the control palette that is the same as the menu bar. Try It Out Adding System Colors 1. Open the Code Editor for . Find the constructor and add the following highlighted code Public Sub New This call is required by the Windows Form Designer. InitializeComponent Add any initialization after the InitializeComponent call. Add the colors AddColor AddColor AddColor AddColor AddColor AddColor AddColor AddColor AddColor AddColor AddColor 208 112 222 AddColor End Sub 2. Run the project. You should see a new color that matches the menu bar color. 519 Chapter 15 Programming Custom Graphics Using Different Tools Now that you have successfully cracked the nut of drawing filled circles on the page turn your attention to building the other tools that you can use to put your applications together. In the next Try It Out you add a menu that lets you select the tool you want. If you need a .