【发布时间】:2015-09-10 06:56:18
【问题描述】:
这是我的问题:我必须将一个为 Windows NT 4 制作的旧软件(我认为)移植到 Windows 7 或更高版本上的旧 Borland。程序运行良好(依赖 walker 没有问题,App Verifier 显示 Bad DEVMODE 缓冲区,但此错误在 XP 上存在并且运行良好)。
程序必须打印带有一些信息的标签,这在 Windows XP 上运行良好,但七个数字模糊,我不知道为什么,我不知道如何解决这个问题。
我的打印机可以正常工作,因为我可以完美地在 7 上打印文本,如果我用 pdf 打印机打印,问题还是一样,所以我认为问题出在 windows 上。
有什么想法吗?
编辑 1: 我有部分源代码,但缺少 IDE 中包含的部分。 我认为打印机不在原因,因为这两个测试相同,而 PDF 打印机的问题仍然存在
这里是打印的源代码:
//---------------------------------------------------------------------------
#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文件
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
如您所见,字体是硬编码的,所以我认为问题不存在,而且我检查了字体,它们的版本相同。
编辑 2:https://drive.google.com/file/d/0B0AeGDmETlPXbGlPX3dUSG1WUzg/view?usp=sharing
【问题讨论】:
标签: printing legacy borland-c++