Welcome to Dream.In.Code
Become a VB Expert!

Join 149,542 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,554 people online right now. Registration is fast and FREE... Join Now!




print on image box

 
Reply to this topicStart new topic

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

bobrus
17 Nov, 2007 - 09:48 PM
Post #1

New D.I.C Head
*

Joined: 17 Nov, 2007
Posts: 1


My Contributions
CODE
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.gif
User is offlineProfile CardPM
+Quote Post

Ken Halter
RE: Print On Image Box
18 Nov, 2007 - 10:51 PM
Post #2

New D.I.C Head
*

Joined: 18 Nov, 2007
Posts: 35



Thanked: 6 times
My Contributions
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.

CODE
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

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 09:24PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month