2012-12-05 50 views
0

我正在使用Pos for .net。如何將字符串打印到收據的中間

下面是一個用VB代碼,我怎麼能轉換爲C#打印收據:

Public Const ESC = Chr(&H1B) & "|" 
     Public Const SetBold = ESC & "bC" 
     Public Const SetUnderline = ESC & "uC" 
     Public Const SetItalic = ESC & "iC" 
     Public Const SetCentre = ESC & "cA" 
     Public Const SetRight = ESC & "rA" 
     Public Const ResetFormatting = ESC & "N" 

Dim msg As String = "This is a test" & vbCrLf & SetBold & SetSize(3) & SetCentre & "it works" & SetSize(1) & " pretty well" & vbCrLf & "OK" 

回答

0

"\r\n"

Public Const ESC = Chr(&H1B) + "|" ; 
     Public Const SetBold = ESC+ "bC"; 
     Public Const SetUnderline = ESC + "uC"; 
     Public Const SetItalic = ESC +"iC" ; 
     Public Const SetCentre = ESC + "cA" ; 
     Public Const SetRight = ESC + "rA" ; 
     Public Const ResetFormatting = ESC + "N" ; 

String msg = "This is a test" + "\r\n"+ SetBold + SetSize(3)+ SetCentre + "it works" +SetSize(1) + " pretty well" + "\r\n" + "OK" ; 
+0

你也需要分號。 –

+0

@PanosRontogiannis:是的,更正了 –

相關問題