Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing on a VB6 Picturebox 1

Status
Not open for further replies.

Ken01

Programmer
Aug 8, 2014
60
GB
How can text be printed on a VB6 Picturebox control Labels don't seem to be permitted.
 
Picturebox has a Print method (and CurrentX and CurrentY properties to set the point at which printing will occur)
 
What do you mean by "text be printed on a VB6 Picturebox control"?
PictureBox control is usually used to show a picture / image.

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
>used to show a picture

Such a sheltered life you lead, Andy [wink] . There is so muchg more you can do with a picturebox - it is a graphical canvas you can paint on to your heart's delight. Animate an image, add captions and annotations, stream video on it (with a bit of work), apply filters, composite images. etc, etc ...

If you just want to show a picture ... use the much more limited Image control
 
I use 2 labels on a picture box to add a caption to a photograph. Set a transparent background and offset the x and y of one label and set the foreground colour of the rearmost label to black. This gives the appearance of a shadow.


[gray]Experience is something you don't get until just after you need it.[/gray]
 
 https://files.engineering.com/getfile.aspx?folder=2d928b58-a230-4394-83b6-db9580205df9&file=Picture_Box.jpg
But you can achieve exactly the same effect printing directly to the picturebox. No need for extra controls. Guess it comes down to personal preference.

here's an example

Code:
[COLOR=blue]    With Picture1
        .AutoRedraw = True
    
        .ScaleMode = vbPixels
        .FontName = "Arial"
        .FontSize = 18
        .FontBold = True
        
        .CurrentX = 15
        .CurrentY = 15
        .ForeColor = vbBlack
        Picture1.Print "Just an example"
        
        .CurrentX = 13
        .CurrentY = 13
        .ForeColor = vbWhite
        Picture1.Print "Just an example"
        .AutoRedraw = False
    End With[/color]

picturebox_itxxli.png
 
Thank you, especially for the example. That has solved my problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top