print on image box

i need code that can print on image like the print on form

Page 1 of 1

1 Replies - 3840 Views - Last Post: 18 November 2007 - 11:51 PM Rate Topic: -----

#1 bobrus  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 17-November 07

print on image box

Posted 17 November 2007 - 10:48 PM

Private Sub Form_Activate()
Dim StaticTxt As String
StaticTxt = re.Text
Form1.AutoRedraw = True
For i = 0 To 1
Print StaticTxt
CurrentX = X1
CurrentY = Y1
Next i
'Unload Me
End Sub

MOD EDIT: Use code tags to enclose your code. :code:
Is This A Good Question/Topic? 0
  • +

Replies To: print on image box

#2 Ken Halter  Icon User is offline

  • New D.I.C Head

Reputation: 14
  • View blog
  • Posts: 35
  • Joined: 18-November 07

Re: print on image box

Posted 18 November 2007 - 11:51 PM

I don't quite get the question... Print on an Image control? or box? or...?

but, anyway... if you move that code to the paint event, you won't need to set the form's AutoRedraw = True.... much smaller resource footprint... especially if you're showing multiple forms.

This'll work in Activate or Paint. Remove the comment mark from the AutoRedraw line if you move it to the Activate event.

Private Sub Form_Paint()
   Dim StaticTxt As String
   Dim i As Integer
   Dim X1 As Single
   Dim Y1 As Single
   
   StaticTxt = re.Text
   'Form1.AutoRedraw = True
   
   X1 = 300 'if using Small Fonts, this = 20 pixels
   Y1 = 300
   
   For i = 0 To 10
	  'Set the pos before printing
	  CurrentX = X1
	  CurrentY = Y1
	  
	  Print StaticTxt
	  
	  'Drop down a line.
	  Y1 = Y1 + Me.TextHeight("Yy")
   Next i

End Sub


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1