Bonjour.

J'ai une CListrCtrl dont je souhaite imprimer le contenu. J'ai trouvé du code sur le net qui imprime bien le contenu mais au format timbre poste !!!!!

Je n'arrive même pas à lire ce qui est affiché. Je vous mets le code ci dessous, au cas ou vous auriez une idée :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
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
	 CDC             dc;
	 CPrintDialog    printDlg(FALSE);
 
    // selection de l'imprimante.
    if (printDlg.DoModal() == IDCANCEL)   return;
 
    DEVMODE FAR *pDevMode=(DEVMODE FAR *)::GlobalLock(printDlg.GetDevMode());
 
    // set orientation to landscape
    pDevMode->dmOrientation=DMORIENT_LANDSCAPE;
    ::GlobalUnlock(printDlg.GetDevMode());
 
    HDC hdc =printDlg.CreatePrinterDC();
 
    //dc.Attach(printDlg.GetPrinterDC()); sinon le mode paysage ne fonctionne pas
 
    dc.Attach(hdc);
    dc.m_bPrinting = TRUE; // dc d'impression.
 
 
   CPrintInfo pInfo;
   dc.StartDoc("Custom");  // begin a new print job
   dc.StartPage();         // begin a new page
   pInfo.SetMaxPage(1);
   CHeaderCtrl* pTheHeaderCtrl = m_Liste.GetHeaderCtrl();
   pTheHeaderCtrl->PrintClient(&dc, PRF_CHECKVISIBLE |   PRF_CHILDREN | PRF_CLIENT |PRF_OWNED);
   m_Liste.PrintClient(&dc, PRF_CHECKVISIBLE | PRF_CHILDREN | PRF_CLIENT |PRF_OWNED);
   dc.EndPage();            // end a page
   dc.Detach();             // detach the printer DC
PS: je ne souhaite pas imprimer le dialog car ma liste permet les scroll et donc en cas de scroll le dialog n'afficherait pas tout.