Results 1 to 2 of 2

Thread: text in picturebox

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2001
    Location
    chennai
    Posts
    69

    text in picturebox

    Hi,
    Now i am developing paint application using vb.i need to insert text in the picturebox(like MS Paint).Where i click the mouse.How to do?

    Regards
    Murugan

  2. #2
    PowerPoster MidgetsBro's Avatar
    Join Date
    Oct 2000
    Location
    Apparently, Internet.com
    Posts
    3,125
    VB Code:
    1. 'picture1 autoredraw set to true and scalemode set to 3 - Pixel
    2. Private Declare Function TextOut Lib "gdi32" Alias "TextOutA" _
    3. (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal _
    4. lpString As String, ByVal nCount As Long) As Long
    5.  
    6. Dim myColor As Long
    7. Dim myText As String
    8.  
    9. Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    10. myColor = vbBlue
    11. myText = InputBox("enter some text")
    12. Picture1.ForeColor = myColor
    13. Picture1.FontSize = 12
    14. TextOut Picture1.hdc, X, Y, myText, Len(myText)
    15. Picture1.Refresh
    16. End Sub
    <removed by admin>

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