[C con Clase] CWnd*: posible?
Luiz Pepe
pepeluiz en hotmail.com
Vie Mar 16 18:28:16 CET 2007
Saludos a todos
Tengo un problema tratando de obtener el CDC para un CWnd*
(Usando VC++ 6.0)
if (printDlg.DoModal() == IDCANCEL) // Get printer settings from user
return;
dc.Attach(printDlg.GetPrinterDC()); // Get and attach a printer DC
CWnd* myWnd = dc.GetWindow(); // Aqui el objeto no pasa nada. 000000x00
CRect myRect;
myWnd->GetClientRect(&myRect); // Por lo tanto no puedo obtener el rect.
El problema de fondo: Estoy escribiendo text y necesito centrar un text.
CFont* pOldFont = (CFont*) pDC->SelectObject(&otroFont);
pDC->GetTextMetrics(&tm);
int strWidth = tm.tmAveCharWidth;
// Deberia estar centrado.
pDC->TextOut((myRect.Width() / 2) - ((str.GetLength() / 2) * strrWidth),
10, str);
Algun metodo diferente de hacerlo?
Muchas gracias
Jose
_________________________________________________________________
【らいぶ寿司】5皿ごとにおこる、板前さんたちのパフォーマンスに注目!
http://livesushi.jp/
Más información sobre la lista de distribución Cconclase