C
csfan
Unregistered / Unconfirmed
GUEST, unregistred user!
Graphics::TFont *tf;
tf=new Graphics::TFont;
tf->Assign(Cname->Font);
PLOGFONT plf = (PLOGFONT) LocalAlloc(LPTR, sizeof(LOGFONT));
GetObject(tf->Handle,sizeof(plf),plf);
plf->lfHeight=-40;
//第一次设定字体
plf->lfWidth=4;
plf->lfWeight=400;
tf->Handle=CreateFontIndirect(plf);
Printer()->Canvas->Font->Assign(tf);
Printer()->Canvas->Font->PixelsPerInch=GetDeviceCaps(Printer()->Handle,LOGPIXELSY);
Printer()->begin
Doc();
Printer()->Canvas->TextOut(0,0,"ABC");
Printer()->EndDoc();
plf->lfHeight=-80;
plf->lfWidth=8;
//第二次设定字体
plf->lfWeight=400;
tf->Handle=CreateFontIndirect(plf);
Printer()->Canvas->Font->Assign(tf);
Printer()->Canvas->Font->PixelsPerInch=GetDeviceCaps(Printer()->Handle,LOGPIXELSY);
Printer()->begin
Doc();
Printer()->Canvas->TextOut(0,5,"ABC");
Printer()->EndDoc();
请问:
(1)为何第二次设定字体不起作用.(注:经跟踪后发现,第二次Printer()->Canvas->Font->Assign(tf)后
Printer()->Canvas->Font的句柄与tf的句柄不同,但确实是变化了.)
(2)如何实现每次设定好字体,打印后,再次打印不再换页.
我是新手,还请诸位高手多多指点!!!
急呀!!
我是新手,还请诸位高手指点,谢谢!!!!
tf=new Graphics::TFont;
tf->Assign(Cname->Font);
PLOGFONT plf = (PLOGFONT) LocalAlloc(LPTR, sizeof(LOGFONT));
GetObject(tf->Handle,sizeof(plf),plf);
plf->lfHeight=-40;
//第一次设定字体
plf->lfWidth=4;
plf->lfWeight=400;
tf->Handle=CreateFontIndirect(plf);
Printer()->Canvas->Font->Assign(tf);
Printer()->Canvas->Font->PixelsPerInch=GetDeviceCaps(Printer()->Handle,LOGPIXELSY);
Printer()->begin
Doc();
Printer()->Canvas->TextOut(0,0,"ABC");
Printer()->EndDoc();
plf->lfHeight=-80;
plf->lfWidth=8;
//第二次设定字体
plf->lfWeight=400;
tf->Handle=CreateFontIndirect(plf);
Printer()->Canvas->Font->Assign(tf);
Printer()->Canvas->Font->PixelsPerInch=GetDeviceCaps(Printer()->Handle,LOGPIXELSY);
Printer()->begin
Doc();
Printer()->Canvas->TextOut(0,5,"ABC");
Printer()->EndDoc();
请问:
(1)为何第二次设定字体不起作用.(注:经跟踪后发现,第二次Printer()->Canvas->Font->Assign(tf)后
Printer()->Canvas->Font的句柄与tf的句柄不同,但确实是变化了.)
(2)如何实现每次设定好字体,打印后,再次打印不再换页.
我是新手,还请诸位高手多多指点!!!
急呀!!
我是新手,还请诸位高手指点,谢谢!!!!