Hi Everybody,
How can I change just the window title bar to a different color?
Jeff Barnes
(FWH 16.11, xHarbour 1.2.3, Bcc730)
Hi Everybody,
How can I change just the window title bar to a different color?
You can't, as far as I know.
EMG
Yes you can change the color of the Window/Dialog Title bar.
But you can't do it in FWH.
You can change it in the properties of your screen by right clicking on the desktop and chosing "properties".
Good luck.[/img]
Regards,
Michel D.
Genk (Belgium)
I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773
Yes, you can't change color title programmatically, as far as I know. Try using a label or any other control as color indicator.
EMG

// Create a Bitmap on top of the Dialog. Use a little Bitmap ( Blanc )
// as container. The Dialog should be just a frame.
// The Bitmap ( Blanc 20 x 20 ) will be resized and filled with the
// defined Brush / Gradient / Color :
REDEFINE BITMAP oBmp1 ID 100 ADJUST RESOURCE "Blanc" OF oDlg
oBMP1:bPainted := { |hDC|OnPaint( hDC,oBMP1, 128,15779475, 77215, ;
"Horizontal Dialog Title", ;
oBfont1, 0 ,"TEST.BMP" ,3 ) }
//--------------- Paint the Dialog-Title --------------------------------//
FUNCTION ONPAINT(hDC,oBmp,nVColor, nBColor,nColor,cText, ;
oBFont1, nLEFT, cBRUSH, nPEN )
LOCAL hOldFont, oNewbrush, hBitmap, aRect, oBmp1, nTOP
hOldFont := SelectObject( hDC, oBFont1:hFont )
nTOP := 5
nTXTLG := GettextWidth( hDC, cText )
nBMPLONG := oBmp:Super:nWidth()
nBMPHIGHT := oBmp:Super:nHeight()
nFONTHIGHT := oBfont1:nInpHeight * -1
nLEFT := (nBMPLONG - nTXTLG) / 2
nNEWHIGHT := nFONTHIGHT
nTOP := (nBMPHIGHT - nNEWHIGHT) / 2
aRect := GETCLIENTRECT( oBmp:hWnd )
nGRADIENT := Gradient( hDC, aRect, nVColor, nBColor, .T. ) // .T. Horizontal
oBmp:oBrush := TBrush():New( , nGRADIENT )
SetTextColor( hDC,nColor)
SetBkMode( oBmp:hDC, 0 )
FillRect( hDC, aRect, oBmp:oBrush:hBrush )
TextOut( hDC, nTOP, nLEFT, cText )
SelectObject( hDC, hOldFont )
IF nPEN > 0
DRAWBOX( aRect, hDC, nColor, nBMPLONG, nBMPHIGHT, nPEN )
ENDIF
RETURN NIL
// -------- DRAW BOX --------------------------------
STATIC FUNCTION DRAWBOX( aRect, hDC, nColor, nBMPLONG, nBMPHIGHT, nPEN )
LOCAL hPen := CREATEPEN( PS_SOLID, nPEN, nColor )
LOCAL hOldPen := SELECTOBJECT( hDC, hPen )
MOVETO( hDC, 0, 0 )
LINETO( hDC, nBMPLONG, 0 )
LINETO( hDC, nBMPLONG, nBMPHIGHT )
LINETO( hDC, 0, nBMPHIGHT )
LINETO( hDC, 0, 0 )
SELECTOBJECT( hDC, hOldPen )
DELETEOBJECT( hPen )
RETURN NIL
Uwe:
This is great, could you please, put the code here in some place to
download?
Best regards
Ruben Fernandez.
(Sorry for my bad English)
Hello Ruben,
A complete Source ( exe, resource, RMK ... )
with many new parameters, i put tomorrow in the forum.
nColor1 :=128 // 1. Gradient-Color
nColor2 := 15779475 // 2. Gradient-Color
nColort := 16777215 // Text-Color
lGrad := .T. // Gradient or MONO-Color
cText := "Horizontal Dialog Title" // Text
nTop := 10 // Top Text-Pos. 0 = Center Vertical
nLeft := 0 // Left Text-Pos. 0 = Center Horizontal
nPen := 0 // Pen-Weight for Frame 0 = no Frame
nPColor := 16777215 // Frame-Color
cBrush := "" // Title BMP-Brush
Regards
Uwe ![]()

Jeff,
>I want to give the user a visual notification when they have changed a certain setting.
May I suggest highlighting the setting that was changed instead. This would give more specific information--coloring the titlebar would only show that something was changed but not what.
Also, even if you could change the titlebar color, I would be worried that different themes might override this.
Regards,
James
Hello James,
It is not only the color. you can change the text, position, drawing
frames around the title and so on at runtime in combination to any action.
Regards
Uwe ![]()
Uwe,
>It is not only the color. you can change the text, position, drawing
frames around the title and so on at runtime in combination to any action.
OK, but for Jeff's application, as I stated I think it would be better to highlight the particular setting that has been changed.
Regards,
James

// Changing Title with GET
// ---------------------------------
REDEFINE GET oText1 VAR cText1 ID 120
oText1:bChange := {|| (nColor1 :=15779475, ;
nColor2 := 128, nColort := 0, ;
cText := "You changed the Get-Field : Customer", ;
lGrad := .F., nTop := 12, nLeft := 20, ;
nPen := 0, nPColor := 0, cBrush := "", ;
oBMP1:Refresh() ) }
// Could also be instead of a Text-Message a Database-Field :
// cText := (1)->PAT_NAME, ;Only to note that Uwe's titlebar is not the real titlebar and it will not follow current Windows theme. Or am I wrong?
EMG