对话框编程1.docVIP

  • 11
  • 0
  • 约6.69万字
  • 约 40页
  • 2016-11-27 发布于河南
  • 举报
对话框编程1

对话框编程 在环境VC6.0完成 新建一个MFC单文档应用程序工程,取名MyDlg,然后插入一个新Dialog,对话框资源也有一个类CDialog. CDialog The CDialog class is the base class used for displaying dialog boxes on the screen. Dialog boxes are of two types: modal and modeless. A modal dialog box must be closed by the user before the application continues. A modeless dialog box allows the user to display the dialog box and return to another task without canceling or removing the dialog box. A CDialog object is a combination of a dialog template and a CDialog-derived class. Use the dialog editor to create the dialog template and store it in a resource, then use ClassWizard to create a class derived from CDialog. A dialog box, like any other window, receives messages from Windows. In a dialog box, you are particularly interested in handling notification messages from the dialog box’s controls since that is how the user interacts with your dialog box. ClassWizard browses through the potential messages generated by each control in your dialog box, and you can select which messages you wish to handle. ClassWizard then adds the appropriate message-map entries and message-handler member functions to the new class for you. You only need to write application-specific code in the handler member functions. If you prefer, you can always write message-map entries and member functions yourself instead of using ClassWizard. In all but the most trivial dialog box, you add member variables to your derived dialog class to store data entered in the dialog box’s controls by the user or to display data for the user. ClassWizard browses through those controls in your dialog box that can be mapped to data and prompts you to create a member variable for each control. At the same time, you choose a variable type and permissible range of values for each variable. ClassWizard adds the member variables to your derived dialog class. ClassWizard then writes a data map to automatically handle the exchange of data between the member variables and the

文档评论(0)

1亿VIP精品文档

相关文档