Foros del Web » Programación para mayores de 30 ;) » .NET »

PrintDocument con impresora matriz de punto

Estas en el tema de PrintDocument con impresora matriz de punto en el foro de .NET en Foros del Web. Hola, estoy terminando una aplicación e imprimo una factura con printdocument. Eso lo hace bien, pero no puedo modificar el punto de inicio de la ...
  #1 (permalink)  
Antiguo 27/02/2013, 15:48
 
Fecha de Ingreso: abril-2007
Ubicación: Merlo
Mensajes: 314
Antigüedad: 17 años
Puntos: 3
PrintDocument con impresora matriz de punto

Hola, estoy terminando una aplicación e imprimo una factura con printdocument.
Eso lo hace bien, pero no puedo modificar el punto de inicio de la impreción.
Esta siempre se inicia en 10x10 y yo quiero que empiece mas a la izquierda, como puedo modificer los margenes?
uso el siguiente codigo.

Código vb:
Ver original
  1. Private Sub pd1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles pd1.PrintPage
  2.         Dim c, piey, totalx, seniax, saldox, desp, presx, presy, direx, direy, apynx, apyny, fecx, fecy, entrex, entrey, barriox, barrioy, telx, tely, listx, listy As Integer
  3.         Dim aux As Double
  4.         Dim Ini As CIniClass
  5.         Ini = New CIniClass
  6.         c = 0
  7.         Ini.Archivo = System.AppDomain.CurrentDomain.BaseDirectory() & "configuracion.ini"
  8.         aux = Val(Ini.LeeIni("Printer", "trans"))
  9.         desp = Val(Ini.LeeIni("Printer", "desp")) * aux
  10.         presx = Val(Ini.LeeIni("Printer", "pres-x")) * aux
  11.         presy = Val(Ini.LeeIni("Printer", "pres-y")) * aux
  12.         direx = Val(Ini.LeeIni("Printer", "dire-x")) * aux
  13.         direy = Val(Ini.LeeIni("Printer", "dire-y")) * aux
  14.         apynx = Val(Ini.LeeIni("Printer", "apyn-x")) * aux
  15.         apyny = Val(Ini.LeeIni("Printer", "apyn-y")) * aux
  16.         fecx = Val(Ini.LeeIni("Printer", "fec-x")) * aux
  17.         fecy = Val(Ini.LeeIni("Printer", "fec-y")) * aux
  18.         entrex = Val(Ini.LeeIni("Printer", "entrec-x")) * aux
  19.         entrey = Val(Ini.LeeIni("Printer", "entrec-y")) * aux
  20.         barriox = Val(Ini.LeeIni("Printer", "barrio-x")) * aux
  21.         barrioy = Val(Ini.LeeIni("Printer", "barrio-y")) * aux
  22.         telx = Val(Ini.LeeIni("Printer", "tel-x")) * aux
  23.         tely = Val(Ini.LeeIni("Printer", "tel-y")) * aux
  24.         listx = Val(Ini.LeeIni("Printer", "lis-x"))
  25.         listy = Val(Ini.LeeIni("Printer", "lis-y"))
  26.         piey = Val(Ini.LeeIni("Printer", "pie-y")) * aux
  27.         totalx = Val(Ini.LeeIni("Printer", "total-x")) * aux
  28.         seniax = Val(Ini.LeeIni("Printer", "senia-x")) * aux
  29.         saldox = Val(Ini.LeeIni("Printer", "saldo-x")) * aux
  30.         '**************************************************************
  31.        e.Graphics.PageUnit = GraphicsUnit.Millimeter
  32.         e.Graphics.DrawString(Format(NFactura, "0000-00000000"), New Font("Arial", 12, FontStyle.Regular), Brushes.Black, presx, presy)
  33.         e.Graphics.DrawString(Format(NFactura, "0000-00000000"), New Font("Arial", 12, FontStyle.Regular), Brushes.Black, presx + desp, presy)
  34.         e.Graphics.DrawString("Fecha y Hora: " & Now(), New Font("Arial", 9, FontStyle.Regular), Brushes.Black, fecx, fecy)
  35.         e.Graphics.DrawString("Fecha y Hora: " & Now(), New Font("Arial", 9, FontStyle.Regular), Brushes.Black, fecx + desp, fecy)
  36.         e.Graphics.DrawString("Entregar: " & Me.txtEntregar.Text, New Font("Arial", 9, FontStyle.Regular), Brushes.Black, fecx, fecy + 3)
  37.         e.Graphics.DrawString("Entregar: " & Me.txtEntregar.Text, New Font("Arial", 9, FontStyle.Regular), Brushes.Black, fecx + desp, fecy + 3)
  38.         e.Graphics.DrawString("Vuelto: " & Me.txtVuelto.Text, New Font("Arial", 9, FontStyle.Regular), Brushes.Black, fecx, fecy + 6)
  39.         e.Graphics.DrawString("Vuelto: " & Me.txtVuelto.Text, New Font("Arial", 9, FontStyle.Regular), Brushes.Black, fecx + desp, fecy + 6)
  40.         '**************************************************************
  41.        e.Graphics.DrawString(Me.txtNombre.Text, New Font("Arial", 12, FontStyle.Regular), Brushes.Black, apynx, apyny)
  42.         e.Graphics.DrawString(Me.txtNombre.Text, New Font("Arial", 12, FontStyle.Regular), Brushes.Black, apynx + desp, apyny)
  43.         e.Graphics.DrawString(Me.cmbDireccion.Text, New Font("Arial", 12, FontStyle.Regular), Brushes.Black, direx, direy)
  44.         e.Graphics.DrawString(Me.cmbDireccion.Text, New Font("Arial", 12, FontStyle.Regular), Brushes.Black, direx + desp, direy)
  45.         e.Graphics.DrawString(Me.txtECalles.Text, New Font("Arial", 12, FontStyle.Regular), Brushes.Black, entrex, entrey)
  46.         e.Graphics.DrawString(Me.txtECalles.Text, New Font("Arial", 12, FontStyle.Regular), Brushes.Black, entrex + desp, entrey)
  47.         e.Graphics.DrawString(Me.txtBarrio.Text, New Font("Arial", 12, FontStyle.Regular), Brushes.Black, barriox, barrioy)
  48.         e.Graphics.DrawString(Me.txtBarrio.Text, New Font("Arial", 12, FontStyle.Regular), Brushes.Black, barriox + desp, barrioy)
  49.         e.Graphics.DrawString(Me.txtTelefono.Text, New Font("Arial", 12, FontStyle.Regular), Brushes.Black, telx, tely)
  50.         e.Graphics.DrawString(Me.txtTelefono.Text, New Font("Arial", 12, FontStyle.Regular), Brushes.Black, telx + desp, tely)
  51.         While Me.lvwPresupuesto.Items.Count > c
  52.             e.Graphics.DrawString(Me.lvwPresupuesto.Items(c).SubItems(0).Text, New Font("Arial", 11, FontStyle.Regular), Brushes.Black, listx, listy + (c * 5))
  53.             e.Graphics.DrawString(Me.lvwPresupuesto.Items(c).SubItems(0).Text, New Font("Arial", 11, FontStyle.Regular), Brushes.Black, listx + desp, listy + (c * 5))
  54.             e.Graphics.DrawString(Me.lvwPresupuesto.Items(c).SubItems(1).Text, New Font("Arial", 11, FontStyle.Regular), Brushes.Black, listx + 14, listy + (c * 5))
  55.             e.Graphics.DrawString(Me.lvwPresupuesto.Items(c).SubItems(1).Text, New Font("Arial", 11, FontStyle.Regular), Brushes.Black, listx + 14 + desp, listy + (c * 5))
  56.             e.Graphics.DrawString(Me.lvwPresupuesto.Items(c).SubItems(2).Text, New Font("Arial", 11, FontStyle.Regular), Brushes.Black, listx + 67, listy + (c * 5))
  57.             e.Graphics.DrawString(Me.lvwPresupuesto.Items(c).SubItems(2).Text, New Font("Arial", 11, FontStyle.Regular), Brushes.Black, listx + 67 + desp, listy + (c * 5))
  58.             e.Graphics.DrawString(Me.lvwPresupuesto.Items(c).SubItems(3).Text, New Font("Arial", 11, FontStyle.Regular), Brushes.Black, listx + 82, listy + (c * 5))
  59.             e.Graphics.DrawString(Me.lvwPresupuesto.Items(c).SubItems(3).Text, New Font("Arial", 11, FontStyle.Regular), Brushes.Black, listx + 82 + desp, listy + (c * 5))
  60.             c = c + 1
  61.         End While
  62.         e.Graphics.DrawString(Format(Val(Me.txtTotalT.Text), "0.00"), New Font("Arial", 12, FontStyle.Regular), Brushes.Black, totalx, piey)
  63.         e.Graphics.DrawString(Format(Val(Me.txtSenia.Text), "0.00"), New Font("Arial", 12, FontStyle.Regular), Brushes.Black, seniax, piey)
  64.         e.Graphics.DrawString(Format(Val(Me.txtTotalT.Text) - Val(Me.txtSenia.Text), "0.00"), New Font("Arial", 12, FontStyle.Regular), Brushes.Black, saldox, piey)
  65.         e.Graphics.DrawString(Format(Val(Me.txtTotalT.Text), "0.00"), New Font("Arial", 12, FontStyle.Regular), Brushes.Black, totalx + desp, piey)
  66.         e.Graphics.DrawString(Format(Val(Me.txtSenia.Text), "0.00"), New Font("Arial", 12, FontStyle.Regular), Brushes.Black, seniax + desp, piey)
  67.         e.Graphics.DrawString(Format(Val(Me.txtTotalT.Text) - Val(Me.txtSenia.Text), "0.00"), New Font("Arial", 12, FontStyle.Regular), Brushes.Black, saldox + desp, piey)
  68.     End Sub
La ipresión lo hace en papel continuo de 25cm de ancho por 20,30cm de alto.
Si corro el papel bien hacia la derecha, me recorta del lado derech del papel.
El formulario continuo no puede ser modificado.
Con printer de VB 6.0 funcionaba.

Etiquetas: formulario, impresora, matriz, punto, vb
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 05:14.