See the picture on the right. officexp is like this. In fact, the implementation is very simple. You don't have to look for other controls on the Internet.
Set simplepanel of statusbar to false, click panels to add statuspanel, set bevel of all statusanel to pbnone, and style to psownerdraw because we need to draw the flat style by ourselves. The ondrawpanel Event code of stutasbar is as follows:
ProcedureTform1.statusbar1drawpanel (statusbar: tstatusbar;
Panel: tstatuspanel;ConstRect: trect );
VaR
Ualign: uint;
R: trect;
Begin
CasePanel. AlignmentOf
Taleftjustify:Ualign: = dt_left;
Tacenter:Ualign: = dt_center;
Tarightjustify:Ualign: = dt_right;
End;
Ualign: = ualignOrDt_vcenter;
WithStatusbar. CanvasDo Begin
Pen. Color: = $ e1e1e1;
Brush. Color: = statusbar. color;
Rectangle (rect );
Brush. Style: = bsclear;
R. Left: = rect. Left + 1;
R. Right: = rect. Right-1;
R. Top: = rect. Top + 1;
R. Bottom: = rect. Bottom-1;
Drawtext (statusbar. Canvas. Handle, pchar (panel. Text),-1, R, ualign );
End;
End;
In the interface on the right, the first statusanel should be automatically adjusted, so the statusbar. onresize event must be processed. The Code is as follows:
ProcedureTform1.statusbar1resize (Sender: tobject );
VaR
I, W:Integer;
Begin
W: = statusbar1.width;
ForI: = 1ToStatusbar1.panels. Count-1Do
W: = W-statusbar1.panels [I]. width;
Statusbar1.panels [0]. Width: = W;
End;
The effect is good.
// Article from: workshop!