请教:如何获取打印机的分辨率?

neighborgirl 2003-05-21 12:16:33
请教:如何获取打印机的分辨率?
GetDeviceCaps(printerHandle?,LOGPIXELSX);中
第一个参数怎么定义?
...全文
202 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
Wnyu 2003-05-21
  • 打赏
  • 举报
回复
指向打印机的设备 (Printer.handle)

unit PrinterDpi;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,printers,
StdCtrls;

type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var
ppix : Integer;
begin
ppix := GetDeviceCaps(Printer.Handle, logPixelsX);
showmessage('x-dpi:'+floattostr(ppix));
ppix := GetDeviceCaps(Printer.Handle, logPixelsY);
showmessage('y-dpi:' +floattostr(ppix));
end;

end.
firetoucher 2003-05-21
  • 打赏
  • 举报
回复
你可以直接定义成long
firetoucher 2003-05-21
  • 打赏
  • 举报
回复
第一个参数是一个指针,指向打印机的设备描述结构device context(DC).

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧