Texto a PictueBox y éste a Printer
Hola,
Necesitaría saber como puedo enviar un texto a un Picture box, para después enviarselo a printer (printer.paintpicture) y poder redimensionarlo, de modo que ese texto quede o más alargado, o más achatado... y no dependa del tamaño de la fuente.
De momento, puedo hacer picturebox.print "texto" pero cuando intento hacer printer.paintpicture picturebox,0,0,5200,500 me dice que la imagen no es válida ¿alguna idea?
Gracias
Necesitaría saber como puedo enviar un texto a un Picture box, para después enviarselo a printer (printer.paintpicture) y poder redimensionarlo, de modo que ese texto quede o más alargado, o más achatado... y no dependa del tamaño de la fuente.
De momento, puedo hacer picturebox.print "texto" pero cuando intento hacer printer.paintpicture picturebox,0,0,5200,500 me dice que la imagen no es válida ¿alguna idea?
Gracias
Lo hize! yo mismo!
Private Sub Command1_Click()
'FORMULARIO CON 3 CONTROLES:
'TEXT1
'COMMAND1
'PICTURE1
'LAS MEDIDAS QUE PROPONGO SON PARA QUE EL TEXTO CUADRE EN UNA CAJA DE
'5200 X 700 TWIPS
Set Me.Picture1 = Nothing
Me.Picture1.AutoRedraw = True
Me.Picture1.Font = "Arial"
SALIR = 0
Size = 40
Me.Picture1.Width = 5200
Do
Me.Picture1.Font.Size = Size
If Me.Picture1.Width < Me.Picture1.TextWidth(Me.Text1) Then
Size = Size - 1
Else
SALIR = 1
End If
Loop Until SALIR = 1 Or Size = 2
Me.Picture1.Height = Me.Picture1.TextHeight(Me.Text1)
Me.Picture1.Width = Me.Picture1.TextWidth(Me.Text1)
Me.Picture1.Print Me.Text1
Me.Picture1.Picture = Me.Picture1.Image
Printer.PaintPicture Me.Picture1.Image, 0, 0, 5200, 700
Printer.EndDoc
End Sub
Private Sub Command1_Click()
'FORMULARIO CON 3 CONTROLES:
'TEXT1
'COMMAND1
'PICTURE1
'LAS MEDIDAS QUE PROPONGO SON PARA QUE EL TEXTO CUADRE EN UNA CAJA DE
'5200 X 700 TWIPS
Set Me.Picture1 = Nothing
Me.Picture1.AutoRedraw = True
Me.Picture1.Font = "Arial"
SALIR = 0
Size = 40
Me.Picture1.Width = 5200
Do
Me.Picture1.Font.Size = Size
If Me.Picture1.Width < Me.Picture1.TextWidth(Me.Text1) Then
Size = Size - 1
Else
SALIR = 1
End If
Loop Until SALIR = 1 Or Size = 2
Me.Picture1.Height = Me.Picture1.TextHeight(Me.Text1)
Me.Picture1.Width = Me.Picture1.TextWidth(Me.Text1)
Me.Picture1.Print Me.Text1
Me.Picture1.Picture = Me.Picture1.Image
Printer.PaintPicture Me.Picture1.Image, 0, 0, 5200, 700
Printer.EndDoc
End Sub
