属性页表单之间的页面,如page1,page2间如何交换数据?谢谢高手指教~~ 
最好给一个例子~呵呵,谢谢!

解决方案 »

  1.   

    ((CPropertySheet*)GetParent())->m_Page2->....
    OnActive
      

  2.   

    我也遇到这个问题  
    很郁闷 楼上有位兄弟说的不行
    ************
    ((CPropertySheet*)GetParent())->m_Page2->....
    OnActive
    ******
    编译器会说 不认识CPropertySheet
    如果你为了让编译器认识它  在CPropertyPage 里加上了CPropertySheet类的头文件(如:PropertySheet.h)
    但是你会发现  在这个CPropertySheet类的头文件里  包含了CPropertyPage的头文件(如:
    PropertyPage.h)
    这就产生了新问题  两个头文件PropertySheet.h , PropertyPage.h 互相包含 !
      

  3.   

    属性页应置于Dialog内:
    To use a property sheet in your application, complete the following steps: Create a dialog template resource for each property page. Keep in mind that the user may be switching from one page to another, so lay out each page as consistently as possible.
    The dialog templates for all pages do not have to be the same size. The framework uses the size of the largest page to determine how much space to allocate in the property sheet for the property pages.When you create the dialog template resource for a property page, you must specify the following styles in the Dialog Properties property sheet:Set the Caption edit box on the General page to the text you wish to appear in the tab for this page.
    Set the Style list box on the Styles page to Child.
    Set the Border list box on the Styles page to Thin.
    Ensure that the Titlebar check box on the Styles page is selected.
    Ensure that the Disabled check box on the More Styles page is selected. 
    Use ClassWizard to create aCPropertyPage-derived class corresponding to each property page dialog template. To do this, choose ClassWizard from the View menu while the focus is on a particular property page dialog box. Choose CPropertyPage as the base class in ClassWizard.
    Using ClassWizard, create member variables to hold the values for this property page. The process for adding member variables to a property page is exactly the same as adding member variables to a dialog box, because a property page is a specialized dialog box.
    Construct aCPropertySheet object in your source code. Usually, you construct the CPropertySheet object in the handler for the command that displays the property sheet. This object represents the entire property sheet. If you create a modal property sheet with theDoModal function, the framework supplies three command buttons by default: OK, Cancel, and Apply. The framework creates no command buttons for modeless property sheets created with theCreate function. You do not need to derive a class from CPropertySheet unless you want to either add other controls (such as a preview window) or display a modeless property sheet. This step is necessary for modeless property sheets because they do not contain any default controls that could be used to close the property sheet.
    For each page to be added to the property sheet, do the following:
    Construct one object for each CPropertyPage-derived class that you created using ClassWizard earlier in this process.
    CallCPropertySheet::AddPage for each page. 
    Typically, the object that creates the CPropertySheet also creates the CPropertyPage objects in this step. However, if you implement a CPropertySheet-derived class, you can embed the CPropertyPage objects in the CPropertySheet object and call AddPage for each page from the CPropertySheet-derived class constructor. AddPage adds the CPropertyPage object to the property sheet’s list of pages but does not actually create the window for that page. Therefore, it is not necessary to wait until creation of the property sheet window to call AddPage; you can call AddPage from the property sheet’s constructor.CallCPropertySheet::DoModal orCreate to display the property sheet. Call DoModal to create a property sheet as a modal dialog box. Call Create to create the property sheet as a modeless dialog box.
    Exchange data between property pages and the owner of the property sheet. This is explained in the article Property Sheets: Exchanging Data. 
      

  4.   

    在sheet类里面传递.
    首先sheet类里面有page的指针或变量吧,
    在sheet类里面,当page切换的时候有个消息函数,
    具体哪个函数我不太清楚,
    在这个函数里面传递page的值
    如:page1.m_edit1 = page2.m_edit2.
      

  5.   

    看了一下,可能是WM_ACTIVATE函数.
      

  6.   

    我也遇到这个问题
    很郁闷 楼上有位兄弟说的不行
    ************
    ((CPropertySheet*)GetParent())->m_Page2->....
    OnActive
    ******
    编译器会说 不认识CPropertySheet
    如果你为了让编译器认识它 在CPropertyPage 里加上了CPropertySheet类的头文件(如:PropertySheet.h)
    但是你会发现 在这个CPropertySheet类的头文件里 包含了CPropertyPage的头文件(如:
    PropertyPage.h)
    这就产生了新问题 两个头文件PropertySheet.h , PropertyPage.h 互相包含 !
    ============================================在page1.h中对sheet继承类进行声明
    //page1.h
    class CMySheet;
    class CPage1:......
    {
         CMySheet *m_pSheet;
    }//page1.cpp
    #include "Mysheet.h"
    CPage1::OnInitDialog()
    {
        m_pSheet = (CPropertySheet*)GetParent(); 
    }
    CPage1::Onbutton1()
    {
       m_pSheet->m_page2.m_str = "111";
    }