使用旧版Borland软件进行模糊打印 [英] Blurry print with legacy borland software
问题描述
这是我的问题:我必须将为Windows NT 4制作的旧软件与旧的Borland移植到Windows 7或更高版本上。该程序运行良好(依赖行者没有问题,App Verifier显示错误的DEVMODE缓冲区,但此错误在XP上存在并且运行良好)。
Here is my problem : I have to port an old sofware made for windows NT 4 (i thought) with an old Borland on Windows 7 or newer. The program is running well ( no problem with dependency walker, App Verifier shows a Bad DEVMODE buffer but this error exists on XP and it works well).
该程序必须打印带有一些信息的标签,这在Windows XP上效果很好,但在七个数字上却很模糊,我不知道为什么,而且我也不怎么解决它。
The programm have to print a label with some information, this works good on windows XP but on seven numbers are blurry, i don't know why and i don't how to troubleshoot that.
我的打印机工作正常,因为我可以完美地在7个文本上打印文本,如果我用pdf打印机打印,问题仍然相同,所以我认为问题出在Windows。
My printer works because i can print a text on seven perfectly and if i print with a pdf printer the problem still the same so i thought that the problem is from windows.
知道吗?
编辑1:
我有部分源代码,但是缺少IDE中包含的部分。
打印机没有原因,我认为是因为两次测试都相同,而PDF打印机的问题仍然存在
Edit 1 : I have some parts of the source code but parts that were included in the IDE are missing. The printer is not in cause i think because it's the same for the two tests and the problem still here with a PDF printer
这是源代码打印:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include <printers.hpp>
#include "FileCtrl.hpp"
#include "IniFileName.h"
#include "PrnEtiQ.h"
#include "CheckDll.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TEtiquette *Etiquette;
//---------------------------------------------------------------------------
__fastcall TEtiquette::TEtiquette(TComponent* Owner) : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TEtiquette::PrintEti(AnsiString Name,double OD,double OG,double xrb,int PrnIndex)
{
if (PrnIndex==-1) return;
TIniFile * pIni=new TIniFile(GetIniFileName());
if (pIni)
{
DecalX=pIni->ReadInteger("ETIQUETTE","Decal_X",150);
DecalY=pIni->ReadInteger("ETIQUETTE","Decal_Y",0);
pIni->WriteInteger("ETIQUETTE","Decal_X",DecalX);
pIni->WriteInteger("ETIQUETTE","Decal_Y",DecalY);
delete pIni;
}
else
{
DecalX=150;
DecalY=0;
}
LblName->Caption=Name;
PerimDroit->Caption=FormatFloat("##0.0000",OD);
PerimGauche->Caption=FormatFloat("##0.0000",OG);
XRB->Caption=FormatFloat("##0.00",xrb);
Printer()->PrinterIndex=PrnIndex;
int MemoWidth=Width;
int MemoHeight=Height;
Width=MemoWidth+DecalX;
Height=MemoHeight+DecalY;
Panel1->Left=DecalX;
Panel1->Top=DecalY;
Print();
Width=MemoWidth;
Height=MemoHeight;
Panel1->Left=0;
Panel1->Top=0;
}
//---------------------------------------------------------------------------
,这是描述标签形状的.DFM文件
and here is the .DFM file which describe the shape of the label
object Etiquette: TEtiquette
Left = 167
Top = 149
HorzScrollBar.Visible = False
VertScrollBar.Visible = False
BorderIcons = []
BorderStyle = bsNone
ClientHeight = 33
ClientWidth = 142
Color = clWhite
UseDockManager = True
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Arial Black'
Font.Style = []
OldCreateOrder = False
Position = poScreenCenter
PixelsPerInch = 96
TextHeight = 18
object Panel1: TPanel
Left = 0
Top = 0
Width = 143
Height = 34
BevelOuter = bvNone
Color = clWhite
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Arial Black'
Font.Style = []
ParentFont = False
TabOrder = 0
object PerimGauche: TLabel
Left = 4
Top = 0
Width = 65
Height = 11
AutoSize = False
Caption = '200.00'
Color = clWhite
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
end
object PerimDroit: TLabel
Left = 72
Top = 0
Width = 66
Height = 11
Alignment = taRightJustify
AutoSize = False
Caption = '100.00'
Color = clWhite
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
end
object XRB: TLabel
Left = 40
Top = 12
Width = 57
Height = 11
Alignment = taCenter
AutoSize = False
Caption = '123.45'
Color = clWhite
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
end
object LblName: TLabel
Left = 4
Top = 20
Width = 42
Height = 14
Caption = '18241_1'
Color = clWhite
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Arial'
Font.Style = []
ParentColor = False
ParentFont = False
end
end
end
如您所见,字体是硬编码的,所以我不认为问题出在哪里,我还检查了字体,并且它们是同一版本。
As you can see, fonts are hardcoded so i don't think that the problem is there futhermore i checked the fonts and they are in the same version.
编辑2: https: //drive.google.com/file/d/0B0AeGDmETlPXbGlPX3dUSG1WUzg/view?usp=sharing
推荐答案
作为您的问题不够明确,因此这里有些提示可能会代替回答:
As your question is not specific enough so here some hints that could help instead of answer:
您有印刷的源代码吗?
搜索源代码,例如:
#include <Printers.hpp>
TPrinter *prn = Printer();
// here open dialog window... set the printing parameters
prn->BeginDoc();
// here draw the printed image to prn->Canvas
prn->NewPage();
// here draw the printed image to prn->Canvas
// ...
prn->EndDoc();
尝试复制 prn->画布
到 Graphics :: TBitmap * bmp-> CopyRect(...)
,然后将其保存到文件 bmp-> SaveToFile( print .bmp);
。在打印图像之前检查问题是否在于渲染图像。还要在此处打印代码,以便我们查看是否可疑。如果您不熟悉 VCL 下的Canvas / Bitmap,请参见:
Try to copy the prn->Canvas
to Graphics::TBitmap *bmp->CopyRect(...)
and then save it to file bmp->SaveToFile("print.bmp");
. To check if the problem is in rendering the image prior to printing it or not. Also post printing code here so we see if there is not anything suspicious. If you not familiar with Canvas/Bitmap under VCL see:
- GDI and Bitmap section
有关发布图片的信息正确和不正确的打印。
现在,我可以想到几种可能性:
Now I can think of few possibilities like:
-
某些Win7增强了文本功能,可更改使用的字体
XP
可以尝试将 XP 字体复制到您的 Win7 中(不要忘记保存原稿一个)
can try to copy XP fonts to your Win7 (do not forget to save the originals one)
错误选择的打印机纸张区域(以像素为单位)
(x64 Windows在WOW64仿真器中运行Win32应用程序,该驱动程序具有不同的驱动程序集,可能会返回不同的打印机/参数或其他内容)。
(x64 Windows is running Win32 apps in WOW64 emulator which has different set of drivers at disposal may be it returns different printer/parameters or something)
较新的打印机驱动程序(例如HP)
通过将打印的图像缩放到 97%
来增加默认的碳粉节省,从而产生锯齿/模糊伪像。检查打印对话框窗口中是否存在此类情况
adds on default toner saving by scaling printed image to 97%
making aliasing/blurring artifacts. Check printing dialog window for such things
某些第三方组件的使用情况
我停止使用它们是因为它们很快就会过时而不受支持,并且在移植到较新的OS时,我的生活变得一团糟,无论编译什么。更不用说它们通常价格不合理
I stop using those because they are quickly being outdated unsupported and makes my life a hell while porting to newer OS,compiler whatever. Not to mention they are usually insainly priced
这篇关于使用旧版Borland软件进行模糊打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!