摘要载入中… 请稍等…
内容载入中… 请稍等…
| ◎→ | 本类最新 |
|
在DELPHI文本和图形的打印 用好Delphi的打印技能的编程技巧 在Delphi中实现数据分析模块的动 在Delphi中控制扫描仪 自定义报表打印预览窗口 获取打印机队列的状态信息 |
|
| ◎→相关资源 | |
| VB窗体文章 HTML入门教程 JavaScript入门教程 VbScript入门教程 ASP.net入门教程 C语言入门教程 Deiphi实例教程 Deiphi窗体文章 Deiphi数据库编程 Deiphi网络编程 Deiphi图形图象文章 Deiphi系统文件 | |
| ◎→ | 热门资源 |
| 用DELPHI通过写注册表来实现建立 网络积件再思考。(其实也只是胡 Delphi中动画设计(2) Delphi中动画设计 Delphi无标题窗口的移动 用Delphi实现文件下载的方法 Delphi数据库编程一日通(3) |
|
type
TForm1 = class(TForm)
Button1: TButton;
ComboBox1: TComboBox;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
{...}
procedure TForm1.FormCreate(Sender: TObject);
begin
{ tell printer to go to the default by setting
the PrinterIndex value to -1 }
Printer.PrinterIndex := -1;
{ make our combobox non-editable }
ComboBox1.Style := csDropDownList;
{ set our combobox items to the printer printers }
ComboBox1.Items := Printer.Printers;
{ set combobox to view the default printer
according to printer printerindex as set above }
ComboBox1.ItemIndex := Printer.PrinterIndex;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
MyHandle : THandle;
MyDevice,
MyDriver,
MyPort: array [0..255] of Char;
begin
{ set printer to the selected according to the
combobox itemendex }
Printer.PrinterIndex := ComboBox1.ItemIndex;
{ get our printer properties }
Printer.GetPrinter(MyDevice,
MyDriver,
MyPort,
MyHandle);
{ create string of exactly what WriteProfileString()
wants to see by concat each of the above received
character arrays }
StrCat( MyDevice, ',');
StrCat( MyDevice, MyDriver );
StrCat( MyDevice, ',');
StrCat( MyDevice, MyPort );
{ copy our new default printer into our windows ini file
to the [WINDOWS] section under DEVICE= }
WriteProfileString('WINDOWS',
'DEVICE',
MyDevice );
{ tell all applications that the windows ini file has
changed, this will cause them all to recheck default
printer }
SendMessage(HWND_BROADCAST,
WM_WININICHANGE,
0,
LongInt(pChar('windows')));
end;
end;
| 链 接 |
| 芯友网版权所有 1999-2006 | 著作权与商标声明 | 法律声明 | 服务条款 | 隐私声明 | 联系我们 |