Portal    Foro    Buscar    FAQ    Registrarse    Conectarse


Publicar nuevo tema  Responder al tema 
Página 1 de 1
 
 
Imprimir En Gambas3 - Alguien Tiene Un Fragmento De Código Que Funcione?
Autor Mensaje
Responder citando   Descargar mensaje  
Mensaje Imprimir En Gambas3 - Alguien Tiene Un Fragmento De Código Que Funcione? 
 
Estoy migrando a Gambas3 y no puedo imprimir!!!

Alguien seria tan amable de pegar algun fragmento de código sencillo de como realizar tal operación?

Parece cosa de brujos!!!.
 



 
arubioc - Ver perfil del usuarioEnviar mensaje privadoVisitar sitio web del usuario 
Volver arribaPágina inferior
Responder citando   Descargar mensaje  
Mensaje Re: Imprimir En Gambas3 - Alguien Tiene Un Fragmento De Código Que Funcione? 
 
Yo me hice una clase para imprimir, (creaba un archivo .html)

http://foro.gambas-es.org/viewtopic.php?f=5&t=2276

Saludos
 




===================
Blog personal
Web: SoloGambas seleccion de articulos dedicados a Gambas
Visita el Curso de Gambas3 ¡¡¡Gratuito!!!
 
jsbsan - Ver perfil del usuarioEnviar mensaje privadoVisitar sitio web del usuario 
Volver arribaPágina inferior
Responder citando   Descargar mensaje  
Mensaje Re: Imprimir En Gambas3 - Alguien Tiene Un Fragmento De Código Que Funcione? 
 
Le pego un vistazo, como no otra vez mil gracias
 



 
arubioc - Ver perfil del usuarioEnviar mensaje privadoVisitar sitio web del usuario 
Volver arribaPágina inferior
Responder citando   Descargar mensaje  
Mensaje Re: Imprimir En Gambas3 - Alguien Tiene Un Fragmento De Código Que Funcione? 
 
hola man, te comento yo estoy haciendo un proyecto (CLText) y nesesitava la opcion de imprimir, aca te dejo el codigo de como lo logre:

primero que nada yo en mi caso utilizo un TextEdit y El "Elemento" Printer, una vez destacado esto, lo primero que aremos sera crear un Sub el cual sera:

Private Sub GetText() As String
  
  Dim sText As String
  
  sText = TextEdit1.Text
  sText = Replace(Html(sText), "\n", "<br>")  
  Return sText
  
End
 

(Recuerda Remplazar TextEdit1 por el nombre de tu TextEdit)
luego en el boton de imprimir pegaremso el siguiente codigo:
If prtText.Configure() Then Return
   Inc Application.Busy
   prtText.Print
   Dec Application.Busy
 

(Recuerda Remplazar prtText por el nombre de tu elemento Print)
ahora crearemos un nuevo sub el cual sera:
Public Sub prtText_Begin()
  
  Dim PRINT_MARGIN As Float = Paint.Width / prtText.PaperWidth * 10
  Dim hExtents As PaintExtents
  
  hExtents = Paint.RichTextExtents(GetText(), Paint.Width - PRINT_MARGIN * 2)
  prtText.Count = Ceil(hExtents.Height / (Paint.Height - PRINT_MARGIN * 2))
  
End

y otro sub mas el cual sera:
Public Sub prtText_Draw()

  Dim PRINT_MARGIN As Float = Paint.Width / prtText.PaperWidth * 10
    
  Debug "Printing page";; prtText.Page
  
  
  Paint.Rectangle(PRINT_MARGIN / 2, PRINT_MARGIN / 2, Paint.Width - PRINT_MARGIN, Paint.Height - PRINT_MARGIN)
  Paint.LineWidth = Paint.Width / prtText.PaperWidth * 0.5
  Paint.Stroke
  Paint.Rectangle(PRINT_MARGIN, PRINT_MARGIN, Paint.Width - PRINT_MARGIN * 2, Paint.Height - PRINT_MARGIN * 2)
  Paint.Clip
  Paint.DrawRichText(GetText(), PRINT_MARGIN, PRINT_MARGIN - (prtText.Page - 1) * (Paint.Height - PRINT_MARGIN * 2), Paint.Width - PRINT_MARGIN * 2, Paint.Height * prtText.Count, Align.TopNormal)
  Paint.ResetClip
  
End


y listo solo te queda editar un poco los Paint  para agregarle fuente y color y eso. espero que te sirva
 



 
kingworld - Ver perfil del usuarioEnviar mensaje privado 
Volver arribaPágina inferior
Responder citando   Descargar mensaje  
Mensaje Re: Imprimir En Gambas3 - Alguien Tiene Un Fragmento De Código Que Funcione? 
 
Perfecto!.
Me ayuda muchísimo, ya que he conseguido imprimir pero creia que era por casualidad... ahora veo que no... que tu tambien procedes más o menos de la misma forma.

Lo que no logro entender es como Gambas2 y Gambas3 son tan diferentes para imprimir, la migración de todos los listados de un programa pueden dar para muchisimas horas de migración.
No se hasta que punto migrar una aplicación puede ser rentable.

Gracias kingworld
 



 
arubioc - Ver perfil del usuarioEnviar mensaje privadoVisitar sitio web del usuario 
Volver arribaPágina inferior
Responder citando   Descargar mensaje  
Mensaje Re: Imprimir En Gambas3 - Alguien Tiene Un Fragmento De Código Que Funcione? 
 
Pero.... y como haces varias páginas.
 



 
arubioc - Ver perfil del usuarioEnviar mensaje privadoVisitar sitio web del usuario 
Volver arribaPágina inferior
Mostrar mensajes anteriores:    
 
OcultarTemas parecidos
Tema Autor Foro Respuestas último mensaje
No hay nuevos mensajes En Gambas 3 Tiene Problema De Imprimir david Controles/Librerías/Componentes 2 Martes, 11 Octobre 2011, 20:43 Ver último mensaje
david
No hay nuevos mensajes ¿Alguien Sabe Como Desplegar Un Colorbutt... shordi General 2 Jueves, 14 Marzo 2013, 12:49 Ver último mensaje
shordi
No hay nuevos mensajes Petición: ¿Alguien Tiene Hecho Un Calend... shordi General 13 Viernes, 30 Enero 2015, 20:13 Ver último mensaje
jsbsan
No hay nuevos mensajes Alguien Tiene Un Tpv hecho en Linux? desoljor General 2 Jueves, 21 Abril 2016, 19:47 Ver último mensaje
jsbsan
 

Publicar nuevo tema  Responder al tema  Página 1 de 1
 

Usuarios navegando en este tema: 0 registrados, 0 ocultos y 1 invitado
Usuarios registrados conectados: Ninguno


 
Lista de permisos
No puede crear mensajes
No puede responder temas
No puede editar sus mensajes
No puede borrar sus mensajes
No puede votar en encuestas
No puede adjuntar archivos
Puede descargar archivos
No puede publicar eventos en el calendario



  

 

cron