Results 1 to 4 of 4

Thread: [RESOLVED] Centering Text in Picture Box, How?

  1. #1

    Thread Starter
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965

    Resolved [RESOLVED] Centering Text in Picture Box, How?

    I am trying to centering text on a picture inside of a picture box but I am not able to do so. Here is my code:

    VB Code:
    1. Private Sub Command1_Click()
    2. Dim strMSG  As String
    3. Dim sngX As Single
    4. Dim sngY As Single
    5.  
    6.     With Picture1
    7.         .AutoRedraw = True
    8.         .AutoSize = True
    9.         .Picture = Clipboard.GetData(vbCFBitmap)
    10.         .ForeColor = vbWhite
    11.         .Move (ScaleWidth / 2) - (.Width / 2), (ScaleHeight / 2) - (.Height / 2)
    12.     End With
    13.    
    14.         strMSG = "Sample Text"
    15.         sngX = Int((Picture1.Width / 2) - (Len(strMSG)/2))
    16.         sngY = Int(Picture1.Height * 0.9)
    17.        
    18.         Picture1.CurrentX = sngX ' Position where you want to print text
    19.         Picture1.CurrentY = sngY ' Position where you want to print text
    20.         Picture1.Print strMSG
    21. End Sub


    Also how would I print the text on the bottom of the picture.
    Regards,

    Mark

    Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."


  2. #2

  3. #3

    Thread Starter
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965

    Re: Centering Text in Picture Box, How?

    Thanks again Rhino!
    Regards,

    Mark

    Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."


  4. #4

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width