H
hmily1688
Unregistered / Unconfirmed
GUEST, unregistred user!
我在一个TPanel上创建了n个Tlabel组件,把这些组件打在A4纸上,打出的字很不清楚 ,
好似马赛克,各位谁有好办法。代码如下
void __fastcall(TPanel *APanel)
{
int PointX,PointY,x,y;
PointX = GetDeviceCaps(Printer()->Handle, LOGPIXELSX) / 25.38;
PointY = GetDeviceCaps(Printer()->Handle, LOGPIXELSX) / 25.38;
HDC dc = GetWindowDC(APanel->Handle);
Graphics::TCanvas *PanelCanvas = new Graphics::TCanvas;
PanelCanvas->Handle = dc;
TRect rect = PanelCanvas->ClipRect;
OffsetRect(&rect,-rect.Left,rect.Top);
Graphics::TBitmap *Bitmap = new Graphics::TBitmap;
Bitmap->PixelFormat = pf24bit;
Bitmap->HandleType = bmDIB;
Bitmap->Width = rect.Right;
Bitmap->Height= rect.Bottom;
Bitmap->Canvas->CopyRect(rect,PanelCanvas,PanelCanvas->ClipRect);
DIBSECTION DibSec;
GetObject(Bitmap->Handle, sizeof(DibSec), &DibSec);
Printer()->begin
Doc();
StretchDIBits( Printer()->Canvas->Handle, 0, 60,
Printer()->PageWidth, Printer()->PageHeight,
0, 0, Bitmap->Width, Bitmap->Height,
DibSec.dsBm.bmBits, (BITMAPINFO*)&DibSec.dsBmih,
DIB_RGB_COLORS, SRCCOPY);
Printer()->EndDoc();
delete Bitmap;
delete PanelCanvas;
ReleaseDC(APanel->Handle,dc);
}[]
好似马赛克,各位谁有好办法。代码如下
void __fastcall(TPanel *APanel)
{
int PointX,PointY,x,y;
PointX = GetDeviceCaps(Printer()->Handle, LOGPIXELSX) / 25.38;
PointY = GetDeviceCaps(Printer()->Handle, LOGPIXELSX) / 25.38;
HDC dc = GetWindowDC(APanel->Handle);
Graphics::TCanvas *PanelCanvas = new Graphics::TCanvas;
PanelCanvas->Handle = dc;
TRect rect = PanelCanvas->ClipRect;
OffsetRect(&rect,-rect.Left,rect.Top);
Graphics::TBitmap *Bitmap = new Graphics::TBitmap;
Bitmap->PixelFormat = pf24bit;
Bitmap->HandleType = bmDIB;
Bitmap->Width = rect.Right;
Bitmap->Height= rect.Bottom;
Bitmap->Canvas->CopyRect(rect,PanelCanvas,PanelCanvas->ClipRect);
DIBSECTION DibSec;
GetObject(Bitmap->Handle, sizeof(DibSec), &DibSec);
Printer()->begin
Doc();
StretchDIBits( Printer()->Canvas->Handle, 0, 60,
Printer()->PageWidth, Printer()->PageHeight,
0, 0, Bitmap->Width, Bitmap->Height,
DibSec.dsBm.bmBits, (BITMAPINFO*)&DibSec.dsBmih,
DIB_RGB_COLORS, SRCCOPY);
Printer()->EndDoc();
delete Bitmap;
delete PanelCanvas;
ReleaseDC(APanel->Handle,dc);
}[]