Results 1 to 6 of 6

Thread: [RESOLVED] Centering text vertically

  1. #1

    Thread Starter
    Frenzied Member litlewiki's Avatar
    Join Date
    Dec 2005
    Location
    Zeta Reticuli Distro:Ubuntu Fiesty
    Posts
    1,162

    Resolved [RESOLVED] Centering text vertically

    I attached two pictures of text boxes with password property



    and



    As we can see the text in the second one is aligned in the middle(vertically) whereas the text in the first one is not.

    So how do i center the text for the first text box??

    p.s:The second one is the dialup interface of windows
    __________________
    ________________0îîî___
    ___îîî0________(___)____
    __(___)_________) _/_____
    ___\_ (_________(_/______
    ____\_)_________________

  2. #2
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: Centering text vertically

    I think the font is just bigger, and the textbox is sized to the text, to give the effect that its centered.

    chem

    Visual Studio 6, Visual Studio.NET 2005, MASM

  3. #3

    Thread Starter
    Frenzied Member litlewiki's Avatar
    Join Date
    Dec 2005
    Location
    Zeta Reticuli Distro:Ubuntu Fiesty
    Posts
    1,162

    Re: Centering text vertically

    http://www.codeguru.com/cpp/v-s/devs...cle.php/c8491/

    check out this link .This is what i wanted
    __________________
    ________________0îîî___
    ___îîî0________(___)____
    __(___)_________) _/_____
    ___\_ (_________(_/______
    ____\_)_________________

  4. #4
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: Centering text vertically

    this is probably a fair bit simpler. use two textboxes.
    VB Code:
    1. ' Text1 - the 'outside' box, set Locked = True and clear the text property at design time
    2. ' Text2 - the 'inside' box, set BorderStyle = None at design time
    3.  
    4. Private Sub Form_Load()
    5.     With Text2
    6.         .Height = 15 ' or 1-pixel
    7.         .Move Text1.Left + 15, (Text1.Height - .Height) \ 2 + Text1.Top
    8.     End With
    9. End Sub
    10.  
    11. Private Sub Text1_GotFocus()
    12.     Text2.SetFocus
    13.     Text2.SelStart = Len(Text2.Text)
    14. End Sub

  5. #5
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: Centering text vertically

    Interesting...I might use that from now on then

    chem

    Visual Studio 6, Visual Studio.NET 2005, MASM

  6. #6

    Thread Starter
    Frenzied Member litlewiki's Avatar
    Join Date
    Dec 2005
    Location
    Zeta Reticuli Distro:Ubuntu Fiesty
    Posts
    1,162

    Re: Centering text vertically

    Wow Thats look cool .Nice hack .thanks bush
    __________________
    ________________0îîî___
    ___îîî0________(___)____
    __(___)_________) _/_____
    ___\_ (_________(_/______
    ____\_)_________________

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