Autor: Heinz Brill (---.dip0.t-ipconnect.de)
Datum: 21.04.19 08:56
Könntest du mal das unter den verschiedenen
WIN - Versionen ausprobieren ? :
$H Windows.ph
$H Messages.ph
Def GetSysColor(1) !"USER32","GetSysColor"
Def SetBkMode(2) !"GDI32","SetBkMode"
Def SelectObject(2) !"GDI32","SelectObject"
Def GetDC(1) !"USER32","GetDC"
Def @Show(1) @ShowWindow(@&(1), 1)
Def @Hide(1) @ShowWindow(@&(1), 0)
Declare Ende%, OldWndProc_1&, AktivesTab&
Declare Create_Text%[] , TextBk_1& , tabctrl1&
'-CallBack Routine----------------------------------------------------
Proc ColorText_TabCtrl
Parameters hWnd&, Message&, wParam&, lParam&
If Message& = ~WM_CTLCOLORSTATIC
~SetBkMode(wParam&, ~TRANSPARENT)
~SetTextColor(wParam&, GetSysColor(18))
Return TextBk_1&
Else
Return ~CallWindowProc(OldWndProc_1&, hWnd&, Message&, wParam&, lParam&)
EndIf
EndProc
Proc ColorText
Parameters hs&,x%,y%
Declare hdc&,Bk_Color&
SetText hs&," "
hdc&=GetDC(hs&)
SetWindowPos hs&=x%,y% - 0,0
SelectObject(hdc&,SendMessage(hs&,$031,0,0))
SetBKMode(hdc&,1)
StartPaint hdc&
Bk_Color& = @GetPixel(0,0)
EndPaint
Return Bk_Color&
EndProc
'-Main----------------------------------------------------------------
'-Erweitertes MessageHandling abschalten----------------------------
Set("FastMode", 1)
'-Fenster oeffnen---------------------------------------------------
Window 0, 0 - 640, 480
Cls ~GetSysColor(~COLOR_3DFACE)
'Create Text Hintergrundfarben für das TabCtrl ermitteln ---------------
tabctrl1& = Create("TabCtrl", %hwnd, "tab1", 8, 80, 328, 320)
OldWndProc_1& = ~GetWindowLong(tabctrl1&, ~GWL_WNDPROC)
~SetWindowLong(tabctrl1&, ~GWL_WNDPROC, @ProcAddr("ColorText_TabCtrl", 4))
InsertTab(tabctrl1&, 1, "tab2")
Create_Text%[0] = Create("Text", tabctrl1&, " ", 10, 40, 10, 10)
TextBk_1& = ~CreateSolidBrush(ColorText(Create_Text%[0],10,40))
'-Textfelder------------------------------------------------------
Create_Text%[0] = Create("Text", %Hwnd, "Text 1", 200, 10, 150, 16)
Create_Text%[1] = Create("Text", tabctrl1&, "auf dem TabCtrl 1 ", 100, 70, 200, 16)
Create_Text%[2] = Create("Text", tabctrl1&, "und auf dem TabCtrl 2", 100, 100, 200, 16)
@Hide(Create_Text%[2])
'-Dialog-Schleife---------------------------------------------------
Clear Ende%
WhileNot Ende%
WaitInput
If %Key = 2
Ende% = 1
Elseif Clicked(tabctrl1&) = 1
AktivesTab& = @GetActiveTab(tabctrl1&)
If AktivesTab& = 0
@Hide(Create_Text%[2])
@Show(Create_Text%[1])
Elseif AktivesTab& = 1
@Hide(Create_Text%[1])
@Show(Create_Text%[2])
Endif
EndIf
EndWhile
~DeleteObject(TextBk_1&)
'-Urspruengliche ProgramMainRoutine wieder herstellen---------------
~SetWindowLong(tabctrl1&, ~GWL_WNDPROC, OldWndProc_1&)
'-End-------------------------------------------------------------------
End
Hatte ich noch in einem Forum gefunden. Behandelt ja genau dein
Problem.
Könnte man dann auch auf XProfans SubClassing umstellen.
H.Brill
XProfan X4 + FreeProfan
Nachricht bearbeitet (21.04.19 08:57)
|
|