Foros del Web

Foros del Web (http://www.forosdelweb.com/)
-   .NET (http://www.forosdelweb.com/f29/)
-   -   Ayudita!!! (http://www.forosdelweb.com/f29/ayudita-539735/)

mdavila 10/12/2007 11:12

Ayudita!!!
 
Hola gente, me pregunta es sobre como hacer algo por el estilo.
con un parametro entero tengo que imprimir lo siguiente

Suponiendo que el numeor es 12:

12 - 1
11 - 2
10 - 3
9 - 4
8 - 5
7 - 6


Como puedo hacerlo y mandarlo imprimir?

Gracias y se agradece el tiempo.

rmarinsd 10/12/2007 13:28

Re: Ayudita!!!
 
Tengo una duda es la impresion a pantalla o impresora?????

rmarinsd 10/12/2007 18:31

Re: Ayudita!!!
 
Bueno no te entendi bien pero a ver si esto te sirve
Código:

/*Agrega la siguiente referencia*/
using System.Drawing.Printing;

/*EL SIGUIENTE CODIGO TE PERMITE MANDAR A IMPRESORA TEXTO PLANO*/
#region "Impresion"
private Font printFont;
private string printString;

public void PrintAString(string data)
{
  PrintDocument pd = new PrintDocument();
  printFont = new Font("Courier", 10);

  printString = data;
  pd.PrintPage += new PrintPageEventHandler(PrintPage);
  pd.Print();
}
private void PrintPage(object sender,PrintPageEventArgs e)
{
  float xp = 10;
  float yp = 20;
  e.Graphics.DrawString(printString, printFont, Brushes.Black, xp, yp, new StringFormat());
}
#endregion

/*FUNCION QUE RECIBE EL NUMERO LO CALCULA Y LO MANDA A IMPRESORA*/
private void inversa(int int_numero)
{
  string str_cadena=string.Empty;
  for (int int_contador = 1; int_contador <= int_numero; int_contador++)
  {
      str_cadena += int_numero.ToString() + " - " + int_contador.ToString()+"\n";
      int_numero--;
  }
  PrintAString(str_cadena);
}


mdavila 12/12/2007 06:20

Re: Ayudita!!!
 
Gracias me sirvio de mucho tu ejemplo.
Un abrazo

alejandroalv87 21/04/2011 22:09

Respuesta: Ayudita!!!
 
hola como estan? me interesa mucho este tema, ya q estoy haciendo una aplicación q al presionar un pulsador se comunique con la pc y luego debo imprimir(mandar a impresora) automaticamente el dato.
Conozco de C por eso te pregunto si les funciono esa rutina y en q lenguaje esta realizada?


La zona horaria es GMT -6. Ahora son las 23:41.

Desarrollado por vBulletin® Versión 3.8.7
Derechos de Autor ©2000 - 2026, Jelsoft Enterprises Ltd.