Viktor1703
AutoIT Гуру
- Сообщения
- 1,535
- Репутация
- 413
Что - то ни как не могу понять как организовать многозакладочность, контрол Scintilla не подчиняется Tab'ам и накладывается поверх
Архив: SciLexer
Код:
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPIEx.au3>
#include <GuiTab.au3>
$hForm = GUICreate('Test', 600, 450, -1, -1, BitOR($WS_SIZEBOX, $WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN))
$iFile = GUICtrlCreateMenu('Файл')
GUICtrlCreateMenuItem('Новый', $iFile)
GUICtrlCreateMenuItem('Открыть', $iFile)
GUICtrlCreateMenuItem('Сохранить', $iFile)
GUICtrlCreateMenuItem('Сохранить как...', $iFile)
GUICtrlCreateMenuItem('', $iFile)
GUICtrlCreateMenuItem('Выход', $iFile)
GUICtrlCreateMenu('Правка')
$hEdit = SCIControl($hForm, @ScriptDir & '\SciLexer.dll')
SciSetBkColor($hEdit, 0xF0F4F9)
SciSetMarginWidth($hEdit, 35, 0x000000, 0xC0C0C0)
SciSetMarkerPanel($hEdit, 15)
SciSetActiveLineColor($hEdit, 0xFFFED8)
GUIRegisterMsg($WM_GETMINMAXINFO, 'WM_GETMINMAXINFO')
GUIRegisterMsg($WM_SIZING, 'WM_SIZING')
GUIRegisterMsg($WM_SIZE, 'WM_SIZE')
GUISetState(@SW_SHOW, $hForm)
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
Wend
Func WM_SIZING($hWnd, $iMsg, $wParam, $lParam)
Switch $hWnd
Case $hForm
Local $iPos = _WinAPI_GetPosFromRect(DllStructCreate($tagRECT, $lParam))
WinMove($hEdit, '', 0, 0, $iPos[2] - 7, $iPos[3] - 53)
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc
Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam)
Switch $hWnd
Case $hForm
Local $iPos = WinGetPos($hWnd)
WinMove($hEdit, '', 0, 0, $iPos[2] - 7, $iPos[3] - 53)
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc
Func WM_GETMINMAXINFO($hWnd, $iMsg, $wParam, $lParam)
Switch $hWnd
Case $hForm
Local $tMMI = DllStructCreate('long Reserved[2];long MaxSize[2];long MaxPosition[2];long MinTrackSize[2];long MaxTrackSize[2]', $lParam)
DllStructSetData($tMMI, 'MinTrackSize', 500, 1)
DllStructSetData($tMMI, 'MinTrackSize', 400, 2)
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc
Func SCIControl($hWnd, $sSciLexerDll)
Local $hModule = _WinAPI_LoadLibraryEx($sSciLexerDll)
Local $iPos = WinGetPos($hWnd)
Local $hSci = _WinAPI_CreateWindowEx($WS_EX_CLIENTEDGE, 'Scintilla', 'SciControl', BitOR($WS_CHILD, $WS_VISIBLE), _
0, 0, $iPos[2], $iPos[3], $hWnd, 0, _WinAPI_GetModuleHandle(0), 0)
If ((@error) Or (Not IsHWnd($hSci))) Then
Return SetError(1, 0, -1)
EndIf
Return $hSci
EndFunc
Func SciSetBkColor($hWnd, $iColor)
_SendMessage($hWnd, 2052, 32, _WinAPI_SwitchColor($iColor))
_SendMessage($hWnd, 2050, 0, 0)
EndFunc
Func SciSetMarginWidth($hWnd, $iMargin, $iColorNumber, $iColor)
_SendMessage($hWnd, 2242, 0, $iMargin)
_SendMessage($hWnd, 2052, 33, _WinAPI_SwitchColor($iColor))
_SendMessage($hWnd, 2051, 33, _WinAPI_SwitchColor($iColorNumber))
EndFunc
Func SciSetMarkerPanel($hWnd, $iMargin)
_SendMessage($hWnd, 2244, 2, 0xFE000000)
_SendMessage($hWnd, 2242, 2, $iMargin)
_SendMessage($hWnd, 2246, 2, True)
EndFunc
Func SciSetActiveLineColor($hWnd, $iColor)
_SendMessage($hWnd, 2098, _WinAPI_SwitchColor($iColor), 0)
_SendMessage($hWnd, 2096, 1, 0)
EndFunc
Архив: SciLexer