Question

I have a TStatusbar with 4 panels and one of them set in OwnerDraw style.

In the onDrawPanel() event handler, I would like the TStatusbar to use the default paint method before I add some custom drawing on top of it.

Is there a way I can call the default handler from my onDrawPanel handler?

EDIT Well, I did found a fix, but I'm not sure how reliable it is if the system font change. Since the default handler only draws the panel text, a simple call to TextRect will do the same trick.

StatusBar->Canvas->TextRect(Rect,Rect.Left,Rect.Top,Panel->Text);

But, I'm not sure how well this will work if the system font, language etc. isn't the default.

I would still like to get an answer to the original question.

Was it helpful?

Solution

TStatusBar is a wrapper for standard WinApi window class, so by default the painting is done by OS. You should look into WinApi functions, or messages like SB_SETTEXT

Check this on MSDN: SB_SETTEXT message

EDIT:

It seems DrawStatusText is the right WinApi function. SBT_NOBORDERS flag shall be specified if borders are not required.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top