VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Set caption to a PictureBox

by Jafo C - Null (3 Submissions)
Category: Miscellaneous
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Wed 1st May 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Set caption to a PictureBox

Rate Set caption to a PictureBox



'SetPicCapt: Set caption to a picbox
'You must set the Font properties from the PicBox Properties
'This code will work with forms too(If an error just Modify)

Sub SetPicCapt(DestObject As PictureBox, ByVal Caption As String)
    
    Dim intX As Integer, intY As Integer, IntWidth As Integer, IntHeight As Integer
    
    DestObject.AutoRedraw = True
    IntWidth = DestObject.TextWidth(Caption)
    IntHeight = DestObject.TextHeight(Caption)
    intX = DestObject.Width / 2 - IntWidth / 2
    intY = DestObject.Height / 2 - IntHeight / 2
    
    
    DestObject.CurrentX = intX
    DestObject.CurrentY = intY
    DestObject.Print Trim$(Caption)
    
End Sub

Download this snippet    Add to My Saved Code

Set caption to a PictureBox Comments

No comments have been posted about Set caption to a PictureBox. Why not be the first to post a comment about Set caption to a PictureBox.

Post your comment

Subject:
Message:
0/1000 characters