这东西给客户个combobox选择吧。
API没有

解决方案 »

  1.   


    ses 
      Printers, WinSpool; procedure TForm1.Button1Click(Sender: TObject); 
    var 
      Dev, Drv, Prt: array[0..255] of Char; 
      DM1: PDeviceMode; 
      DM2: PDeviceMode; 
      Sz: Integer; 
      DevM: THandle; 
    begin 
      Printer.PrinterIndex := -1; 
      Printer.GetPrinter(Dev, Drv, Prt, DevM); 
      DM1 := nil; 
      DM2 := nil; 
      Sz  := DocumentProperties(0, 0, Dev, DM1^, DM2^, 0); 
      GetMem(DM1, Sz); 
      DocumentProperties(0, 0, Dev, DM1^, DM2^, DM_OUT_BUFFER); 
      if DM1^.dmColor > 1 then 
        label1.Caption := Dev + ': 彩色' 
      else 
        label1.Caption := Dev + ': 黑白'; 
      if DM1^.dmFields and DM_Color <> 0 then 
        Label2.Caption := '支持彩色打印' 
      else 
        Label2.Caption := '不支持彩色打印'; 
      FreeMem(DM1); 
    end; 
      

  2.   


    Function PrinterSupportsColor: Boolean;
    Var
      Device, Driver, Port: Array [0..255] of Char;
      hDevMode: THandle;
    Begin
      Printer.GetPrinter(Device, Driver, Port, hDevmode);
      Result :=
      WinSpool.DeviceCapabilities( Device, Port, DC_COLORDEVICE, Nil, Nil ) <>
      0;
    End;试验了一下,似乎判断的打印机都是彩色的。查阅相关资料,跟打印机的Grayscale功能(灰度设置)有关,因为颜色值相对黑白来说更多。