home *** CD-ROM | disk | FTP | other *** search
- // VCDemoView.cpp : implementation of the CVCDemoView class
- //
-
- #include "stdafx.h"
- #include "VCDemo.h"
-
- #include "VCDemoDoc.h"
- #include "VCDemoView.h"
-
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CVCDemoView
-
- IMPLEMENT_DYNCREATE(CVCDemoView, CView)
-
- BEGIN_MESSAGE_MAP(CVCDemoView, CView)
- //{{AFX_MSG_MAP(CVCDemoView)
- ON_COMMAND(ID_DEMO_USERFUNC, OnDemoUserfunc)
- ON_COMMAND(ID_DEMO_CELLTYPE, OnDemoCelltype)
- ON_COMMAND(ID_DEMO_CHART, OnDemoChart)
- ON_COMMAND(ID_DEMO_FACE, OnDemoFace)
- ON_COMMAND(ID_DEMO_FORMULA, OnDemoFormula)
- ON_COMMAND(ID_DEMO_SHOWONLY, OnDemoShowonly)
- ON_COMMAND(ID_DEMO_SIZE, OnDemoSize)
- ON_COMMAND(ID_DEMO_SORT, OnDemoSort)
- ON_COMMAND(ID_DEMO_BK, OnDemoBk)
- ON_COMMAND(ID_DEMO_CELLSTYLE, OnDemoCellstyle)
- ON_COMMAND(ID_DEMO_COPY, OnDemoCopy)
- ON_COMMAND(ID_DEMO_DRAG, OnDemoDrag)
- ON_COMMAND(ID_DEMO_INPUT, OnDemoInput)
- ON_COMMAND(ID_DEMO_PAGES, OnDemoPages)
- ON_COMMAND(ID_DEMO_PRINT, OnDemoPrint)
- ON_COMMAND(ID_DEMO_DROPGRID, OnDemoDropgrid)
- ON_COMMAND(ID_DEMO_SAVELOAD, OnDemoSaveload)
- ON_COMMAND(ID_DEMO_DBASE, OnDemoDbase)
- ON_COMMAND(ID_DEMO_UNDO, OnDemoUndo)
- ON_COMMAND(ID_DEMO_UNSCROLL, OnDemoUnscroll)
- //}}AFX_MSG_MAP
- // Standard printing commands
- ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
- ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
- ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
- END_MESSAGE_MAP()
-
- /////////////////////////////////////////////////////////////////////////////
- // CVCDemoView construction/destruction
-
- CVCDemoView::CVCDemoView()
- {
- // TODO: add construction code here
-
- }
-
- CVCDemoView::~CVCDemoView()
- {
- }
-
- BOOL CVCDemoView::PreCreateWindow(CREATESTRUCT& cs)
- {
- // TODO: Modify the Window class or styles here by modifying
- // the CREATESTRUCT cs
-
- return CView::PreCreateWindow(cs);
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CVCDemoView drawing
-
- void CVCDemoView::OnDraw(CDC* dc)
- {
- CVCDemoDoc* pDoc = GetDocument();
- ASSERT_VALID(pDoc);
-
- // TODO: add draw code for native data here
- RECT rect,rect2;
- int i,x,y;
- int step = 40;
-
- GetClientRect(&rect);
- CopyRect(&rect2,&rect);
-
- x= rect.right/(step*2);
- y= rect.bottom/(step*2);
-
- CBrush *brush;
- for(i=0;i<step;i++){
- CRgn rgn;
- brush = new CBrush(RGB( 0, 0, (i+1)*255/step) );
-
- rect2.top = rect.top+(i-15)*y;
- rect2.bottom = rect.bottom-(i-15)*y;
- rect2.left = rect.left+(i-15)*x;
- rect2.right = rect.right-(i-15)*x;
- if( i == 0 )dc->FillRect(&rect,brush);
-
- if( rect2.right > rect2.left && rect2.bottom > rect2.top &&
- rgn.CreateEllipticRgnIndirect( &rect2 ) )
- dc->FillRgn(&rgn,brush);
- delete brush;
- }
-
- CFont *font, *oldfont;
- CString string = "CELL Control make you success!";
- CSize size;
- int point = 50;
-
- //found better font size
- while(TRUE){
- font = new CFont;
- font->CreateFont(point,0,0,0,700,0,0,0,0,0,0,0,0,"Times New Roman");
- oldfont = dc->SelectObject(font);
- if( point <= 1 )break;
- size = dc->GetTextExtent(string);
- if(size.cx > rect.right*0.6 ){
- double ratio = size.cx/(rect.right*0.6);
- point = int(point/ratio-1);
- if( point <= 0 )point = 1;
- dc->SelectObject( oldfont );
- delete font;
- }
- else
- break;
- }
-
- dc->SetBkMode(TRANSPARENT);
- dc->SetTextColor(RGB(0,0,0));
- dc->DrawText(string,&rect,DT_CENTER|DT_VCENTER|DT_SINGLELINE);
- dc->SetTextColor(RGB(230,230,230));
- rect.top -=6;
- rect.left -=6;
- dc->DrawText(string,&rect,DT_CENTER|DT_VCENTER|DT_SINGLELINE);
- dc->SetTextColor(RGB(255,140,80));
- rect.top +=3;
- rect.left +=3;
- dc->DrawText(string,&rect,DT_CENTER|DT_VCENTER|DT_SINGLELINE);
-
- dc->SelectObject( oldfont );
- delete font;
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CVCDemoView printing
-
- BOOL CVCDemoView::OnPreparePrinting(CPrintInfo* pInfo)
- {
- // default preparation
- return DoPreparePrinting(pInfo);
- }
-
- void CVCDemoView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
- {
- // TODO: add extra initialization before printing
- }
-
- void CVCDemoView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
- {
- // TODO: add cleanup after printing
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CVCDemoView diagnostics
-
- #ifdef _DEBUG
- void CVCDemoView::AssertValid() const
- {
- CView::AssertValid();
- }
-
- void CVCDemoView::Dump(CDumpContext& dc) const
- {
- CView::Dump(dc);
- }
-
- CVCDemoDoc* CVCDemoView::GetDocument() // non-debug version is inline
- {
- ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CVCDemoDoc)));
- return (CVCDemoDoc*)m_pDocument;
- }
- #endif //_DEBUG
-
- /////////////////////////////////////////////////////////////////////////////
- // CVCDemoView message handlers
- #include "userfuncdlg.h"
-
- void CVCDemoView::OnDemoUserfunc()
- {
- // TODO: Add your command handler code here
- CUserFuncDlg dlg;
- dlg.DoModal();
- }
- #include "celltypedlg.h"
- void CVCDemoView::OnDemoCelltype()
- {
- // TODO: Add your command handler code here
- CCellTypeDlg dlg;
- dlg.DoModal();
- }
- #include "chartdlg.h"
- void CVCDemoView::OnDemoChart()
- {
- // TODO: Add your command handler code here
- CChartDlg dlg;
- dlg.DoModal();
- }
- #include "FaceDlg.h"
- void CVCDemoView::OnDemoFace()
- {
- // TODO: Add your command handler code here
- CFaceDlg dlg;
- dlg.DoModal();
- }
- #include "formuladlg.h"
- void CVCDemoView::OnDemoFormula()
- {
- // TODO: Add your command handler code here
- CFormulaDlg dlg;
- dlg.DoModal();
- }
- #include "virtualdlg.h"
- void CVCDemoView::OnDemoShowonly()
- {
- // TODO: Add your command handler code here
- CVirtualDlg dlg;
- dlg.DoModal();
- }
- #include "SizeDlg.h"
- void CVCDemoView::OnDemoSize()
- {
- // TODO: Add your command handler code here
- CSizeDlg dlg;
- dlg.DoModal();
- }
- #include "SortDlg.h"
- void CVCDemoView::OnDemoSort()
- {
- // TODO: Add your command handler code here
- CSortDlg dlg;
- dlg.DoModal();
- }
- #include "BkDlg.h"
- void CVCDemoView::OnDemoBk()
- {
- // TODO: Add your command handler code here
- CBKDlg dlg;
- dlg.DoModal();
- }
- #include "CellStyleDlg.h"
- void CVCDemoView::OnDemoCellstyle()
- {
- // TODO: Add your command handler code here
- CCellStyleDlg dlg;
- dlg.DoModal();
- }
- #include "CopyDlg.h"
- void CVCDemoView::OnDemoCopy()
- {
- // TODO: Add your command handler code here
- CCopyDlg dlg;
- dlg.DoModal();
- }
- #include "DragDlg.h"
- void CVCDemoView::OnDemoDrag()
- {
- // TODO: Add your command handler code here
- CDragDlg dlg;
- dlg.DoModal();
- }
- #include "InputDlg.h"
- void CVCDemoView::OnDemoInput()
- {
- // TODO: Add your command handler code here
- CInputDlg dlg;
- dlg.DoModal();
- }
- #include "PagesDlg.h"
- void CVCDemoView::OnDemoPages()
- {
- // TODO: Add your command handler code here
- CPagesDlg dlg;
- dlg.DoModal();
- }
- #include "PrintDemodlg.h"
- void CVCDemoView::OnDemoPrint()
- {
- // TODO: Add your command handler code here
- CPrintDemoDlg dlg;
- dlg.DoModal();
- }
- #include "Dropwindlg.h"
- void CVCDemoView::OnDemoDropgrid()
- {
- // TODO: Add your command handler code here
- CDropwinDlg dlg;
- dlg.DoModal();
- }
-
- #include "Demofiledlg.h"
- void CVCDemoView::OnDemoSaveload()
- {
- // TODO: Add your command handler code here
- CDemoFileDlg dlg;
- dlg.DoModal();
- }
-
- #include "dbasedlg.h"
- void CVCDemoView::OnDemoDbase()
- {
- // TODO: Add your command handler code here
- CDbaseDlg dlg;
- dlg.DoModal();
- }
-
- #include "undodlg.h"
- void CVCDemoView::OnDemoUndo()
- {
- // TODO: Add your command handler code here
- CUndoDlg dlg;
- dlg.DoModal();
- }
-
- #include"unscrolldlg.h"
- void CVCDemoView::OnDemoUnscroll()
- {
- // TODO: Add your command handler code here
- CUnScrollDlg dlg;
- dlg.DoModal();
- }
-