PrintPreviewListBox.h
上传用户:hicheon
上传日期:2007-02-06
资源大小:34k
文件大小:3k
源码类别:

ListView/ListBox

开发平台:

Visual C++

  1. #if !defined(AFX_PRINTPREVIEWLISTBOX_H__2387B38F_AA48_4B5C_A515_C9E487058728__INCLUDED_)
  2. #define AFX_PRINTPREVIEWLISTBOX_H__2387B38F_AA48_4B5C_A515_C9E487058728__INCLUDED_
  3. #if _MSC_VER > 1000
  4. #pragma once
  5. #endif // _MSC_VER > 1000
  6. // PrintPreviewListBox.h : header file
  7. //
  8. /////////////////////////////////////////////////////////////////////////////
  9. // CPrintPreviewListBox window
  10. #include <afxtempl.h>
  11. /*****************************************************************************/
  12. /*                                                                           */
  13. /* .CLASSNAME: [CPrintPreviewListBox           ]                             */
  14. /*                                                                           */
  15. /* .BASECLASSNAMES:                                                          */
  16. /*  CListBox, .....                                                          */
  17. /*                                                                           */
  18. /* .DESCRIPTION:                                                             */
  19. /*  .......                                                                  */
  20. /*                                                                           */
  21. /* .REPORT                                                                   */
  22. /*  dd.mm.yy  Goran      Extended CListBox class                             */
  23. /*  ........  .........  ................................................... */
  24. /*                                                                           */
  25. /*****************************************************************************/
  26. class CPrintPreviewListBox : public CListBox
  27. {
  28. CFont m_printerFont;
  29. UINT m_cyPrinter;
  30. UINT m_nLinesPerPage;
  31. UINT m_nLinesTotal;
  32. UINT m_cxOffset;
  33. UINT m_cxWidth;
  34. CString m_strTitle;
  35. bool m_bPrintOnlySelectedItems;
  36. bool m_bIsMultiselection;
  37. CArray<int,int> aryListBoxSel;
  38. CStringArray m_strarFinalArray;
  39. protected:
  40. virtual int SetLinesTotal();
  41. void LineBreaking( CString sSelectedItem );
  42. virtual void PrintPageHeader (CDC*, UINT);
  43. virtual void PrintPage (CDC*, UINT);
  44. // Construction
  45. public:
  46. CPrintPreviewListBox();
  47. DECLARE_DYNCREATE(CPrintPreviewListBox)
  48. // Attributes
  49. public:
  50. // Operations
  51. public:
  52. void Print();
  53. void SetPrintTitle( CString sNewTitle = "Default title" );
  54. CString GetPrintTitle();
  55. void SetOnlySelectedItems( bool bOnlySelectedItems );
  56. bool GetOnlySelectedItems();
  57. virtual void OnBeginPrinting (CDC*, CPrintInfo*);
  58. virtual void OnPrint (CDC*, CPrintInfo*);
  59. virtual void OnEndPrinting (CDC*, CPrintInfo*);
  60. // Overrides
  61. // ClassWizard generated virtual function overrides
  62. //{{AFX_VIRTUAL(CPrintPreviewListBox)
  63. //}}AFX_VIRTUAL
  64. // Implementation
  65. public:
  66. virtual ~CPrintPreviewListBox();
  67. // Generated message map functions
  68. protected:
  69. //{{AFX_MSG(CPrintPreviewListBox)
  70. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  71. //}}AFX_MSG
  72. DECLARE_MESSAGE_MAP()
  73. };
  74. /*****************************************************************************/
  75. /////////////////////////////////////////////////////////////////////////////
  76. //{{AFX_INSERT_LOCATION}}
  77. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  78. #endif // !defined(AFX_PRINTPREVIEWLISTBOX_H__2387B38F_AA48_4B5C_A515_C9E487058728__INCLUDED_)