КАК ПРОГРАМНО ЗАСКРОЛИТЬ ТЕКСТБОКС?

Программирование на Visual Basic, главный форум. Обсуждение тем программирования на VB 1—6.
Даже если вы плохо разбираетесь в VB и программировании вообще — тут вам помогут. В разумных пределах, конечно.
Правила форума
Темы, в которых будет сначала написано «что нужно сделать», а затем просьба «помогите», будут закрыты.
Читайте требования к создаваемым темам.
step
Бывалый
Бывалый
 
Сообщения: 217
Зарегистрирован: 03.08.2004 (Вт) 16:19

КАК ПРОГРАМНО ЗАСКРОЛИТЬ ТЕКСТБОКС?

Сообщение step » 08.01.2005 (Сб) 20:53

Как програмно скролить текст бокс, может послать сообщение текстбоксу с кодом PageDown? Подскажите ПЛЗ!

tyomitch
Пользователь #1352
Пользователь #1352
Аватара пользователя
 
Сообщения: 12822
Зарегистрирован: 20.10.2002 (Вс) 17:02
Откуда: חיפה

Сообщение tyomitch » 08.01.2005 (Сб) 20:58

WM_VSCROLL
Изображение

step
Бывалый
Бывалый
 
Сообщения: 217
Зарегистрирован: 03.08.2004 (Вт) 16:19

Сообщение step » 08.01.2005 (Сб) 21:08

ПОДСКАЖИТЕ ПОЖАЛУЙСТА ПО ТОЧНЕЕ

tyomitch
Пользователь #1352
Пользователь #1352
Аватара пользователя
 
Сообщения: 12822
Зарегистрирован: 20.10.2002 (Вс) 17:02
Откуда: חיפה

Сообщение tyomitch » 08.01.2005 (Сб) 23:36

На форме: Text1 с MultiLine = True
Код: Выделить всё
Option Explicit

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 WM_VSCROLL = &H115
Private Const SB_PAGEDOWN = 3

Private Sub Form_DblClick()
SendMessage Text1.hwnd, WM_VSCROLL, SB_PAGEDOWN, 0
End Sub

Private Sub Form_Load()
Text1.Text = _
"The quick brown fox jumps over a lazy dog" & vbCrLf & _
"Pack my box with five dozen liquor jugs" & vbCrLf & _
"Jackdaws love my big sphinx of quartz" & vbCrLf & _
"The five boxing wizards jump quickly" & vbCrLf & _
"Sphinx of black quartz, judge my vow" & vbCrLf & _
"Quick zephyrs blow, vexing daft Jim" & vbCrLf & _
"How quickly daft jumping zebras vex" & vbCrLf & _
"The quick brown fox jumps over a lazy dog" & vbCrLf & _
"Pack my box with five dozen liquor jugs" & vbCrLf & _
"Jackdaws love my big sphinx of quartz" & vbCrLf & _
"The five boxing wizards jump quickly" & vbCrLf & _
"Sphinx of black quartz, judge my vow" & vbCrLf & _
"Quick zephyrs blow, vexing daft Jim" & vbCrLf & _
"How quickly daft jumping zebras vex" & vbCrLf & _
"The quick brown fox jumps over a lazy dog" & vbCrLf & _
"Pack my box with five dozen liquor jugs" & vbCrLf & _
"Jackdaws love my big sphinx of quartz" & vbCrLf & _
"The five boxing wizards jump quickly" & vbCrLf & _
"Sphinx of black quartz, judge my vow" & vbCrLf & _
"Quick zephyrs blow, vexing daft Jim" & vbCrLf & _
"How quickly daft jumping zebras vex"
End Sub
Изображение

A.A.Z.
Член-корреспондент академии VBStreets
Член-корреспондент академии VBStreets
 
Сообщения: 3035
Зарегистрирован: 30.06.2003 (Пн) 13:38

Сообщение A.A.Z. » 08.01.2005 (Сб) 23:39

SendMessage TextBox.hWnd, WM_VSCROLL, <Куда>, ByVal 0&
MSDN писал(а):WM_VSCROLL
The WM_VSCROLL message is sent to a window when a scroll event occurs in the window's standard vertical scroll bar. This message is also sent to the owner of a vertical scroll bar control when a scroll event occurs in the control.

WM_VSCROLL
nScrollCode = (int) LOWORD(wParam); // scroll bar value
nPos = (short int) HIWORD(wParam); // scroll box position
hwndScrollBar = (HWND) lParam; // handle to scroll bar

Parameters
nScrollCode
Value of the low-order word of wParam. Specifies a scroll bar value that indicates the user's scrolling request. This parameter can be one of the following values: Value Meaning
SB_BOTTOM Scrolls to the lower right.
SB_ENDSCROLL Ends scroll.
SB_LINEDOWN Scrolls one line down.
SB_LINEUP Scrolls one line up.
SB_PAGEDOWN Scrolls one page down.
SB_PAGEUP Scrolls one page up.
SB_THUMBPOSITION The user has dragged the scroll box (thumb) and released the mouse button. The nPos parameter indicates the position of the scroll box at the end of the drag operation.
SB_THUMBTRACK The user is dragging the scroll box. This message is sent repeatedly until the user releases the mouse button. The nPos parameter indicates the position that the scroll box has been dragged to.
SB_TOP Scrolls to the upper left.


nPos
Value of the high-order word of wParam. Specifies the current position of the scroll box if the nScrollCode parameter is SB_THUMBPOSITION or SB_THUMBTRACK; otherwise, nPos is not used.
hwndScrollBar
Value of lParam. If the message is sent by a scroll bar, then hwndScrollBar is the handle to the scroll bar control. If the message is not sent by a scroll bar, hwndScrollBar is NULL.
Return Value
If an application processes this message, it should return zero.
Все, что тебе понадобится:
Код: Выделить всё
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByRef lParam As Any) As Long
Private Const WM_VSCROLL As Long = &H115
Private Const SB_BOTTOM As Long = 7
Private Const SB_ENDSCROLL As Long = 8
Private Const SB_LINEDOWN As Long = 1
Private Const SB_LINELEFT As Long = 0
Private Const SB_LINERIGHT As Long = 1
Private Const SB_LINEUP As Long = 0
Private Const SB_PAGEDOWN As Long = 3
Private Const SB_PAGELEFT As Long = 2
Private Const SB_PAGERIGHT As Long = 3
Private Const SB_PAGEUP As Long = 2
Private Const SB_THUMBPOSITION As Long = 4
Private Const SB_THUMBTRACK As Long = 5
Private Const SB_TOP As Long = 6
Private Const SB_VERT As Long = 1
Private Const SB_HORZ As Long = 0


Вернуться в Visual Basic 1–6

Кто сейчас на конференции

Сейчас этот форум просматривают: Yandex-бот и гости: 6

    TopList