Sunday, June 17, 2012

Bermain Dengan Horizontal Vertical Scroll TextBox

Option Explicit

Const EM_LINESCROLL = &HB6

Private Declare Function SendMessage Lib "User32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Long) As Long

Private Sub Form_Load()
Dim intLineIndex As Integer, intWordIndex As Integer

Text1.Font = "Courier New"
Text1.Text = ""
For intLineIndex = 1 To 25
Text1.Text = Text1.Text & "Line" & Str$(intLineIndex)
For intWordIndex = 1 To 5
Text1.Text = Text1.Text & " Word" & Str$(intWordIndex)
Next intWordIndex
Text1.Text = Text1.Text & vbCrLf
Next intLineIndex

Command1.Caption = "Vertical"
Command2.Caption = "Horizontal"
End Sub

Private Sub Command1_Click()
Dim lngRet As Long
lngRet = SendMessage(Text1.hWnd, EM_LINESCROLL, 0, 5&)
End Sub

Private Sub Command2_Click()
Dim lngRet As Long
lngRet = SendMessage(Text1.hWnd, EM_LINESCROLL, 5, 0&)
End Sub