home *** CD-ROM | disk | FTP | other *** search
- // PrintDemoDlg.cpp : implementation file
- //
-
- #include "stdafx.h"
- #include "VCDemo.h"
- #include "PrintDemoDlg.h"
-
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CPrintDemoDlg dialog
-
-
- CPrintDemoDlg::CPrintDemoDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CPrintDemoDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CPrintDemoDlg)
- // NOTE: the ClassWizard will add member initialization here
- //}}AFX_DATA_INIT
- }
-
-
- void CPrintDemoDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CPrintDemoDlg)
- DDX_Control(pDX, IDC_SGCTRL1, m_ctrl);
- //}}AFX_DATA_MAP
- }
-
-
- BEGIN_MESSAGE_MAP(CPrintDemoDlg, CDialog)
- //{{AFX_MSG_MAP(CPrintDemoDlg)
- ON_BN_CLICKED(IDC_BUTTON_PREVIEW, OnButtonPreview)
- ON_BN_CLICKED(IDC_BUTTON_PRINT, OnButtonPrint)
- ON_BN_CLICKED(IDC_BUTTON_PREVIEW2, OnButtonPreview2)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
- /////////////////////////////////////////////////////////////////////////////
- // CPrintDemoDlg message handlers
-
- void CPrintDemoDlg::OnButtonPreview2()
- {
- // TODO: Add your control notification handler code here
- m_ctrl.DoSetCurrentPage( 1 );
-
- m_ctrl.DoSetCellString( 0,-1, "Stock" );
- m_ctrl.DoSetCellString( 1,-1, "Open");
- m_ctrl.DoSetCellString( 2,-1, "Rise/Drop");
- m_ctrl.DoSetCellString( 3,-1, "Volume" );
- m_ctrl.DoSetCellString( 4,-1, "10:10" );
- m_ctrl.DoSetCellString( 5,-1, "Volume" );
-
- m_ctrl.DoSetCellString( 0,0, "Microsoft" );
- m_ctrl.DoSetCellValue( 1,0, 27.50 );
- m_ctrl.DoSetCellValue( 2,0, -0.57);
- m_ctrl.DoSetCellValue( 3,0, 1116200 );
- m_ctrl.DoSetCellValue( 4,0, 27.60 );
- m_ctrl.DoSetCellValue( 5,0, 338700 );
-
- m_ctrl.DoSetCellString( 0,1, "IBM" );
- m_ctrl.DoSetCellValue( 1,1, 9.59 );
- m_ctrl.DoSetCellValue( 2,1, -1.94);
- m_ctrl.DoSetCellValue( 3,1, 317000 );
- m_ctrl.DoSetCellValue( 4,1, 9.7);
- m_ctrl.DoSetCellValue( 5,1, 45600 );
-
- m_ctrl.DoSetCellString( 0,2, "Oracle" );
- m_ctrl.DoSetCellValue( 1,2,11.3);
- m_ctrl.DoSetCellValue( 2,2, 0.89);
- m_ctrl.DoSetCellValue( 3,2, 333200 );
- m_ctrl.DoSetCellValue( 4,2, 11.21 );
- m_ctrl.DoSetCellValue( 5,2, 20700 );
-
- m_ctrl.DoSetCellString( 0,3, "Sybase" );
- m_ctrl.DoSetCellValue( 1,3, 13.52);
- m_ctrl.DoSetCellValue( 2,3, -2.02);
- m_ctrl.DoSetCellValue( 3,3, 378500 );
- m_ctrl.DoSetCellValue( 4,3, 13.68 );
- m_ctrl.DoSetCellValue( 5,3, 26500 );
-
- m_ctrl.DoSetCellString( 0,4, "Adobe" );
- m_ctrl.DoSetCellValue( 1,4, 15.82);
- m_ctrl.DoSetCellValue( 2,4, -1.12);
- m_ctrl.DoSetCellValue( 3,4, 799600 );
- m_ctrl.DoSetCellValue( 4,4, 15.81 );
- m_ctrl.DoSetCellValue( 5,4, 69600 );
-
- m_ctrl.DoSetCellString( 0,5, "Yahoo" );
- m_ctrl.DoSetCellValue( 1,5, 6.3);
- m_ctrl.DoSetCellValue( 2,5, -1.4);
- m_ctrl.DoSetCellValue( 3,5, 476000 );
- m_ctrl.DoSetCellValue( 4,5, 6.43 );
- m_ctrl.DoSetCellValue( 5,5, 195500 );
-
- m_ctrl.DoSetCellString( 0,6, "AOL" );
- m_ctrl.DoSetCellValue( 1,6,10.21);
- m_ctrl.DoSetCellValue( 2,6, -0.68);
- m_ctrl.DoSetCellValue( 3,6, 221300 );
- m_ctrl.DoSetCellValue( 4,6, 10.26 );
- m_ctrl.DoSetCellValue( 5,6, 21200 );
-
- m_ctrl.DoSetCellString( 0,7, "AT&T" );
- m_ctrl.DoSetCellValue( 1,7,9.1);
- m_ctrl.DoSetCellValue( 2,7, -2.04);
- m_ctrl.DoSetCellValue( 3,7, 1014800 );
- m_ctrl.DoSetCellValue( 4,7, 9.12);
- m_ctrl.DoSetCellValue( 5,7, 97000 );
-
- m_ctrl.DoSetCellString( 0,8, "North" );
- m_ctrl.DoSetCellValue( 1,8, 8.98);
- m_ctrl.DoSetCellValue( 2,8, -2.07);
- m_ctrl.DoSetCellValue( 3,8, 757300 );
- m_ctrl.DoSetCellValue( 4,8, 9.11 );
- m_ctrl.DoSetCellValue( 5,8, 154400 );
-
- m_ctrl.DoSetCurrentPage( 0 );
-
- m_ctrl.DoPrintPreviewPage( 1, TRUE );
- }
-
- void CPrintDemoDlg::OnButtonPrint()
- {
- // TODO: Add your control notification handler code here
- m_ctrl.DoPrint(TRUE);
- }
-
- BOOL CPrintDemoDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
-
- // TODO: Add extra initialization here
- m_ctrl.DoSetCellString( 0,0, "interest rate" );
- m_ctrl.DoSetCellString( 1,0, "3 month" );
- m_ctrl.DoSetCellString( 2,0, "half year" );
- m_ctrl.DoSetCellString( 3,0, "1 year" );
- m_ctrl.DoSetCellString( 4,0, "2 year" );
- m_ctrl.DoSetCellString( 5,0, "3 year" );
- m_ctrl.DoSetCellString( 6,0, "5 year" );
-
- m_ctrl.DoSetCellString( 0,1, "month rate" );
- m_ctrl.DoSetCellValue( 1,1, 2.4 );
- m_ctrl.DoSetCellValue( 2,1, 3.45 );
- m_ctrl.DoSetCellValue( 3,1, 4.725 );
- m_ctrl.DoSetCellValue( 4,1, 4.95 );
- m_ctrl.DoSetCellValue( 5,1, 5.175 );
- m_ctrl.DoSetCellValue( 6,1, 5.55 );
-
- m_ctrl.DoSetCellString( 0,2, "year rate" );
- m_ctrl.DoSetCellValue( 1,2, 2.88 );
- m_ctrl.DoSetCellValue( 2,2, 4.14 );
- m_ctrl.DoSetCellValue( 3,2, 5.67 );
- m_ctrl.DoSetCellValue( 4,2, 5.94 );
- m_ctrl.DoSetCellValue( 5,2, 6.21 );
- m_ctrl.DoSetCellValue( 6,2, 6.66 );
-
-
- m_ctrl.DoJoinCells( 1,4, 5,10 );
- m_ctrl.DoSetRefChart( 1,4, 0,0,6,2 );
-
- m_ctrl.DoJoinCells( 1,11, 5,17 );
- m_ctrl.DoSetChart( 1,11, 5,5 );
-
- m_ctrl.DoSetChartStringData( 1,11, 0,0, "Area" );
- m_ctrl.DoSetChartStringData( 1,11, 1,0, "Washington" );
- m_ctrl.DoSetChartStringData( 1,11, 2,0, "New York" );
- m_ctrl.DoSetChartStringData( 1,11, 3,0, "Colorado" );
- m_ctrl.DoSetChartStringData( 1,11, 4,0, "Florida" );
-
- m_ctrl.DoSetChartStringData( 1,11, 0,1, "1st quarter" );
- m_ctrl.DoSetChartStringData( 1,11, 0,2, "2nd quarter" );
- m_ctrl.DoSetChartStringData( 1,11, 0,3, "3rd quarter" );
- m_ctrl.DoSetChartStringData( 1,11, 0,4, "4th quarter" );
-
- m_ctrl.DoSetChartValueData( 1,11, 1,1, 29876 );
- m_ctrl.DoSetChartValueData( 1,11, 1,2, 34123 );
- m_ctrl.DoSetChartValueData( 1,11, 1,3, 42221 );
- m_ctrl.DoSetChartValueData( 1,11, 1,4, 52123 );
-
- m_ctrl.DoSetChartValueData( 1,11, 2,1, 32365 );
- m_ctrl.DoSetChartValueData( 1,11, 2,2, 35432 );
- m_ctrl.DoSetChartValueData( 1,11, 2,3, 30283 );
- m_ctrl.DoSetChartValueData( 1,11, 2,4, 45322 );
-
- m_ctrl.DoSetChartValueData( 1,11, 3,1, 32007 );
- m_ctrl.DoSetChartValueData( 1,11, 3,2, 23481 );
- m_ctrl.DoSetChartValueData( 1,11, 3,3, 40624 );
- m_ctrl.DoSetChartValueData( 1,11, 3,4, 34528 );
-
- m_ctrl.DoSetChartValueData( 1,11, 4,1, 31232 );
- m_ctrl.DoSetChartValueData( 1,11, 4,2, 30345 );
- m_ctrl.DoSetChartValueData( 1,11, 4,3, 27943 );
- m_ctrl.DoSetChartValueData( 1,11, 4,4, 32119 );
-
- m_ctrl.DoSetChartGeneralData( 1, 11, 1, FALSE, "Sale", "Figure2", "thousand dollar");
- m_ctrl.DoRefreshChart( 1, 11 );
-
- m_ctrl.SetPageLabelVisible( FALSE );
- m_ctrl.DoAppendPage( "", 2 );
- COleVariant var( "VCDEMO" );
- m_ctrl.DoSetMessageTitle( var );
-
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
-
- void CPrintDemoDlg::OnButtonPreview()
- {
- // TODO: Add your control notification handler code here
- m_ctrl.DoPrintPreview( FALSE );
- }
-
- BEGIN_EVENTSINK_MAP(CPrintDemoDlg, CDialog)
- //{{AFX_EVENTSINK_MAP(CPrintDemoDlg)
- ON_EVENT(CPrintDemoDlg, IDC_SGCTRL1, 55 /* OnPrint */, OnOnPrintSgctrl1, VTS_PVARIANT)
- //}}AFX_EVENTSINK_MAP
- END_EVENTSINK_MAP()
-
- void CPrintDemoDlg::OnOnPrintSgctrl1(VARIANT FAR* processed)
- {
- // TODO: Add your control notification handler code here
- AfxMessageBox( "The real output was page 3( Copy from page 1)" );
-
- m_ctrl.DoCopyPage( 2, 0 );
- m_ctrl.DoSetCurrentPage( 2 );
- m_ctrl.DoSetCellString( 0,0, "Page 3" );
- m_ctrl.DoSetCurrentPage( 0 );
-
- COleVariant var( processed );
- var = 1l;
- *processed = var.Detach();
-
- m_ctrl.DoPrintPage( 2, TRUE );
- }
-