Implement STATUSBAR's FLAT style

xiaoxiao2021-03-06  66

See the right figure, OfficExp is such a style, in fact, it is very simple, do not have to find someone to control online.

Set the STATUSBAR's SimplePanel to false, click on PANELS to add StatusPanel, set all the StatusPanel's bevel to PBNONE, Style is set to PSOWNERDRAW because we have to draw a FLAT style. Here is the onDrawPanel event code of Stutasbar:

Procedure tform1.statusbar1drawpanel (statusbar: tstatusbar)

Panel: tstatuspanel;

Const Rect: TRECT);

VAR

UALIGN: UINT;

R: TRECT;

Begin

Case Panel.Alignment

Of

Taleftjustify

: UALIGN: = DT_LEFT;

Tacenter

: ualign: = dt_center;

Tarightjustify

: uALIGN: = DT_Right;

End; ualign: = ualign

OR DT_VCENTER;

With statusbar.canvas

DO

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; On the interface of the image, the first STATUSPANEL should be automatically resized, so you have to deal with the StatusBar.onResize event, the code is as follows:

Procedure TFORM1.STATUSBAR1RESIZE (Sender: TOBJECT);

VAR

I, W:

Integer;

Begin

W: = statusbar1.width;

For i: = 1

To Statusbar1.Panels.count-1

DO

W: = W - statusbar1.panels [i] .width;

Statusbar1.panels [0] .width: = W;

End; the effect is not bad

// The article comes from:

http://blog.9cbs.net/nhconch

Please contact the author to contact the author, indicate the author's information, reserve the author information, thank you for your support!

转载请注明原文地址:https://www.9cbs.com/read-110775.html

New Post(0)