Most of the time, a panel is made to display text. To control this, the TStatusPanel is equipped with a property named Style, which is of type TStatusPanelStyle: __property Comctrls::TStatusPanelStyle Style = {read=FStyle,write=SetStyle}; The TStatusPanelStyle enumeration is defined as follows: enum TStatusPanelStyle { psText, psOwnerDraw }; To prepare a panel to display text, set its Style property to psText, which is the default. To let you specify the text of a panel, the TStatusPanel class is equipped with a property named Text: __property System::UnicodeString Text = {read=FText,write=SetText}; To visually specify the text of a panel, select it in the Editing Panels window. In the Object Inspector, click Text and type the desired string. To programmatically specify the text of a panel, if you had created the panel by declaring a TStatusPanel variabe, assign a string to its Text property. Here is an example: //---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
TStatusBar * sbStandard = new TStatusBar(this);
sbStandard->Parent = this;
TStatusPanel * pnlFirst = new TStatusPanel(sbStandard->Panels);
TStatusPanel * pnlSecond = new TStatusPanel(sbStandard->Panels);
TStatusPanel * pnlThird = new TStatusPanel(sbStandard->Panels);
pnlThird->Text = L"Coordinates";
}
//---------------------------------------------------------------------------
If you don't have or don't want to use the panel's reference, you can access it by its index and assign the string to it. Here is an example: //---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
TStatusBar * sbStandard = new TStatusBar(this);
sbStandard->Parent = this;
sbStandard->Panels->AddItem(new TStatusPanel(sbStandard->Panels), 0);
sbStandard->Panels->AddItem(new TStatusPanel(sbStandard->Panels), 1);
sbStandard->Panels->AddItem(new TStatusPanel(sbStandard->Panels), 2);
sbStandard->Panels[0][0]->Text = L"Ready";
}
//---------------------------------------------------------------------------
After specifying the text of a panel, you can decide how to align it, to the left (the default), the center, or the right side. This characteristic is controlled by the Alignment property; __property Classes::TAlignment Alignment = {read=FAlignment,write=SetAlignment};
The size of a panel mostly represents its width, which represents its length from the left to the right sides. The width of a panel depends on two factors: the total size of the status bar and the available or remaining size if/after other panels have been created. To visually specify the width of a panel, access its Object Inspector, click Width, and type the desired value. To programmatically do this, assign an integer to the Width property of the TStatusPanel class.
You can make a panel appear raised, sunken, or flat. This characteristic is controlled by the Bevel property of the TStatusPanel class: __property Comctrls::TStatusPanelBevel Bevel = {read=FBevel,write=SetBevel}; The TStatusPanelBevel enumeration has the following members: enum TStatusPanelBevel{ pbNone, pbLowered, pbRaised };
|
|
|||||||||
|