Log inUsernamePassword
Log me on automatically each visit    
Register
Register
Log in to check your private messages
Log in to check your private messages
Visual Basic Forum for Visual Basic Programmers VB Forum Index » General

Post new topic   Reply to topic
Add text to image in picturebox
View previous topic :: View next topic  
Author Message
boroarke
Newbie


Joined: 27 Apr 2006
Posts: 1

PostPosted: Apr 27th, 2006 11:24 AM    Post subject: Add text to image in picturebox Reply with quote

I'm still pretty new to programming so please bare with me and any help that can be offered is greatly appreciated. I have a program in which the user loads an image which is displayed in a picturebox. The user can then print this image from their printer. I would like to add controls which will allow the user to click anywhere in the picture box and then type text which will be printed on the image when the image is later printed. I would like the user to be able to select the font from a list of fonts already installed on the users PC as well as the size of the font and the color. Once the text is typed, id like the user to have the ability to click the text and be able to move it, edit it or delete it.

Is this something that would be fairly simple to do? Any one know of a tutorial or guide that will walk me through the process of doing something like this? Thanks in advance for any help!

Bryan
Back to top
View user's profile Send private message
sprog90
Newbie


Joined: 21 Jul 2005
Posts: 20

PostPosted: May 1st, 2006 03:55 AM    Post subject: Reply with quote

For the list with the fonts use that code
Code:
Private Sub Form_Load()
    For i = 1 To Screen.FontCount - 1
        List1.AddItem Screen.Fonts(i)
    Next
End Sub

or
Code:
CommonDialog1.Flags = cdlCFBoth
CommonDialog1.ShowFont



The other changes like colour, size, you can change them using
Code:
Label1.ForeColor = &HFF&
Label1.FontSize = 12
Label1.FontName = List1.Text


Now about the text you can use a label with the property backstyle = 0-transparent

To edit it you can use:
Code:
Label1.Caption = InputBox("Change the label's caption")


To delete it you can use:
Code:
Label1.Visible = False


To move it you can use 4 buttons and then the code:
Code:
Private Sub cmdDown_Click()
    Label1.Top = Label1.Top + 50
End Sub

Private Sub cmdLeft_Click()
    Label1.Left = Label1.Left - 50
End Sub

Private Sub cmdRight_Click()
    Label1.Left = Label1.Left + 50
End Sub

Private Sub cmdUp_Click()
    Label1.Top = Label1.Top - 50
End Sub


Now about the printing you can use the me.PrintForm, that print all the form, but i think that is not actually what you need.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Visual Basic Forum for Visual Basic Programmers VB Forum Index » General All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Visual Basic Forum runs phpBB | Forum Template © iOptional
VB Resources | SSL | Visual Basic