Guest User

Untitled

a guest
Oct 19th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. public void Imprimir()
  2. {
  3. string texto = "Prueba de impresion";
  4. texto += "x1bx6Dx0"; // funciona si solo excribo asi en una variable
  5. Imprimir(nombre_impresora, texto);
  6. }
  7.  
  8. public void Imprimir()
  9. {
  10. string texto = "Prueba de impresion";
  11. texto += ValorHexadecimal("27,191,0"); // retorna \x1b\x6D\x0
  12. Imprimir(nombre_impresora, texto);
  13. }
  14.  
  15. public static string ValorHexadecimal(string valor)
  16. {
  17. string hex = "";
  18. string[] valores = valor.Split(new string[] { "," }, System.StringSplitOptions.RemoveEmptyEntries);
  19. foreach (string c in valores)
  20. {
  21. System.Convert.ToString(int.Parse(c), 16).ToUpper();
  22. hex += @"x"+ System.Convert.ToString(int.Parse(c), 16).ToUpper();;
  23. }
  24.  
  25. return hex;
  26. }
Add Comment
Please, Sign In to add comment