Klasa CReBarCReBar Class
Pasek sterowania, który zawiera układ, trwałość i informacje o stanie dla formantów paska pomocniczego.A control bar that provides layout, persistence, and state information for rebar controls.
SkładniaSyntax
class CReBar : public CControlBar
Elementy członkowskieMembers
Metody publicznePublic Methods
NazwaName | OpisDescription |
---|---|
CReBar:: AddBarCReBar::AddBar | Dodaje bandę do paska pomocniczego.Adds a band to a rebar. |
CReBar:: CreateCReBar::Create | Tworzy formant paska pomocniczego i dołącza go do CReBar obiektu.Creates the rebar control and attaches it to the CReBar object. |
CReBar:: GetReBarCtrlCReBar::GetReBarCtrl | Zezwala na bezpośredni dostęp do podstawowej kontroli wspólnej.Allows direct access to the underlying common control. |
UwagiRemarks
Obiekt paska pomocniczego może zawierać różne okna podrzędne, zwykle inne kontrolki, takie jak pola edycji, paski narzędzi i pola listy.A rebar object can contain a variety of child windows, usually other controls, including edit boxes, toolbars, and list boxes. Obiekt paska pomocniczego może wyświetlać jego okna podrzędne przez określoną mapę bitową.A rebar object can display its child windows over a specified bitmap. Aplikacja może automatycznie zmienić rozmiar paska pomocniczego lub można ręcznie zmienić rozmiar paska pomocniczego, klikając lub przeciągając pasek uchwytu.Your application can automatically resize the rebar, or the user can manually resize the rebar by clicking or dragging its gripper bar.
Paska pomocniczego — formantRebar Control
Obiekt paska pomocniczego zachowuje się podobnie do obiektu Toolbar.A rebar object behaves similarly to a toolbar object. Paska pomocniczego używa mechanizmu klikania i przeciągania, aby zmienić rozmiar jego pasm.A rebar uses the click-and-drag mechanism to resize its bands. Kontrolka paska pomocniczego może zawierać co najmniej jedną grupę, a każdy z nich ma dowolną kombinację paska uchwytu, mapy bitowej, etykiety tekstowej i okna podrzędnego.A rebar control can contain one or more bands, with each band having any combination of a gripper bar, a bitmap, a text label, and a child window. Jednak pasma nie mogą zawierać więcej niż jednego okna podrzędnego.However, bands cannot contain more than one child window.
CReBar
używa klasy Korzystanie CReBarCtrl w celu zapewnienia jej implementacji.CReBar
uses the CReBarCtrl class to provide its implementation. Aby skorzystać z opcji dostosowania kontrolki, można uzyskać dostęp do formantu paska pomocniczego za pomocą GetReBarCtrl .You can access the rebar control through GetReBarCtrl to take advantage of the control's customization options. Aby uzyskać więcej informacji na temat kontrolek paska pomocniczego, zobacz CReBarCtrl
.For more information about rebar controls, see CReBarCtrl
. Aby uzyskać więcej informacji na temat używania formantów paska pomocniczego, zobacz using korzystanie CReBarCtrl.For more information about using rebar controls, see Using CReBarCtrl.
Przestroga
Obiekty sterowania paska pomocniczego i paska pomocniczego nie obsługują dokowania paska sterowania MFC.Rebar and rebar control objects do not support MFC control bar docking. Jeśli CRebar::EnableDocking
jest wywoływana, aplikacja zostanie zatwierdzona.If CRebar::EnableDocking
is called, your application will assert.
Hierarchia dziedziczeniaInheritance Hierarchy
CReBar
WymaganiaRequirements
Nagłówek: afxext. hHeader: afxext.h
CReBar:: AddBarCReBar::AddBar
Wywołaj tę funkcję elementu członkowskiego, aby dodać pasmo do paska pomocniczego.Call this member function to add a band to the rebar.
BOOL AddBar(
CWnd* pBar,
LPCTSTR pszText = NULL,
CBitmap* pbmp = NULL,
DWORD dwStyle = RBBS_GRIPPERALWAYS | RBBS_FIXEDBMP);
BOOL AddBar(
CWnd* pBar,
COLORREF clrFore,
COLORREF clrBack,
LPCTSTR pszText = NULL,
DWORD dwStyle = RBBS_GRIPPERALWAYS);
ParametryParameters
pBarpBar
Wskaźnik do CWnd
obiektu, który jest oknem podrzędnym, który ma zostać wstawiony do paska pomocniczego.A pointer to a CWnd
object that is the child window to be inserted into the rebar. Obiekt, do którego istnieje odwołanie, musi mieć WS_CHILD.The referenced object must have a WS_CHILD.
lpszTextlpszText
Wskaźnik do ciągu zawierającego tekst, który ma być wyświetlany w paska pomocniczego.A pointer to a string containing the text to appear on the rebar. Domyślnie wartość NULL.NULL by default. Tekst zawarty w lpszText nie jest częścią okna podrzędnego; jest on paska pomocniczego.The text contained in lpszText is not part of the child window; it is on the rebar itself.
PBMPpbmp
Wskaźnik do CBitmap
obiektu, który ma być wyświetlany w tle paska pomocniczego.A pointer to a CBitmap
object to be displayed on the rebar background. Domyślnie wartość NULL.NULL by default.
dwStyledwStyle
Element DWORD zawierający styl, który ma zostać zastosowany do paska pomocniczego.A DWORD containing the style to apply to the rebar. Zobacz fStyle
Opis funkcji w strukturze Win32 REBARBANDINFO , aby uzyskać pełną listę stylów pasma.See the fStyle
function description in the Win32 structure REBARBANDINFO for a complete list of band styles.
clrForeclrFore
Wartość COLORREF, która reprezentuje kolor pierwszego planu paska pomocniczego.A COLORREF value that represents the foreground color of the rebar.
clrBackclrBack
Wartość COLORREF, która reprezentuje kolor tła paska pomocniczego.A COLORREF value that represents the background color of the rebar.
Wartość zwracanaReturn Value
Niezerowe, jeśli pomyślne; w przeciwnym razie 0.Nonzero if successful; otherwise 0.
PrzykładExample
// Define a CRebar in your class definition,
// such as: CReBar m_wndReBar;
m_wndReBar.Create(this);
m_wndDlgBar.Create(this, IDD_DIALOGBAR, CBRS_ALIGN_TOP,
IDD_DIALOGBAR);
m_wndReBar.AddBar(&m_wndDlgBar);
CReBar:: CreateCReBar::Create
Wywołaj tę funkcję elementu członkowskiego, aby utworzyć paska pomocniczego.Call this member function to create a rebar.
virtual BOOL Create(
CWnd* pParentWnd,
DWORD dwCtrlStyle = RBS_BANDBORDERS,
DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_TOP,
UINT nID = AFX_IDW_REBAR);
ParametryParameters
pParentWndpParentWnd
Wskaźnik do CWnd
obiektu, którego okno systemu Windows jest elementem nadrzędnym paska stanu.Pointer to the CWnd
object whose Windows window is the parent of the status bar. Zwykle okno ramki.Normally your frame window.
dwCtrlStyledwCtrlStyle
Styl formantu paska pomocniczego.The rebar control style. Domyślnie RBS_BANDBORDERS, który wyświetla wąskie linie do oddzielania sąsiadujących pasm w obrębie formantu paska pomocniczego.By default, RBS_BANDBORDERS, which displays narrow lines to separate adjacent bands within the rebar control. Zobacz Style formantów paska pomocniczego w Windows SDK, aby wyświetlić listę stylów.See Rebar Control Styles in the Windows SDK for a list of styles.
dwStyledwStyle
Style okna paska pomocniczego.The rebar window styles.
nIDnID
Identyfikator okna podrzędnego paska pomocniczego.The rebar's child-window ID.
Wartość zwracanaReturn Value
Niezerowe, jeśli pomyślne; w przeciwnym razie 0.Nonzero if successful; otherwise 0.
PrzykładExample
Zobacz przykład dla CReBar:: AddBar.See the example for CReBar::AddBar.
CReBar:: GetReBarCtrlCReBar::GetReBarCtrl
Ta funkcja członkowska umożliwia bezpośredni dostęp do zasadniczej kontroli wspólnej.This member function allows direct access to the underlying common control.
CReBarCtrl& GetReBarCtrl() const;
Wartość zwracanaReturn Value
Odwołanie do obiektu Korzystanie CReBarCtrl .A reference to a CReBarCtrl object.
UwagiRemarks
Wywołaj tę funkcję elementu członkowskiego, aby skorzystać z funkcji wspólnego formantu paska pomocniczego systemu Windows w dostosowaniu paska pomocniczego.Call this member function to take advantage of the functionality of the Windows rebar common control in customizing your rebar. Po wywołaniu GetReBarCtrl
Funkcja zwraca obiekt Reference do CReBarCtrl
obiektu, aby można było użyć dowolnego zestawu funkcji Członkowskich.When you call GetReBarCtrl
, it returns a reference object to the CReBarCtrl
object so you can use either set of member functions.
Aby uzyskać więcej informacji na temat CReBarCtrl
dostosowywania paska pomocniczego, zobacz using korzystanie CReBarCtrl.For more information about using CReBarCtrl
to customize your rebar, see Using CReBarCtrl.
PrzykładExample
CReBarCtrl &refReBarCtrl = m_wndReBar.GetReBarCtrl();
UINT nBandCount = refReBarCtrl.GetBandCount();
CString msg;
msg.Format(_T("Band Count is: %u"), nBandCount);
AfxMessageBox(msg);
Zobacz takżeSee also
Przykład MFCIE MFCMFC Sample MFCIE
Klasa CControlBarCControlBar Class
Wykres hierarchiiHierarchy Chart