|
-
Sep 3rd, 2006, 08:36 AM
#1
Thread Starter
Frenzied Member
[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________(___)____
__(___)_________) _/_____
___\_ (_________(_/______
____\_)_________________
-
Sep 3rd, 2006, 08:42 AM
#2
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
-
Sep 3rd, 2006, 08:48 AM
#3
Thread Starter
Frenzied Member
Re: Centering text vertically
__________________
________________0îîî___
___îîî0________(___)____
__(___)_________) _/_____
___\_ (_________(_/______
____\_)_________________
-
Sep 3rd, 2006, 08:59 AM
#4
Re: Centering text vertically
this is probably a fair bit simpler. use two textboxes.
VB Code:
' Text1 - the 'outside' box, set Locked = True and clear the text property at design time
' Text2 - the 'inside' box, set BorderStyle = None at design time
Private Sub Form_Load()
With Text2
.Height = 15 ' or 1-pixel
.Move Text1.Left + 15, (Text1.Height - .Height) \ 2 + Text1.Top
End With
End Sub
Private Sub Text1_GotFocus()
Text2.SetFocus
Text2.SelStart = Len(Text2.Text)
End Sub
-
Sep 3rd, 2006, 09:01 AM
#5
Re: Centering text vertically
Interesting...I might use that from now on then 
chem
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Sep 3rd, 2006, 11:27 AM
#6
Thread Starter
Frenzied Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|