2015-06-24 9 views
0

這是我的問題:我必須在Windows 7或更新的版本中移植一箇舊版本的Windows NT 4(我認爲)與舊版Borland。該程序運行良好(與依賴沃克沒有問題,應用程序驗證程序顯示一個錯誤的DEVMODE緩衝區,但這個錯誤存在於XP,它運作良好)。使用舊版Borland軟件模糊打印

該程序必須打印帶有一些信息的標籤,這在Windows XP上運行良好,但在七個數字是模糊的,我不知道爲什麼,我不知道如何解決這個問題。

我的打印機工作,因爲我可以完美地打印七個文本,如果我打印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; 
} 
//--------------------------------------------------------------------------- 

而這裏。其中描述標籤

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 

的形狀,正如你所看到的,字體是硬編碼的,所以我不認爲這個問題是存在的futhermore我檢查的字體,他們是在同一個版本的DFM文件。

編輯2:https://drive.google.com/file/d/0B0AeGDmETlPXbGlPX3dUSG1WUzg/view?usp=sharing

回答

0

至於你的問題不夠具體所以這裏一些提示,可以幫助的,而不是答案:

你有打印的源代碼?

#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->CanvasGraphics::TBitmap *bmp->CopyRect(...),然後將其保存到文件bmp->SaveToFile("print.bmp");:對於喜歡的東西

搜索源代碼。檢查問題是否在打印之前呈現圖像。還在這裏發佈打印代碼,以便我們看看是否沒有任何可疑的東西。如果你不熟悉帆布/位圖下VCL見:

關於發佈正確和不正確打印的圖像是什麼。

現在我能想到的幾種可能性,如:

  1. 一些Win7的增強文本功能改變使用的字體從XP

  2. 不同使用的字體參數

    可以試試將XP字體複製到您的Win7的(不要忘記保存原件之一)像素

  3. 錯誤選擇的打印紙面積

    (64位Windows運行在WOW64模擬器,其在處置具有不同的驅動程序集的Win32應用程序可能是它返回不同的打印機/參數或東西)

  4. 較新的打印機驅動程序(如HP)

    通過財政上的默認節省碳粉補充打印圖像至97%製作混疊/模糊僞像。請在打印對話框窗口,這樣的事情

  5. 使用的一些屆黨組成

    的我立即停止使用,因爲他們很快成爲過時的不支持,使我的生活像在地獄,而移植到新的操作系統,編譯器什麼的。更何況他們通常insainly售價

+0

我無法添加圖片:/ –

+0

@FlorianGERARD 1.您可以某處張貼的圖片和帖子的鏈接到這裏有人會在這裏複製它。 2.查看源代碼後,我看到沒有打印代碼試圖在Printer() - > EndDoc()調用打印的某處查找「Printer()」函數體;'您的代碼只是移動/隱藏某些面板並調整打印時備忘(可能隱藏工具欄)。當你發現實際的打印程序攔截它的圖像時,看看問題是在渲染還是在打印本身。 – Spektre

+0

@FlorianGERARD如果你處於可編譯狀態,那麼你可以在'Print();'行放置斷點並按F7進入它。你也正在訪問ini文件,所以確保你沒有小數點','ini文件裏面的問題...... – Spektre