Results 1 to 9 of 9

Thread: How to align the character to a common baseline??

  1. #1

    Thread Starter
    Hyperactive Member toughcoder's Avatar
    Join Date
    Nov 2002
    Location
    Near, Very Near
    Posts
    340

    Question How to align the character to a common baseline??

    Hello Every1,
    I have a doubt,
    Now I'm displaying some characters ina picturebox with the print statement. I'm also changing the font.

    Follow these statements
    Picture1.FontSize=10
    Picture1.Print "A"
    Picture1.FontSize=12
    Picture1.Print "A"

    The problem is, both the 'A' are not on the same base line. The bigger A is moving some pixels down. Can any1 tell me a logic so that the program calculates the size of the characters and align them perfectly on the same baseline.
    If Not VB Then Exit
    ------------------------------------------------
    visit me @ http://mzubair.50g.com/

  2. #2
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    I'm not sure if you can print more on one line after you have printed something on it...but if you print all at the same time, it should work fine...

  3. #3
    Frenzied Member cyborg's Avatar
    Join Date
    May 2000
    Location
    Sweden
    Posts
    1,755
    i know one way, but there must be a better one..
    make a label and set autosize to true....
    then set the caption of the label to the "A" and see the .with and .height properties...
    then to set the position where to draw: .cyrrentx and .currenty
    Check out the FAQ and do a search before you post.
    My tutorials: Anti-Alias Pixels, Accurate Game Loop, Resource File

  4. #4
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    heheheeh....nice one Cyborg...

  5. #5
    Frenzied Member cyborg's Avatar
    Join Date
    May 2000
    Location
    Sweden
    Posts
    1,755
    hehe
    Check out the FAQ and do a search before you post.
    My tutorials: Anti-Alias Pixels, Accurate Game Loop, Resource File

  6. #6
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Don't know if it's possible with pure VB, but you can use the SetTextAlign API to specify that the y coordinate you pass to the TextOut API family is the baseline of the characters, not the top line.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  7. #7
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    It wouldn't matter, because VB6 has the handy TextHeight function, you can just subtract it from the Y value and you have it lined up.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  8. #8
    Fanatic Member alkatran's Avatar
    Join Date
    Apr 2002
    Location
    Canada
    Posts
    860
    Picture1.FontSize=10
    Picture1.Print "A"
    currenty = 0 'im not sure if this works
    Picture1.FontSize=12
    Picture1.Print "A"

    One thing I noticed when I transfered from QB to VB was that they got rid of locate (to put where text goes) and that text overlaps now and you have to erase it yourself! (GRRRRRR )

    Another thing I noticed was that if I did a Line or Circle command, it would print where I last started something.. hmmmm

    Then I found out currentx and currenty are used to place text.
    Don't pay attention to this signature, it's contradictory.

  9. #9
    Frenzied Member cyborg's Avatar
    Join Date
    May 2000
    Location
    Sweden
    Posts
    1,755
    you have to use the Picture1.CurrentY....if you just type CurrentY its the Form property...
    Check out the FAQ and do a search before you post.
    My tutorials: Anti-Alias Pixels, Accurate Game Loop, Resource File

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