代码如下:
var
adevice,adriver,aport:array [0..255] of char;
devicehandle:thandle;
devmode:pdevicemode;
begin
if printer.Printers.Count =0 then
begin
showmessage('没有检测到打印机,请先添加打印机!');
exit;
end;
//设置打印颜色
printer.GetPrinter(adevice,adriver,aport,devicehandle);
if devicehandle=0 then
begin
printer.PrinterIndex :=printer.PrinterIndex;
printer.GetPrinter(adevice,adriver,aport,devicehandle);
end;
if devicehandle=0 then
begin
raise exception.Create('错误,初始化失败!')
end
else
begin
devmode:=globallock(devicehandle);
end;
with devmode^ do
begin
dmfields:=dmfields or dm_printquality;
if dmcolor=1 then
begin
suiradiobutton1.Checked :=true;
end;
if dmcolor=2 then
begin
suiradiobutton2.Checked :=true;
end;
if (dmcolor=3) or (dmcolor=4) then
begin
suiradiobutton3.Checked :=true;
end;
end;
if not devicehandle=0 then
begin
globalunlock(devicehandle);
end;
end;
编译通过,但dmcolor值无法获得,请问如何得到默认打印机dmcolor的值以及如何设置该值
var
adevice,adriver,aport:array [0..255] of char;
devicehandle:thandle;
devmode:pdevicemode;
begin
if printer.Printers.Count =0 then
begin
showmessage('没有检测到打印机,请先添加打印机!');
exit;
end;
//设置打印颜色
printer.GetPrinter(adevice,adriver,aport,devicehandle);
if devicehandle=0 then
begin
printer.PrinterIndex :=printer.PrinterIndex;
printer.GetPrinter(adevice,adriver,aport,devicehandle);
end;
if devicehandle=0 then
begin
raise exception.Create('错误,初始化失败!')
end
else
begin
devmode:=globallock(devicehandle);
end;
with devmode^ do
begin
dmfields:=dmfields or dm_printquality;
if dmcolor=1 then
begin
suiradiobutton1.Checked :=true;
end;
if dmcolor=2 then
begin
suiradiobutton2.Checked :=true;
end;
if (dmcolor=3) or (dmcolor=4) then
begin
suiradiobutton3.Checked :=true;
end;
end;
if not devicehandle=0 then
begin
globalunlock(devicehandle);
end;
end;
编译通过,但dmcolor值无法获得,请问如何得到默认打印机dmcolor的值以及如何设置该值
解决方案 »
- delphi7有什么好的入门书籍
- 关于文本覆盖,我这个代码会什么执行不了?
- Delphi问题4:运行Delphi后怎样回到编辑状态?
- 】昆明【昆明程序员QQ群 3466528
- 李维:分布式多层应用电子商务篇若干问题
- CNN报道:微软总裁比尔·盖茨在洛杉矶被暗杀身亡
- ****请问socket怎么实现多个客户端(同时)向同一服务器传送不同文件??up也有分****
- delphi+oracle数据库的查询
- 第一次求教: 一个小技术问题(控制台输出)
- 如何监测到用户同时按下Ctrl+Alt+Delete三个键???
- 关于目录操作的一个小问题
- 关于自动登陆数据库问题 请高手指点(只有这点分了,大家见谅!)
procedure TMETREREADING.suiButton1Click(Sender: TObject);
begin
//设置打印方向,poPortrait为纵向,poLandscape为横向
printer.PrinterIndex :=suicombobox1.ItemIndex;
if suiradiobutton4.Checked =true then
begin
printer.Orientation := poPortrait;
end
else
begin
printer.Orientation := poLandscape;
end;
end;
运行后,打印方向并未更改,请问如何写代码