Introduction
CGroup
is a CButton
-derived class. The group becomes a roll-up control with many features and options. Any controls confined within the group area will hide when the group is "closed" and show when it's "open". If more than one CGroup
object share the same parent window, they will attract themselves vertically (this option can be disabled). Furthermore, many aspects of the control are fully customizable (see the Methods section for more information).
Using CGroup
- Add the files Group.h and Group.cpp to your project, using Project / Add To Project / Files...
- Create a Group object in your dialog.
- Give it a unique ID (e.g.
IDC_GROUP1
).
- Put some controls in it (checkboxes, listbox, editbox, etc.). [Note: the controls must be COMPLETELY contained within the group].
- Create a member variable for the group you've created. (If the type
CGroup
is not available, leave CButton
).
- If member variable type is different from
CGroup
, go to the header file for the dialog where you created the group and replace the CButton
in front of your variable name by CGroup
.
- Don't forget to add
#include "group.h"
in the same file.
- You can now use any methods associated with the
CGroup
object you've created (see the demo project for more information). Group can be contained within other groups (Rev. - 23 August 2001).
Methods (public)
CGroup* GetGroupCtrl() { return this; }
void SetBarColor(COLORREF color) { m_barColor = color; Invalidate(); }
void SetTextColor(COLORREF color) { m_textColor = color; Invalidate(); }
void SetAttract(bool toggle = false) { m_attract = toggle; Invalidate(); }
void SetFold(bool toggle = true);
void SetBitmap(UINT bmpID,COLORREF mask = RGB(0,0,0),
bool resizeBar = false);
void SetAttraction(bool toggle = true)
{ m_IsAttracted = toggle; Invalidate(); }
void SetTextFont (LOGFONT lf);
void SetTextFont (CString face,int size = 12,
bool bold = true,bool italic = false,bool underline = false);
void SetBarHeight(int h);
void SetLastGroup(bool toggle = false) {m_last = toggle; Invalidate(); }
void SetLastCtrl(bool toggle = false)
{m_extendLastCtrl = toggle; Invalidate(); }
void DrawGroupBorder(bool toggle = true)
{ m_borders = toggle; Invalidate(); }
void DrawBarBorder(bool toggle = true)
{ m_barBorders = toggle; Invalidate(); }
Credits
The transparent bitmap class and functions have been written by Paul Reynolds.