2009-04-07 6 views
0

Ich verwende C#. NET und GDI Druckcode auf Thermodrucker LIPI LWT 150 zu drucken. Aber ich kann meine Schriftgröße nicht ändern . Ich benutze Arial 9pt und 5pt, aber es kommt in Standardgröße heraus. Hat jemand eine Ahnung davon?Wie kann ich Schriftgröße im Thermodruck (Lipi Lwt 150) mit C# ändern. Net

Ich bin mit C# -Code wie folgt aus:

public frmSale() 
     { 
      InitializeComponent(); 
      printingDoc.PrintPage += new PrintPageEventHandler(Form_PrintPage); 
     } 

//initalizing print document 
private void PrintSettings() 
{ 

    printingDoc.DefaultPageSettings.Margins = new Margins(3, 3, 3, 3); 
    PaperSize pSize = new PaperSize(); 
    pSize.Width = 275; 
    printingDoc.DefaultPageSettings.PaperSize = pSize; 

    // Claculating the PageWidth and the PageHeight 
    PageHeight = printingDoc.DefaultPageSettings.PaperSize.Height; 
    PageWidth = printingDoc.DefaultPageSettings.PaperSize.Width; 
    // Claculating the page margins 
    LeftMargin = printingDoc.DefaultPageSettings.Margins.Left; 
    TopMargin = printingDoc.DefaultPageSettings.Margins.Top; 
    RightMargin = printingDoc.DefaultPageSettings.Margins.Right; 
    BottomMargin = printingDoc.DefaultPageSettings.Margins.Bottom; 
    printAreaWidth = PageWidth - RightMargin - LeftMargin; 

} 

private void Form_PrintPage(object o, PrintPageEventArgs e) 
//Here we Begin All the printing Process... 
{ 

     PrintSettings(); 
     CurrentY = (float)printingDoc.DefaultPageSettings.Margins.Top;//0; 
     PrintEstHeader(e.Graphics); 
     DrawEstGridData(e); 

} 

//Printing Function 
private void PrintEstData(Graphics g, string stringData, StringAlignment alignment, Font fnt, Color clr, bool newLine)//,int starting,int maxWidth) 
{ 
    StringFormat stringFormat = new StringFormat(); 
    stringFormat.Trimming = StringTrimming.Word; 
    stringFormat.FormatFlags = StringFormatFlags.NoWrap | 
     StringFormatFlags.LineLimit | StringFormatFlags.NoClip; 

    stringFormat.Alignment = alignment; 

    RectangleF Rect = new RectangleF((float)LeftMargin, CurrentY, 
         (float)PageWidth - (float)RightMargin - (float)LeftMargin, 
         g.MeasureString(stringData, fnt).Height); 

    g.DrawString(stringData, fnt, 
     new SolidBrush(clr), 
     Rect, stringFormat); 

    CurrentY += newLine ? g.MeasureString(stringData, fnt).Height : 0; 
} 

private void PrintEstHeader(Graphics g) 
{ 

    PrintEstData(g, "----------------------------------------------", StringAlignment.Near, new Font("Arial", 9), Color.Black, true);//,LeftMargin,printAreaWidth); 

    PrintEstData(g, "Estimate" + " " + "Rate :" + ncRate.Value.ToString("0.00"), StringAlignment.Near, new Font("Arial", 9, FontStyle.Bold), Color.Black, true);//, LeftMargin, 76); 

    PrintEstData(g, "----------------------------------------------", StringAlignment.Near, new Font("Arial", 9), Color.Black, true);//, LeftMargin, printAreaWidth); 
    PrintEstData(g,"|ITEM |"+"WEIGHT|"+ "STN WT|"+"M.C. %|"+"Total|", StringAlignment.Near, new Font("Arial", 5), Color.Black, true);//,LeftMargin,42); 
    PrintEstData(g, "----------------------------------------------", StringAlignment.Near, new Font("Arial", 9), Color.Black, true);//, LeftMargin, printAreaWidth); 
} 

Antwort

0

Basierend auf dem printer specification es sieht aus wie es nicht willkürlich Schriftarten nicht unterstützt, aber nur zwei eingebaute feste Breite Schriftarten. Wenn Sie nicht Bitmaps auf dem Drucker drucken oder Benutzerzeichen erstellen können, bezweifle ich, dass Sie mehr als nur Schriftart A oder Schriftart B auswählen können.

+1

Der Link ist in Ihrer Antwort gebrochen. –