Ver Mensaje Individual
  #3 (permalink)  
Antiguo 03/11/2011, 14:31
Geovanny0401
 
Fecha de Ingreso: diciembre-2009
Mensajes: 137
Antigüedad: 16 años, 10 meses
Puntos: 4
Pregunta Respuesta: Imprimir en VB .Net

Código PHP:
Public Sub ImprimirTexto(ByVal lPos As Single, ByVal rPos As Single, ByRef yPos As Single, ByVal Texto As String, ByVal FontImp As System.Drawing.Font, ByVal ev As System.Drawing.Printing.PrintPageEventArgs, Optional ByVal sep As Long = 0, Optional ByVal lngAlto As Long = 980)
        
Dim lngEspacio As Single = rPos - lPos
        Dim K 
As Long, tmpTexto As String
        
If lngEspacio = 0 Then
            lngEspacio 
= 100
        End 
If
        
Texto = Comprimir(Texto)
        Do While 
ev.Graphics.MeasureString(Texto, FontImp).Width > lngEspacio
            K 
= 1
            
Do While (ev.Graphics.MeasureString(Mid(Texto, 1, K), FontImp).Width < lngEspacio)
                
K += 1
            Loop
            
Do While K > 1 And (InStr(" ,;.", Mid(Texto, K, 1)) = 0)
                
K -= 1
            Loop
            
If K > 1 Then
                tmpTexto 
= Mid(Texto, 1, K)
                
Texto = Comprimir(Mid(Texto, K + 1))
            Else
                
tmpTexto = Texto
                Texto 
= ""
            
End If
            
ev.Graphics.DrawString(tmpTexto, FontImp, Brushes.Black, lPos, yPos, New StringFormat)
            
yPos += FontImp.GetHeight(ev.Graphics) + sep
            
If yPos >= lngAlto Then
                
Exit Do
            
End If
        
Loop
        
If Texto.Length > 0 Then
            ev
.Graphics.DrawString(Texto, FontImp, Brushes.Black, lPos, yPos, New StringFormat)
            
yPos += FontImp.GetHeight(ev.Graphics) + sep
        End 
If
    
End Sub