資源簡介
vc中制作浮動窗口的一個很好的參考,包含CsizingControlBar的源代碼以及使用說明

代碼片段和文件信息
//?sizecbar.cpp?:?implementation?file
//
#include?“stdafx.h“
#ifdef?_DEBUG
#define?new?DEBUG_NEW
#undef?THIS_FILE
static?char?THIS_FILE[]?=?__FILE__;
#endif
int?CALLBACK?EnumFontFamProc(ENUMLOGFONT?FAR?*lpelf
?????????????????????????????NEWTEXTMETRIC?FAR?*lpntm
?????????????????????????????int?FontType
?????????????????????????????LPARAM?lParam)
{
????UNUSED_ALWAYS(lpelf);
????UNUSED_ALWAYS(lpntm);
????UNUSED_ALWAYS(FontType);
????UNUSED_ALWAYS(lParam);
????return?0;
}
/////////////////////////////////////////////////////////////////////////
//?CCoolBar
IMPLEMENT_DYNAMIC(CCoolBar?baseCCoolBar);
CCoolBar::CCoolBar()
{
m_hNotifyWnd?=?NULL;
????m_cyGripper?=?12;
SetSCBstyle(GetSCBstyle()?| SCBS_SIZECHILD);
????m_bActive?=?FALSE;
????CDC?dc;
????dc.CreateCompatibleDC(NULL);
????m_sFontFace?=?(::EnumFontFamilies(dc.m_hDC
????????_T(“宋體“)?(FONTENUMPROC)?EnumFontFamProc?0)?==?0)??
????????_T(“宋體“)?:?_T(“Tahoma“);
????dc.DeleteDC();
}
CCoolBar::~CCoolBar()
{
}
BEGIN_MESSAGE_MAP(CCoolBar?baseCCoolBar)
????//{{AFX_MSG_MAP(CCoolBar)
????ON_WM_NCLBUTTONUP()
????ON_WM_NCHITTEST()
????//}}AFX_MSG_MAP
????ON_MESSAGE(WM_SETTEXT?OnSetText)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////
//?CCoolBar?message?handlers
BOOL?CCoolBar::Create(LPCTSTR?lpszWindowName?CWnd*?pParentWnd
???????????????????????????????CSize?sizeDefault?BOOL?bHasGripper
???????????????????????????????UINT?nID?DWORD?dwstyle)
{
ASSERT_VALID(pParentWnd);
m_hNotifyWnd?=?pParentWnd->m_hWnd;
????return?baseCCoolBar::Create(lpszWindowName?pParentWnd?sizeDefault?bHasGripper?nID?dwstyle);
}
BOOL?CCoolBar::Create(LPCTSTR?lpszWindowName
???????????????????????????????CWnd*?pParentWnd?UINT?nID
???????????????????????????????DWORD?dwstyle)
{
ASSERT_VALID(pParentWnd);
m_hNotifyWnd?=?pParentWnd->m_hWnd;
return?baseCCoolBar::Create(lpszWindowName?pParentWnd?nID?dwstyle);
}
/////////////////////////////////////////////////////////////////////////
//?Mouse?Handling
//
void?CCoolBar::OnNcLButtonUp(UINT?nHitTest?CPoint?point)
{
????if?(nHitTest?==?HTCLOSE)
????????m_pDockSite->ShowControlBar(this?FALSE?FALSE);?//?hide
????baseCCoolBar::OnNcLButtonUp(nHitTest?point);
}
void?CCoolBar::OnLButtonDblClk(UINT?nFlags?CPoint?point)
{
CSizingControlBar::OnLButtonDblClk(nFlagspoint);
}
#ifndef?COLOR_GRADIENTACTIVECAPTION
#define?COLOR_GRADIENTACTIVECAPTION?????27
#define?COLOR_GRADIENTINACTIVECAPTION???28
#define?SPI_GETGRADIENTCAPTIONS?????????0x1008
#endif
void?CCoolBar::NcCalcClient(LPRECT?pRc?UINT?nDockBarID)
{
????CRect?rcBar(pRc);?//?save?the?bar?rect
????//?subtract?edges
????baseCCoolBar::NcCalcClient(pRc?nDockBarID);
????if?(!HasGripper())
????????return;
????CRect?rc(pRc);?//?the?client?rect?as?calculated?by?the?base?class
????BOOL?bHorz?=?(nDockBarID?==?AFX_IDW_DOCKBAR_TOP)?||
??????????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????324398??2011-06-16?10:06??CSizingControlBar\浮動窗口的制作暨CSizingControlBar類的使用說明?-?xuexiuyin的專欄?-?CSDN博客.mht
?????文件???????2426??2009-07-29?09:43??CSizingControlBar\class\scbarg.h
?????文件??????42076??2001-09-03?23:44??CSizingControlBar\class\sizecbar.cpp
?????文件???????6404??2011-06-16?09:34??CSizingControlBar\class\sizecbar.h
?????文件??????11718??2009-07-29?09:43??CSizingControlBar\class\scbarg.cpp
?????目錄??????????0??2011-06-16?10:07??CSizingControlBar\class
?????目錄??????????0??2011-06-16?10:06??CSizingControlBar
-----------?---------??----------?-----??----
???????????????387022????????????????????7
評論
共有 條評論