home *** CD-ROM | disk | FTP | other *** search
/ Prima Shareware 3 / DuCom_Prima-Shareware-3_cd1.bin / PROGRAMO / C / CKTBL / MFC / MFC.TXT < prev   
Encoding:
Text File  |  1994-09-09  |  2.2 KB  |  65 lines

  1. The CKTBL API is wrapped for MFC by the class CCKTBLControl
  2. -----------------------------------------------------------
  3.  
  4. To include CKTBL in your MFC Application perform following steps:
  5.  
  6. 1.    Include CKTBLCTR.CPP in your project
  7. 2.    Include CKTBL.LIB in your project
  8.  
  9. To create a CKTBL Window
  10.  
  11. 1.    Add a member variable of type CCKTBLControl to your view.
  12.  
  13. 2.    Add code for the WM_CREATE Message of your view to create a 
  14.     CCKTBLControl as a child window. This is a good place to set initial
  15.     size and flags.
  16.  
  17. 3.    Add code for the WM_SIZE message of your view to delegate
  18.     resizing to the table control.
  19.  
  20. In case you need to change the behaviour of the Table Control or intercept 
  21. events you need to subclass CCKTBLControl and override the virtual methods 
  22. marked as overridable in the class.  See the comments in CKTBLCTR.CPP. 
  23. They explain the semantics involved with these events.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29. To user the printing features in CCKTBLControl
  30. ----------------------------------------------
  31.  
  32. See the MFCDEMO example for an implementation
  33.  
  34. Add following methods to your view:
  35.  
  36. void CYourView::OnPrint( CDC* pDC, CPrintInfo* pInfo )
  37. {                                 
  38.     // Print table
  39.     // use CKTBL printing routine
  40.  
  41.     cktbl->SetMargins( pDC, pInfo );          // Sets margins in pInfo
  42.     cktbl->OnPrint( pDC, pInfo );           // Prints page specified in pInfo
  43. }
  44.  
  45. void CMfcdemoView::OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo)
  46. {
  47.     // Perform print time pagination
  48.     // TODO: add extra initialization before printing 
  49.  
  50.     CView::OnBeginPrinting( pDC, pInfo );          
  51.     cktbl->OnBeginPrinting( pDC, pInfo );    // Initializes pInfo
  52.     cktbl->SetMargins( pDC, pInfo );        // Sets margins in pInfo
  53.     cktbl->Paginate( pDC, pInfo );            // Paginates into pInfo
  54. }
  55.  
  56. If you want to extend the printout with your own headers footers etc... you
  57. need to make the rectangle in CPrintInfo smaller.  CCKTBLControl always prints 
  58. and paginates inside 'pInfo->m_Rect'.  Be sure the pass the same rectagle in
  59. both OnPrint and OnBeginPrinting methods.  The call to SetMargins is optional.
  60. It is only provided to have a sensible default.  Check the source in 
  61. CCKTBLControl for an example.
  62.  
  63.  
  64.  
  65.