状态栏颜色的问题
请教各位高手,如何设置状态栏的某个Panel的颜色啊?
我将状态栏分为几个Panel,第一个显示一些系统消息,根据消息的类别(消息、警告、错误)希望能改变这个Panel的背景颜色来达到醒目的目的,不知道如何实现,请各位高手赐教,谢谢!
[解决办法]
这好象要自画了,从没试过,不知道行不行
[解决办法]
我简单实现了一下
lz可以动手搞得更漂亮一点
.h文件
//---------------------------------------
#ifndef Unit1H
#define Unit1H
//---------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ComCtrls.hpp>
//---------------------------------------
class TForm1 : public TForm
{
__published:// IDE-managed Components
TStatusBar *StatusBar1;
private:// User declarations
public:// User declarations
__fastcall TForm1(TComponent* Owner);
void __fastcall NewWndProc(TMessage& Message);
};
//---------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------
#endif
.cpp文件
//---------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h "
//---------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm "
TForm1 *Form1;
TWndMethod OldWndProc;
//---------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
OldWndProc = StatusBar1-> WindowProc;
StatusBar1-> WindowProc = NewWndProc;
}
//---------------------------------------
void __fastcall TForm1::NewWndProc(TMessage& Message)
{
OldWndProc(Message);
if (Message.Msg == WM_PAINT)
{
TControlCanvas *cvs = new TControlCanvas();
cvs-> Control = StatusBar1;
cvs-> Brush-> Color=TColor(RGB(255,0,0));
TRect rect;
rect=ClientRect;
rect.Right=ClientRect.Right/14;
cvs-> FillRect(rect);
delete cvs;
}
}
[解决办法]
正解!