我想在任意纸张的用户给出的任意位置(通过用户输入距离纸张的左边距和上边距来确定),打印任意比例大小(不能失真)的图象(也是用户输入的),我的代码如下:
可打印出来的纸上什么也没有,奇怪,void __fastcall TMainForm::Button5Click(TObject *Sender)
{
TRect R;
TPrinter *Prntr = Printer();
SetMapMode(Prntr->Handle,MM_LOMETRIC); //0.1mm
if (PrinterSetupDialog1->Execute()){
Prntr->BeginDoc();
int xPage=GetDeviceCaps(Prntr->Handle,HORZSIZE); //mm
int yPage=GetDeviceCaps(Prntr->Handle,VERTSIZE); //mm
int xLgW=xPage/0.1;
int yLgH=yPage/0.1;
R = Rect(0, 0, Image1->Picture->Width*xLgW,-Image1->Picture->Height*yLgH); Prntr->Canvas->StretchDraw(R, Image1->Picture->Graphic); Prntr->EndDoc();
}
}
注:是DELPHI的源码也可以,很急
我也不知道该把这个帖子归在是什么类,我想应该是个基础问题吧,就贴在这里了,请大家帮帮小弟,明天结贴
可打印出来的纸上什么也没有,奇怪,void __fastcall TMainForm::Button5Click(TObject *Sender)
{
TRect R;
TPrinter *Prntr = Printer();
SetMapMode(Prntr->Handle,MM_LOMETRIC); //0.1mm
if (PrinterSetupDialog1->Execute()){
Prntr->BeginDoc();
int xPage=GetDeviceCaps(Prntr->Handle,HORZSIZE); //mm
int yPage=GetDeviceCaps(Prntr->Handle,VERTSIZE); //mm
int xLgW=xPage/0.1;
int yLgH=yPage/0.1;
R = Rect(0, 0, Image1->Picture->Width*xLgW,-Image1->Picture->Height*yLgH); Prntr->Canvas->StretchDraw(R, Image1->Picture->Graphic); Prntr->EndDoc();
}
}
注:是DELPHI的源码也可以,很急
我也不知道该把这个帖子归在是什么类,我想应该是个基础问题吧,就贴在这里了,请大家帮帮小弟,明天结贴
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货