Đang chuẩn bị liên kết để tải về tài liệu:
Beginning Visual C plus plus phần 8
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Điều khiển có thể có hoặc không có thể được liên kết với một đối tượng lớp. Điều khiển tĩnh không làm bất cứ điều gì trực tiếp, vì vậy một lớp đối tượng liên quan có thể có vẻ không cần thiết, tuy nhiên, có một lớp MFC, CStatic, cung cấp các chức năng cho phép bạn thay đổi sự xuất hiện của điều khiển tĩnh. | Chapter 16 A control may or may not be associated with a class object. Static controls don t do anything directly so an associated class object may seem superfluous however there s an MFC class CStatic that provides functions to enable you to alter the appearance of static controls. Button controls can also be handled by ỉimpo PDFdlMergớand SplitcUnregistered Versioho-http www.simpopdf.corrntuations where you need a class object to manage a control. MFC also provides a full complement of classes to support the other controls. Because a control is a window they are all derived from CWnd. Common Controls The set of standard controls that are supported by MFC and the Resource editor are called common controls. Common controls include all of the controls you have just seen as well as other more complex controls such as the animate control for example which has the capability to play an AVI Audio Video Interleaved file and the tree control that can display a hierarchy of items in a tree. Another useful control in the set of common controls is the spin button. You can use this to increment or decrement values in an associated edit control. To go into all of the possible controls that you might use is beyond the scope of this book so I ll just take a few illustrative examples including an example that uses a spin button and implement them in the Sketcher program. Creating a Dialog Resource Here s a concrete example. You could add a dialog to Sketcher to provide a choice of pen widths for drawing elements. This ultimately involves modifying the current pen width in the document as well as in the CElement class and adding or modifying functions to deal with pen widths. You ll deal with all that though after you ve got the dialog together. Display the Resource View expand the resource tree for Sketcher and right-click the Dialog folder in the tree then click Insert Dialog from the pop-up to add a new dialog resource to Sketcher. This results in the Dialog Resource editor .