Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Change Title Bar Color
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01495047
Message ID:
01495134
Views:
85
>>Hello All,
>>
>>How can I change a form's title bar color programmatically?
>>
>>Thanks,
>>
>>Bob
>
>
Public oform1
>
>oform1=Newobject("form1")
>oform1.Show
>Return
>Define Class form1 As Form
>	Top = 114
>	Left = 197
>	DoCreate = .T.
>	Caption = "Form1"
>	l = 6956042
>	Add Object command1 As CommandButton With ;
>		AutoSize = .T., ;
>		Top = 24, ;
>		Left = 96, ;
>		Height = 27, ;
>		Width = 208, ;
>		Caption = "Changer la couleur de la barre titre", ;
>		Name = "Command1"
>	Add Object command2 As CommandButton With ;
>		AutoSize = .T., ;
>		Top = 78, ;
>		Left = 110, ;
>		Height = 27, ;
>		Width = 181, ;
>		Caption = "Remettre la couleur original", ;
>		Name = "Command2"
>	Procedure changerlacouleurdelabarredetitre
>		Lparameters NewColor
>		#Define COLOR_ACTIVECAPTION 2
>		Local lRet
>		lRet = SetSysColors(1, COLOR_ACTIVECAPTION, NewColor)
>		ChangeTitleBarColor = lRet > 0
>	Endproc
>	Procedure trouverlacouleur
>		GetTitleBarColor1 = GetSysColor(COLOR_ACTIVECAPTION)
>		Return GetTitleBarColor1
>	Endproc
>	Procedure Load
>		Declare Integer GetSysColor In user32 Integer nIndex
>		Declare Integer SetSysColors In user32;
>			INTEGER nChanges,;
>			INTEGER @ lpSysColor,;
>			INTEGER @ lpColorValues
>
>	Endproc
>	Procedure command1.Click
>		Thisform.l = Thisform.trouverlacouleur()
>		Thisform.changerlacouleurdelabarredetitre(Rgb(255, 0, 0))
>	Endproc
>	Procedure command2.Click
>		Thisform.changerlacouleurdelabarredetitre(Thisform.l)
>	Endproc
>
>Enddefine
When I ran this program, the color of the command window changed to red. The form's title remained as is.

Now, how can I turn it back to what it was? It remains red.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform