Results 1 to 27 of 27

Thread: *Resolved* Outlined text

  1. #1

    Thread Starter
    Fanatic Member petrus's Avatar
    Join Date
    May 2002
    Location
    pBytes[sizeof(pBytes)/2]
    Posts
    553

    *Resolved* Outlined text

    I want to print outlined text in a picturebox, howto?
    Last edited by petrus; Sep 5th, 2002 at 12:36 PM.
    ICQ: 128716725

  2. #2
    PowerPoster
    Join Date
    Aug 2002
    Location
    NY, NY
    Posts
    2,139
    petrus,
    can you describe what exactly are you after?

  3. #3

    Thread Starter
    Fanatic Member petrus's Avatar
    Join Date
    May 2002
    Location
    pBytes[sizeof(pBytes)/2]
    Posts
    553
    Yes, i can.
    I want to type some text on a picturebox (with the print function), and i want to have a line around the text, just one pixel wide.
    Do you understand now?
    ICQ: 128716725

  4. #4
    PowerPoster
    Join Date
    Aug 2002
    Location
    NY, NY
    Posts
    2,139
    I understand now. Try this sample and let me know:
    Dim strText As String
    Dim X1, Y1, X2, Y2

    Picture1.AutoRedraw = True
    strText = "This a sample text"
    Picture1.Print vbNewLine & vbTab & strText & vbNewLine & vbTab
    X1 = Picture1.TextWidth(vbTab)
    X2 = X1 + Picture1.TextWidth(strText)
    Y1 = Picture1.TextHeight("T") * 2.5
    Y2 = Y1
    Picture1.Line (X1, Y1)-(X2, Y2)

    Cheers, Roy

  5. #5
    PowerPoster
    Join Date
    Aug 2002
    Location
    NY, NY
    Posts
    2,139
    Sorry, forgot to include Picture1.DrawWidth = 2 as the second line

  6. #6
    PowerPoster
    Join Date
    Aug 2001
    Location
    new jersey
    Posts
    2,904
    I know that I've seen that question answered before and fairly recently. Do a search for "text in picturebox" on this forum and on CodeGuru forum.

  7. #7

    Thread Starter
    Fanatic Member petrus's Avatar
    Join Date
    May 2002
    Location
    pBytes[sizeof(pBytes)/2]
    Posts
    553
    I've just searched the code, and to me it looks like it will just draw a line under it, but i will check again and test it! Thanx.
    ICQ: 128716725

  8. #8
    PowerPoster
    Join Date
    Aug 2002
    Location
    NY, NY
    Posts
    2,139
    If what I gave isn't enough.

    ;-)

  9. #9

    Thread Starter
    Fanatic Member petrus's Avatar
    Join Date
    May 2002
    Location
    pBytes[sizeof(pBytes)/2]
    Posts
    553
    Yepp, it just draw a line under the text
    ICQ: 128716725

  10. #10
    PowerPoster
    Join Date
    Aug 2002
    Location
    NY, NY
    Posts
    2,139
    So finish your rectangle by yourself. What's the problem. as a programmer you must not ask for an ready answer - but instead just for an idea and try to work arround it.

    BTW, instead going into this sort of hassle I'd rather use a flat transparent label without border and shape control.

    Cheers

  11. #11
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808
    How about this?
    VB Code:
    1. Private Sub Command1_Click()
    2.     Dim strText As String
    3.     Dim X1, Y1, X2, Y2
    4.    
    5.     Picture1.AutoRedraw = True
    6.     strText = "This a sample text"
    7.     Picture1.Print vbNewLine & vbTab & strText & vbNewLine & vbTab
    8.     X1 = Picture1.TextWidth(vbTab) - Picture1.TextWidth(" ")
    9.     X2 = X1 + Picture1.TextWidth(strText) + 2 * Picture1.TextWidth(" ")
    10.     Y1 = Picture1.TextHeight("T") * 2.5 - Picture1.TextHeight("T") * 2: Y2 = Y1
    11.    
    12.     Picture1.Line (X1, Y1)-(X2, Y2)
    13.    
    14.     Y2 = Picture1.TextHeight("T") * 2.5
    15.     Picture1.Line -(X2, Y2)
    16.    
    17.     Picture1.Line -(X1, Y2)
    18.    
    19.     Picture1.Line -(X1, Y1)
    20. End Sub
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  12. #12

    Thread Starter
    Fanatic Member petrus's Avatar
    Join Date
    May 2002
    Location
    pBytes[sizeof(pBytes)/2]
    Posts
    553
    Can't do that.
    How to fill letters? In the P letter, the circle at the top should be filled with some color.
    ICQ: 128716725

  13. #13
    PowerPoster
    Join Date
    Aug 2001
    Location
    new jersey
    Posts
    2,904
    yeah, I guess it would be really hard to use that code to make 3 more lines

  14. #14
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808
    Nicer way... (all the variables are calculated all together)

    VB Code:
    1. Private Sub Command1_Click()
    2.     Dim strText As String
    3.     Dim X1, Y1, X2, Y2
    4.    
    5.     Picture1.AutoRedraw = True
    6.     strText = "This a sample text"
    7.     Picture1.Print vbNewLine & vbTab & strText & vbNewLine & vbTab
    8.    
    9.     X1 = Picture1.TextWidth(vbTab) - Picture1.TextWidth(" ")
    10.     X2 = X1 + Picture1.TextWidth(strText) + 2 * Picture1.TextWidth(" ")
    11.     Y1 = Picture1.TextHeight("T") * 2.5 - Picture1.TextHeight("T") * 2
    12.     Y2 = Picture1.TextHeight("T") * 2.5
    13.    
    14.     Picture1.Line (X1, Y1)-(X2, Y1)
    15.     Picture1.Line -(X2, Y2)
    16.     Picture1.Line -(X1, Y2)
    17.     Picture1.Line -(X1, Y1)
    18. End Sub
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  15. #15

    Thread Starter
    Fanatic Member petrus's Avatar
    Join Date
    May 2002
    Location
    pBytes[sizeof(pBytes)/2]
    Posts
    553
    Sorry, but i think you missunderstood me.
    I don't want a BOX around the text.
    Check out my picture attached.
    The black around the letter in the picture is what i want to do.
    Attached Files Attached Files
    ICQ: 128716725

  16. #16
    PowerPoster
    Join Date
    Aug 2002
    Location
    NY, NY
    Posts
    2,139
    You need a Font Builder utility to do that. Fonts are contained of a small bitmaps and each character (which is predesigned) is been drawn for you by the system based on your current settings.

  17. #17
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808
    Not necessarily. You could play with your image to get what you want. Like I did in this example. Anyway... it's not that easy, and can't do it right now.
    Attached Files Attached Files
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  18. #18
    PowerPoster
    Join Date
    Aug 2002
    Location
    NY, NY
    Posts
    2,139
    You won't be able to do this in the lifetime using VB.

    ;-)

  19. #19
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Well

    I may be missing what you are trying to do but try this example and see if it works for you...
    Attached Files Attached Files
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  20. #20
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808
    Originally posted by IROY55
    You won't be able to do this in the lifetime using VB.

    ;-)
    Wow!! Seems like someone could do it with VB!!



    You didn't miss anything James... that's what he was looking for.
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  21. #21
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808
    And... by the way, it's as easy as I used to do it in QBasic.
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  22. #22
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Well

    Originally posted by IROY55
    You won't be able to do this in the lifetime using VB.

    ;-)
    Never noticed this

    IROY55 : Times up !!!
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  23. #23
    PowerPoster
    Join Date
    Aug 2002
    Location
    NY, NY
    Posts
    2,139
    He, he..
    That was nice, obviously didn't think about overlaying 2 messages.

    ;-)

  24. #24
    Fanatic Member kinjalgp's Avatar
    Join Date
    Apr 2000
    Location
    India
    Posts
    535
    Thats KOOL James

  25. #25
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Well

    Originally posted by kinjalgp
    Thats KOOL James
    Not my code. Do not want to take the credit, but you are right, it is cool...
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  26. #26

    Thread Starter
    Fanatic Member petrus's Avatar
    Join Date
    May 2002
    Location
    pBytes[sizeof(pBytes)/2]
    Posts
    553
    Thanx! That was exactly what i wanted!
    ICQ: 128716725

  27. #27
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Well

    Originally posted by petrus
    Thanx! That was exactly what i wanted!
    Glad I could help... Edit you subject of your first post and add Resolved (proper way of doing it here, although no-one does )
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

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