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  
   );

解决方案 »

  1.   

    你可以看一看 forms.pas中 print 方法,其中有如何使用打印的内容。
    在那里面,把打印机看成一个图形设备,自然包含有分辨率等信息。应该不用
    Printer.BeginDoc。
      

  2.   

    uses printer;GetDeviceCaps(Printer.DC, LOGPIXELSX) 可以取得 dpi
      

  3.   

    都错了,
    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;这个例子没有错误检查,你自己加上。  
      
      

  4.   

    uses 
       printers, ...procedure ...
    var
      h,v:integer;
    begin
       //水平分辨率
       h := GetDeviceCaps(printer.Handle,LOGPIXELSX); 
       //垂直分辨率
       v := GetDeviceCaps(printer.Handle,LOGPIXELSY);
    end;
      

  5.   

    我一直用smallbridge的方法好象没有问题呀?