CT000
Anmeldungsdatum: 24.04.2008 Beiträge: 3
|
Verfasst am: 28.04.2008, 18:04 Titel: Wie erstelle ich einen Scrooltext in einem Dialog |
|
|
Hi ich hab da noch mal eine Frage wie erstelle ich einen Scrolltext in der Wingui?
Im normalen fall ist es ja nicht schwer einfach eine Variable + 1 in einer schleife nehmen und da die var als x oder y axe setzen und wenn der rand erreicht ist einfach mit if abfragen und dann an den anderen rand hinsetzen lassen.
Aber wo baue ich oder besser gesagt wie baue ich dieses in die Wingui in einem Dialog ein? Vielleicht kann mir jemand helfen hier ist mein bisheriger code der ein Dialog fenster öffnet mit einem Text drin. Dieses Text würde ich gerade von rechts nach links Scrollen lassen.
Code: | #INCLUDE "WINDOWS.BI"
FUNCTION ProcessWindow (BYVAL hDlg AS HWND, BYVAL wMsg AS Uint, BYVAL wParam _
AS WPARAM, BYVAL lParam AS LPARAM) AS LRESULT
STATIC hStBrush1 AS HBRUSH
DIM wmID AS INTEGER, wmEvent AS INTEGER
DIM ps AS PAINTSTRUCT
DIM BrushClr AS LONG
DIM hDC AS HDC, hBrush AS HBRUSH, hPen AS HPEN
DIM StBgColor1 AS INTEGER, StFgColor1 AS INTEGER
DIM Lt1 AS STRING
STbgColor1 = &H000000
STfgColor1 = &H0000FF
SELECT CASE wMSG
CASE WM_CREATE
hSTbrush1 = CreateSolidBrush(STbgColor1)
Lt1=Lt1 + "Scrolltext"
CreateWindowEx(0, "static", STRPTR( LT1 ), _
WS_CHILD OR WS_VISIBLE, _
120, 19, 100, 19, _
hdlg, Cast(Hmenu, 1002), GetModuleHandle(null), NULL)
SetWindowPos hDlg, HWND_TOP, 0, 0, 0, 0, SWP_NoSize OR SWP_NoMove
CASE WM_CTLCOLORSTATIC
IF GetDlgCtrlId(CAST(HWND,lParam)) = 1002 THEN
SetTextColor Cast(hDC,Wparam), STfgColor1
SetBkColor Cast(hDC,Wparam), STbgColor1 '
Return Cast(Integer,hStbrush1)
END IF
CASE WM_DESTROY
DeleteObject hStBrush1
CASE WM_PAINT
BeginPaint hDlg, @ps
BrushClr = &H000000
hPen = CreatePen(0, 1, BrushClr)
hPen = SelectObject(ps.hDC, hPen)
hBrush = CreateSolidBrush(BrushClr)
hBrush = SelectObject(ps.hDC, hBrush)
Rectangle ps.hDC, 0, 0, 411, 65
DeleteObject SelectObject(hDC, hPen)
DeleteObject SelectObject(hDC, hBrush)
EndPaint hDlg, @ps
CASE WM_CLOSE
PostQuitMessage 0
END SELECT
ProcessWindow = DefWindowProc(hdlg, wMsg, wParam, lParam)
END FUNCTION
'---------------------------------------------------------------
' Starting Main
'---------------------------------------------------------------
DIM wMsg AS Msg
DIM wcls AS wndclass
DIM hWnd AS HWND, hMenu AS HMENU
DIM szpgmname AS STRING, style as INTEGER
szpgmname = "Scrolltext"
WITH wcls
.style = CS_HREDRAW OR CS_VREDRAW
.lpfnWndProc = @ProcessWindow
.cbClsExtra = 0
.cbWndExtra = 0
.hInstance = GetModuleHandle(NULL)
.hIcon = LoadIcon( null, IDI_APPLICATION )
.hCursor = LoadCursor( NULL, IDC_ARROW )
.hbrBackground = CAST( hbrush, COLOR_3DFACE + 1)
.lpszMenuName = NULL
.lpszClassName = Sadd(szpgmname)
END WITH
RegisterClass @wcls
style = WS_VISIBLE OR WS_OVERLAPPEDWINDOW OR WS_CLIPCHILDREN
CreateWindowEx(0, szpgmname, "Scrolltext", _
Style, 90, 76, 300, 89, _
HWND_DESKTOP, hMenu, GetModuleHandle(null), NULL)
ShowWindow(hWnd, SW_SHOWNORMAL)
UpdateWindow hWnd
While (GetMessage(@wMsg, NULL, 0, 0) <> false )
If IsDialogMessage(hWnd, @wMsg) = FALSE Then 'For TabKey, Comment out if using WM_KEYDOWN
TranslateMessage @wMsg
DispatchMessage @wMsg
End If 'For TabKey, Comment out if using WM_KEYDOWN
WEND
|
|
|