掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
背景を変えるには? (ID:34987)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
これだっ! http://delphi.about.com/od/vclusing/a/statusbar_owner.htm ----------------------------------------------------------- 1. Drop a TStatusBar (name: "StatusBar1") on a Delphi form. 2. Drop a TImageList (name: "ImageList1"). 3. Add 2 bitmap images to the image list 4. Add 3 Panels to the status bar 5. Use the code above to set owner drawing for the first two panels (in the form's OnCreate event) 6. Use the code below to apply custom drawing of the first to panels by adding graphics, applying different font and panel color. Do this inside the OnDrawPanel event of the StatusBar1. ----------------------------------------------------------- procedure TForm1.FormShow(Sender: TObject); begin StatusBar1.Panels[0].Style := psOwnerDraw; end; procedure TForm1.StatusBar1DrawPanel(StatusBar: TStatusBar; Panel: TStatusPanel; const Rect: TRect); begin with StatusBar1.Canvas do begin case Panel.Index of 0: //fist panel begin Brush.Color := clRed; Font.Color := clNavy; Font.Style := [fsBold]; end; 1: //second panel begin Brush.Color := clYellow; Font.Color := clTeal; Font.Style := [fsItalic]; end; end; //Panel background color FillRect(Rect) ; //Panel Text TextRect(Rect,2 + ImageList1.Width + Rect.Left, 2 + Rect.Top,Panel.Text) ; end; //draw graphics ImageList1.Draw(StatusBar1.Canvas, Rect.Left, Rect.Top, Panel.Index) ; end; //Change drawing style of StatusBar Panels procedure TForm1.FormCreate(Sender: TObject) ; begin StatusBar1.Panels[0].Style := psOwnerDraw; StatusBar1.Panels[1].Style := psOwnerDraw; end;
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.