안녕하세요^^;;
모니터상으로는 이뿌게.. 잘 나오는데...폼을 프린트하는데... 너무 뿌옇게 나와서 속이 상합니다. ㅠ
소스는 여기 포럼에 있던 소스를 이용했구요;;
조금 편집해서 아래와 같이 만들었습니다.
어떻게 하면 쨍(?) 하게 표시할 수 있을까요? ㅠㅠ
if (ActiveMDIChild) {
TForm * pForm = ((TChildFrm*)ActiveMDIChild); // Set Printing Form
Graphics::TBitmap *mjbmp = new Graphics::TBitmap();
mjbmp->Width = pForm->ClientWidth;
mjbmp->Height = pForm->ClientHeight;
mjbmp->Canvas->CopyRect(Rect(0, 0, mjbmp->Width, mjbmp->Height),
pForm->Canvas, Rect(0, 0, pForm->ClientWidth, pForm->ClientHeight));
if (!PrintDialog1->Execute())
return;
// Graphics::TBitmap *mjbmp= FormMain->GetFormImage();
TPrinter *prt = Printer();
mjbmp->HandleType = bmDIB; // This is *VERY* important
double h = mjbmp->Height, w = mjbmp->Width, fct, wf;
if (w > h)
prt->Orientation = poLandscape;
else
prt->Orientation = poPortrait;
// 프린트 에러상태 검출해야함...
prt->Title = "SPINDLE TEST PRINT";
wf = (double)prt->PageWidth / w;
fct = (double)prt->PageHeight / h;
if (fct > wf)
fct = wf;
prt->BeginDoc();
prt->Canvas->StretchDraw(Rect(0, 0, fct * w - 1, fct * h - 1), mjbmp);
prt->Canvas->TextOut(0, 0, "PRINT OK");
prt->EndDoc();
delete mjbmp;
}
else {
ShowMessage("프린트할 내용이 없습니다.");
}
|