The GetDeviceCaps function retrieves device-specific information about a specified device. int GetDeviceCaps( HDC hdc, // device-context handle
int nIndex // index of capability to query
);
int nIndex // index of capability to query
);
解决方案 »
- 刚学delphi,问一个第三方控件的问题
- 如何用DELPHI 备份数据库
- 真诚招聘软件研发人员
- +++++++奇怪的问题,存储过程第一次运行可以,第二次就出错了++++++在线等待(up有分)
- 如何拦截在IE中复制文字的操作,高手请进
- ADO的效率慢慢降低, newyj(吴刚vs西西弗)..... 等人来取分!
- Help~Help~~~ 想问问怎样用DELPHI实现关机,重启?
- 关于Dlphi网络编程中的TCustomWinSocket.SendStream的问题!!!!!!!
- 关于RichEdit控件!
- windows2000杀毒后运行任何文件均出现" 找不到文件'文件名'或(它的组件之一),请确定文件名和路径是否正确,并且所需的库文件均可用",不知如何解决?
- 问一个有关Where的奇怪问题
- HELP!
在那里面,把打印机看成一个图形设备,自然包含有分辨率等信息。应该不用
Printer.BeginDoc。
TForm.Print需要BeginDoc;
Printer的DC不能得到,可以用Printer.Canvas.Handle。正确的方法是:procedure GetPrinterReso(
const PrinterName: string; // 打印机名
var Width, Height: Integer // 返回的分辨率
);
var
OldPrinterIndex: Integer;
begin
with Printer do
begin
OldPrinterIndex := PrinterIndex; // 保存原打印机索引
PrinterIndex := IndexOf( PrinterName ); // 用新的
Width := PageWidth;
Height := PageHeight;
PrinterIndex := OldPrinterIndex; // 恢复
end;
end;这个例子没有错误检查,你自己加上。
printers, ...procedure ...
var
h,v:integer;
begin
//水平分辨率
h := GetDeviceCaps(printer.Handle,LOGPIXELSX);
//垂直分辨率
v := GetDeviceCaps(printer.Handle,LOGPIXELSY);
end;