Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Option Explicit
[COLOR=green]'Set MultiLine property of the TextBox to True[/color]
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const EM_GETRECT = &HB2
Private Const EM_SETRECTNP = &HB4
Sub VerMiddleText(mText As TextBox)
If mText.MultiLine = False Then Exit Sub
Dim rc As RECT
Dim tmpTop As Long
Dim tmpBot As Long
SendMessage mText.hwnd, EM_GETRECT, 0, rc
Set Me.Font = mText.Font
tmpTop = ((rc.Bottom - rc.Top) - (mText.Parent.TextHeight("H ") \ Screen.TwipsPerPixelY)) \ 2 + 2
tmpBot = ((rc.Bottom - rc.Top) + (mText.Parent.TextHeight("H ") \ Screen.TwipsPerPixelY)) \ 2 + 2
rc.Top = tmpTop
rc.Bottom = tmpBot
mText.Alignment = vbCenter
SendMessage mText.hwnd, EM_SETRECTNP, 0&, rc
mText.Refresh
End Sub
Private Sub Form_Load()
VerMiddleText Text1
End Sub
Option Explicit
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const EM_GETRECT = &HB2
Private Const EM_SETRECTNP = &HB4
Private Sub Form_Activate()
Me.Text1.SetFocus
End Sub
Private Sub Form_Load()
Call STOP_MOVE(Me.Caption)
Me.TSCONTRINO.Text = SCONTRINO
VerMiddleText Me.TSCONTRINO
End Sub
Private Sub LSI_Click()
NOLOAD1 = True
OK = True
Unload Me
End Sub
Private Sub LNO_Click()
NOLOAD1 = True
OK = False
Unload Me
End Sub
Sub VerMiddleText(mText As TextBox)
If mText.MultiLine = False Then Exit Sub
Dim rc As RECT
Dim tmpTop As Long
Dim tmpBot As Long
SendMessage mText.hwnd, EM_GETRECT, 0, rc
Set Me.Font = mText.Font
tmpTop = ((rc.Bottom - rc.Top) - (mText.Parent.TextHeight("H ") \ Screen.TwipsPerPixelY)) \ 2 + 2
tmpBot = ((rc.Bottom - rc.Top) + (mText.Parent.TextHeight("H ") \ Screen.TwipsPerPixelY)) \ 2 + 2
rc.Top = tmpTop
rc.Bottom = tmpBot
mText.Alignment = vbCenter
SendMessage mText.hwnd, EM_SETRECTNP, 0&, rc
mText.Refresh
End Sub
strongm said:thisCode:is an illustrative idea, NOT a full, production solution[/quote] "now work perfect!" - not really. Type anything in the text box, hit Enter, type something else, hit Enter. ---- Andy [i]"Hmm...they have the internet on computers now"--Homer Simpson[/i]