| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 
 |  
    /*
    CDC             dc;
    CPrintDialog    printDlg(FALSE);
    
    // selection de l'imprimante.
    if (printDlg.DoModal() == IDCANCEL)   return;
    
       
    dc.Attach(printDlg.GetPrinterDC()); 
        
    dc.m_bPrinting = TRUE; // dc d'impression.
    
    // titre du document = titre application
    CString strTitle="mon document";   
    
    DOCINFO di;
    ::ZeroMemory (&di, sizeof (DOCINFO));
    
    di.cbSize = sizeof (DOCINFO);   
    di.lpszDocName = strTitle;
    
    // debut d'impression
    if(dc.StartDoc( &di )<0)
    {     
        MessageBox(_T("Erreur d'initialisation de l'imprimante"));
        return;
    }
 
    // demarre une page
    if (dc.StartPage()< 0)
    {
        MessageBox(_T("Impossible de demarrer la page"));
        dc.AbortDoc();
        return;
    }             
 
    // recuperation de la surface d'impression
    CRect rectDraw;
    rectDraw.SetRect(0, 0,
        dc.GetDeviceCaps(HORZRES),
        dc.GetDeviceCaps(VERTRES));        
    
    // recuperation eventuelle des marges d'impressions
    //static POINT ptmargins;
    //dc.Escape(GETPRINTINGOFFSET, 0, NULL, &ptmargins);    
 
     CFontEx FontEx;
 
     FontEx.GetFont(13,"Arial Bold");
 
//     CFont* pOldFont = dc.SelectObject(&FontEx);
 
     CString strTxt=_T("Salut Bienvenue chez DVP !");
 
     CSize size=dc.GetTextExtent( strTxt);
 
     dc.TextOut((rectDraw.Width()-size.cx)/2, (rectDraw.Height()-size.cy)/2,strTxt);
 
     dc.EndPage(); // fin de la page a repeter donc pour chage page.
 
     dc.EndDoc();  // fin du document
 
  //   dc.SelectObject(pOldFont); 
 
  */ | 
Partager