unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,Printers;type
TForm1 = class(TForm)
ComboBox1: TComboBox;
ComboBox2: TComboBox;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
printer.Refresh;
comboBox1.Clear;
comboBox1.Items.Assign(Printer.Printers);
comboBox1.ItemIndex:=printer.PrinterIndex;end;procedure TForm1.ComboBox1Change(Sender: TObject);
begin
combobox2.Clear;
printer.PrinterIndex:=combobox1.ItemIndex;
combobox2.Items.Assign(printer.Fonts);
end;end.以上同样的代码,在不同windows环境下出现不同的情况:
如果系统中设有网络打印情况1: 如果该台打印机设为默认打印机,则运行以上代码,并在combobox1中选取取该网络打印机时,combobox2可以列出打印机支持字体。情况2: 如果把该台打印机设为非默认打印机,则运行以上代码,并在combobox1中选取该网络打印机时,弹出错误: 'printer selected is not valid'....
请问各位朋友遇到如此情况吗????
请如何处理????我想得到指定打印机支持的字体列表
解决方案 »
- Delphi生成随机字符串问题,求高手改代码!
- 急,请大家帮一把!
- 关于数据库中表名查找的问题!
- 关于数据集和LISTVIEW的问题
- 在combobox或dbcombobox 下拉的时候怎样分两列显示两字段的内容
- 关于BDE administrator的一个问题,请各位大侠指点
- 请教一个关于动态SQL的问题!
- 可以用中文说明一下分组的作用吗,我知道是用聚合涵数的时候用的,但还是不太明白,可以用文字表达一下吗
- JPG(JPEG)的文件的图片如何旋转?(最好给出源代码,我在线急切等候)
- imDos_Headers=(IMAGE_DOS_HEADER *)pBasePointer;转换为:imDos_Headers := IMAGE_DOS_HEADER(pBasePointer);出错
- 请问,如何取得数据表中第某条记录的特定字段所对应的值?
- 急!请教~~
combobox2显示指定打印机支持的字体。