Results 1 to 5 of 5

Thread: drawing characters on picuturebox

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2001
    Location
    england
    Posts
    87

    drawing characters on picuturebox

    how do i draw a character on a picturebox at a specified location (x,y) ?

    anybody has the codes to do this please help?

  2. #2
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Use the TextOut API call:
    VB Code:
    1. Private Declare Function TextOut Lib "gdi32" Alias "TextOutA" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As String, ByVal nCount As Long) As Long
    2.  
    3. TextOut Me.hDC, X-Value, Y-Value, "This is Text!", Len("This is Text!")
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 2001
    Location
    england
    Posts
    87
    Thanks for the code.

    but it only works when autoredraw is set to false.

    i need to make the text part of the image in the picturebox so i could copy the entire picture into an imagebox.

    i used picture1.picture = picture1.image
    image1.picture = picture1.picture

    can we make the text printed using textout api a permanent part of the picture ?

  4. #4
    Hyperactive Member
    Join Date
    Aug 1999
    Posts
    482
    Use the same code.

    Set autoredraw to TRUE
    and after you use tha api, do a simple

    picture1.refresh

    and boom

  5. #5
    Fanatic Member McCain's Avatar
    Join Date
    Jan 2002
    Location
    Sweden/Denmark
    Posts
    802
    Or you could use:

    Picture1.Print Text$

    To specify the location of the text use:
    Picture1.CurrentX =
    Picture1.CurrentY =

    And be sure to set AutoRedraw = True
    Last edited by McCain; Feb 18th, 2002 at 08:12 PM.
    Never argue with fools, they will only drag you down to their level, and beat you with experience.

    Q: How do you tell an experienced hacker from a novice?
    A: The latter thinks there's 1000 bytes in a kilobyte, while the former is sure there's 1024 meters in a kilometer

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