
09/07/2008, 12:31
|
| | Fecha de Ingreso: enero-2008
Mensajes: 233
Antigüedad: 17 años, 1 mes Puntos: 2 | |
Respuesta: imprimir c#
Código:
private void ImprimirAc_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
{
Font myFont = new Font("Courier", 10, FontStyle.Regular);
//Bitmap encabezadoImagen = new Bitmap(@"\\Proliant\SISTEMAS SQL/encabezado.bmp");
//e.Graphics.DrawImage(encabezadoImagen, new Point(70, 10));
//e.Graphics.DrawString("Reactualización de reportes", new Font("Courier", 20, FontStyle.Underline), Brushes.Black, 250, 100, new StringFormat());
//e.Graphics.DrawString("Fecha: " + DateTime.Now.ToShortDateString(), new Font("Courier", 16, FontStyle.Regular), Brushes.Black, 330, 130, new StringFormat());
//e.Graphics.DrawString("Visitas realizadas por el vendedor: " + this.lblNombreVendedor.Text, new Font("Courier", 16, FontStyle.Regular), Brushes.Black, 0, 180, new StringFormat());
int contador1Linea = 250;
int contador2Linea = 270;
int contador3Linea = 290;
int contador4Linea = 310;
int contador5Linea = 330;
int contador6Linea = 350;
int contador = 0;
for (int i = 0; i < 5; i++)
{
Dominio.MoviReportes movReportes = (Dominio.MoviReportes)resultados[i];
if (movReportes != null)
{
#region
string tipoDeVisita = "";
if (movReportes.TipoDeVisita == 1)
{
tipoDeVisita = "POR TELEFONO";
}
else if (movReportes.TipoDeVisita == 2)
{
tipoDeVisita = "VISITA CASA";
}
else if (movReportes.TipoDeVisita == 3)
{
tipoDeVisita = "VISITA AL C.M.";
}
string estado = "";
ArrayList resultadosDatos = registro.buscarTipoDeDato();
foreach (Dominio.TipoDeDato tipoDato in resultadosDatos)
{
if (movReportes.CodigoEstado == tipoDato.CodigoDato)
{
estado = tipoDato.TipoDeDato1;
}
}
#endregion
// PRIMERA LINEA !!!
e.Graphics.DrawString("FECHA VISITA: " + movReportes.FechaVisitaRuta.ToShortDateString(), myFont, Brushes.Black, 0, contador1Linea, new StringFormat());
e.Graphics.DrawString("FECHA PROX. VISITA: " + movReportes.FechaProximaRuta.ToShortDateString(), myFont, Brushes.Black, 400, contador1Linea, new StringFormat());
// SEGUNDA LINEA !!!
e.Graphics.DrawString("Nº RUTA: " + movReportes.NumeroRuta, myFont, Brushes.Black, 0, contador2Linea, new StringFormat());
e.Graphics.DrawString("DIRECCIÓN: " + movReportes.Direccion, myFont, Brushes.Black, 400, contador2Linea, new StringFormat());
// TERCERA LINEA !!!
e.Graphics.DrawString("TIPO DE VISITA: " + tipoDeVisita, myFont, Brushes.Black, 0, contador3Linea, new StringFormat());
e.Graphics.DrawString("ESTADO: " + estado, myFont, Brushes.Black, 400, contador3Linea, new StringFormat());
//CUARTA LINEA !!!
e.Graphics.DrawString("Nº TELEFONO: " + movReportes.NumeroTelefono, myFont, Brushes.Black, 0, contador4Linea, new StringFormat());
e.Graphics.DrawString("PERSONA CONTACTO: " + movReportes.PersonaDeContacto, myFont, Brushes.Black, 400, contador4Linea, new StringFormat());
//QUINTA LINEA !!!
e.Graphics.DrawString("OBSERVACIONES: " + movReportes.Observaciones, myFont, Brushes.Black, 0, contador5Linea, new StringFormat());
// SEPARADOR DE REGISTROS
Pen myPen1 = new Pen(Color.Black);
myPen1.DashStyle = DashStyle.Dash;
e.Graphics.DrawLine(myPen1, 800, contador6Linea, 0, contador6Linea);
contador1Linea += 130;
contador2Linea += 130;
contador3Linea += 130;
contador4Linea += 130;
contador5Linea += 130;
contador6Linea += 130;
}
contadorglobal++;
try
{
if (resultados[contadorglobal + 1] != null)
{
e.HasMorePages = true;
}
else
{
e.HasMorePages = false;
}
}
catch (Exception ex)
{
e.HasMorePages = false;
}
}
}
}
puse ese codigo y ha impreso 2 hojas !!! pero las 2 hojas con los mismos resultados que puede estar pasando?? |