Los foros del Guille

Si no encuentras respuesta, puedes buscar en el sitio del Guille

Google
 

MKN Reservas (Maro - Kayak Nerja)


Kayak Maro - Rutas y alquiler de kayak y tabla
Selecciona el foro y pulsa en mostrar:     Mostrar 
De tu inter�s (algunos de los avisos publicados)

01/feb./2019

Como te avisé, desde el 1 de febrero de 2019

No se podrán escribir nuevos mensajes ni editar los existentes

En breve solo se mostrarán los mensajes con respuestas.
Posiblemente para el 1 de marzo, solamente se mostrarán los que tengan respuestas y estén marcados como respuesta válida.

  Foro: .NET VB Cantidad:  Desde:   Hasta:    Aplicar   Responder 
Respuestas a: 52132 - Como imprimir bien esto
IDAsuntoFechaNick 
52132 Como imprimir bien esto15/03/10 16:21lukasgatsu   
Hola buenas!! Comento mi problemilla. Tengo un TextBox que mando a imprimir, imprime todas las lineas, pero con algun errorcillo, cuando una linea es mas ancha que el "papel" baja una linea el texto restante, pero sobreescribiendo la linea siguiente. Este es el codigo:

Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage

Dim lineasPorPag As Single
Dim posY As Single
Dim fuente As Font = TextBox1.Font
Dim altoFuente As Single = fuente.GetHeight(e.Graphics)
lineasPorPag = e.MarginBounds.Height / altoFuente
Dim lineasImpresasPorPag As Double = 0
Dim areaAlto As Integer = PrintDocument1.DefaultPageSettings.PaperSize.Height - PrintDocument1.DefaultPageSettings.Margins.Top - PrintDocument1.DefaultPageSettings.Margins.Bottom
Dim areaAncho As Integer = PrintDocument1.DefaultPageSettings.PaperSize.Width - PrintDocument1.DefaultPageSettings.Margins.Left - PrintDocument1.DefaultPageSettings.Margins.Right
Dim margenIzquierdo As Integer = PrintDocument1.DefaultPageSettings.Margins.Left
Dim margenSuperior As Integer = PrintDocument1.DefaultPageSettings.Margins.Top
Dim formato As New StringFormat(StringFormatFlags.LineLimit)

While totalLineasImpresas < linea.Length And lineasImpresasPorPag < lineasPorPag
posY = margenSuperior + (lineasImpresasPorPag * altoFuente)
e.Graphics.DrawString(linea(totalLineasImpresas), fuente, Brushes.Black, New RectangleF(margenIzquierdo, posY, areaAncho, areaAlto), formato)
lineasImpresasPorPag += 0.5
totalLineasImpresas += 1
End While

If totalLineasImpresas < linea.Length Then
e.HasMorePages = True
Else
e.HasMorePages = False
End If

End Sub

Para aclarar algun punto no duden en avisarme.

Gracias foreros!
IDAsuntoFechaNick 
53957 Re: Como imprimir bien esto (Resp: 52132)24/09/10 17:47sistemas   
Prueba a medir lo que vas a imprimir antes de imprimirlo así:

Dim Medida As SizeF
Medida = e.Graphics.MeasureString(Texto, Fuente)
e.Graphics.DrawString(Texto, Fuente, Brushes.Black, 40 - Medida.Width / 2, PosicionY)

Aquí imprimies el texto centrado alrededor de la posición 40.


Si esta respuesta resuelve tu duda, por favor pulsa en la de este mensaje. Gracias.
IDAsuntoFechaNick 
54195 Re: Como imprimir bien esto (Resp: 53957)10/11/10 12:50lukasgatsu   
Gracias por tu ayuda, pero al final lo he solucionado asi:

Dim formato As New StringFormat(StringFormatFlags.NoWrap)


Si esta respuesta resuelve tu duda, por favor pulsa en la de este mensaje. Gracias.

 
(c) Guillermo 'guille' Som, 2005-2026  - foros.elGuille v1.0.6.3 (01/Jun/2021 12:45 GMT +2)  - (ASP.NET v4.0.30319.42000)
 
La hora GMT del servidor es: 10/06/2026 11:47:21 GMT