📄 xpgroupbox.cpp
字号:
// Function: CXPGroupBox::ReconstructFont
//
// Description: Construct font
//
//
// Name Date Version Comments
// Jack Jin 2003-12-03 1.0 Origin
//////////////////////////////////////////////////////////////////////////
void CXPGroupBox::UpdateSurface()
{
CRect (rc);
GetWindowRect(rc);
RedrawWindow();
GetParent()->ScreenToClient(rc);
GetParent()->InvalidateRect(rc,TRUE);
GetParent()->UpdateWindow();
}
//////////////////////////////////////////////////////////////////////////
//
// Function: CXPGroupBox::SetXPGroupStyle
//
// Description: Set Groupbox style
//
// INPUTS: one of the XPGB_FRAME, XPGB_WINDOW
//
// RETURNS: Reference to 'this' object
//
//
// Name Date Version Comments
// Jack Jin 2003-12-03 1.0 Origin
//////////////////////////////////////////////////////////////////////////
CXPGroupBox& CXPGroupBox::SetXPGroupStyle(XPGroupBoxStyle eStyle)
{
m_nType = eStyle;
UpdateSurface();
return *this;
}
//////////////////////////////////////////////////////////////////////////
//
// Function: CXPGroupBox::SetFont
//
// Description: Sets font with LOGFONT structure
//
// INPUTS: LOGFONT structure
//
// RETURNS: Reference to 'this' object
//
//
// Name Date Version Comments
// Jack Jin 2003-12-03 1.0 Origin
//////////////////////////////////////////////////////////////////////////
CXPGroupBox& CXPGroupBox::SetFont(LOGFONT lf)
{
CopyMemory(&m_lf, &lf, sizeof(m_lf));
ReconstructFont();
UpdateSurface();
return *this;
}
//////////////////////////////////////////////////////////////////////////
//
// Function: CXPGroupBox::SetFontBold
//
// Description: Sets Font Style
//
// INPUTS: TRUE of FALSE
//
// RETURNS: Reference to 'this' object
//
//
// Name Date Version Comments
// Jack Jin 2003-12-03 1.0 Origin
//////////////////////////////////////////////////////////////////////////
CXPGroupBox& CXPGroupBox::SetFontBold(BOOL bBold)
{
m_lf.lfWeight = bBold ? FW_BOLD : FW_NORMAL;
ReconstructFont();
UpdateSurface();
return *this;
}
//////////////////////////////////////////////////////////////////////////
//
// Function: CXPGroupBox::SetFontName
//
// Description: Sets the fonts face name
//
// INPUTS: String containing font name
//
// RETURNS: Reference to 'this' object
//
//
// Name Date Version Comments
// Jack Jin 2003-12-03 1.0 Origin
//////////////////////////////////////////////////////////////////////////
CXPGroupBox& CXPGroupBox::SetFontName(const CString& strFont, BYTE byCharSet)
{
m_lf.lfCharSet = byCharSet;
_tcscpy(m_lf.lfFaceName,strFont);
ReconstructFont();
UpdateSurface();
return *this;
}
//////////////////////////////////////////////////////////////////////////
//
// Function: CXPGroupBox::SetFontUnderline
//
// Description: Sets font underline attribue
//
// INPUTS: True of false
//
// RETURNS: Reference to 'this' object
//
//
// Name Date Version Comments
// Jack Jin 2003-12-03 1.0 Origin
//////////////////////////////////////////////////////////////////////////
CXPGroupBox& CXPGroupBox::SetFontUnderline(BOOL bSet)
{
m_lf.lfUnderline = bSet;
ReconstructFont();
UpdateSurface();
return *this;
}
//////////////////////////////////////////////////////////////////////////
//
// Function: CXPGroupBox::SetFontItalic
//
// Description: Sets font italic attribue
//
// INPUTS: True of false
//
// RETURNS: Reference to 'this' object
//
//
// Name Date Version Comments
// Jack Jin 2003-12-03 1.0 Origin
//////////////////////////////////////////////////////////////////////////
CXPGroupBox& CXPGroupBox::SetFontItalic(BOOL bSet)
{
m_lf.lfItalic = bSet;
ReconstructFont();
UpdateSurface();
return *this;
}
//////////////////////////////////////////////////////////////////////////
//
// Function: CXPGroupBox::SetFontSize
//
// Description: Sets font size attribue
//
// INPUTS: True of false
//
// RETURNS: Reference to 'this' object
//
//
// Name Date Version Comments
// Jack Jin 2003-12-03 1.0 Origin
//////////////////////////////////////////////////////////////////////////
CXPGroupBox& CXPGroupBox::SetFontSize(int nSize)
{
CFont cf;
LOGFONT lf;
cf.CreatePointFont(nSize * 10, m_lf.lfFaceName);
cf.GetLogFont(&lf);
m_lf.lfHeight = lf.lfHeight;
m_lf.lfWidth = lf.lfWidth;
ReconstructFont();
UpdateSurface();
return *this;
}
//////////////////////////////////////////////////////////////////////////
//
// Function: CXPGroupBox::SetBorderColor
//
// Description: Set groupbox border Color
//
// INPUTS: COLORREF clrBorder
//
// RETURNS: Reference to 'this' object
//
//
// Name Date Version Comments
// Jack Jin 2003-12-03 1.0 Origin
//////////////////////////////////////////////////////////////////////////
CXPGroupBox& CXPGroupBox::SetBorderColor(COLORREF clrBorder)
{
m_clrBorder = clrBorder;
UpdateSurface();
return *this;
}
//////////////////////////////////////////////////////////////////////////
//
// Function: CXPGroupBox::SetCatptionTextColor
//
// Description: Set groupbox title color
//
// INPUTS: COLORREF clrText
//
// RETURNS: Reference to 'this' object
//
//
// Name Date Version Comments
// Jack Jin 2003-12-03 1.0 Origin
//////////////////////////////////////////////////////////////////////////
CXPGroupBox& CXPGroupBox::SetCatptionTextColor(COLORREF clrText )
{
m_clrTitleText = clrText;
UpdateSurface();
return *this;
}
//////////////////////////////////////////////////////////////////////////
//
// Function: CXPGroupBox::SetBackgroundColor
//
// Description: Set groupbox backgroup color when group style is XPGB_FRAME
//
// INPUTS: COLORREF clrBKClient
//
// RETURNS: Reference to 'this' object
//
//
// Name Date Version Comments
// Jack Jin 2003-12-03 1.0 Origin
//////////////////////////////////////////////////////////////////////////
CXPGroupBox& CXPGroupBox::SetBackgroundColor(COLORREF clrBKClient)
{
m_clrTitleBackground = clrBKClient;
m_clrClientBackground = clrBKClient;
UpdateSurface();
return *this;
}
//////////////////////////////////////////////////////////////////////////
//
// Function: CXPGroupBox::SetBackgroundColor
//
// Description: Set groupbox backgroup color when group style is XPGB_WINDOW
//
// INPUTS: COLORREF clrBKTilte, COLORREF clrBKClient
//
// RETURNS: Reference to 'this' object
//
//
// Name Date Version Comments
// Jack Jin 2003-12-03 1.0 Origin
//////////////////////////////////////////////////////////////////////////
CXPGroupBox& CXPGroupBox::SetBackgroundColor(COLORREF clrBKTilte, COLORREF clrBKClient)
{
m_clrTitleBackground = clrBKTilte;
m_clrClientBackground = clrBKClient;
UpdateSurface();
return *this;
}
//////////////////////////////////////////////////////////////////////////
//
// Function: CXPGroupBox::SetText
//
// Description: Set groupbox title
//
// INPUTS: Text to use
//
// RETURNS: Reference to 'this' object
//
//
// Name Date Version Comments
// Jack Jin 2003-12-03 1.0 Origin
//////////////////////////////////////////////////////////////////////////
CXPGroupBox& CXPGroupBox::SetText(LPCTSTR lpszText)
{
if(IsWindow(this->GetSafeHwnd()))
{
m_strTitle = lpszText;
m_strTitle = _T(" ") + m_strTitle + _T(" ");
UpdateSurface();
}
return *this;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -