- 积分
- 473
- 明经币
- 个
- 注册时间
- 2013-5-14
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
楼主 |
发表于 2018-7-20 09:20:36
|
显示全部楼层
//-----------------------------------------------------------------------------
//----- dockBar.h : Declaration of the dockBar
//-----------------------------------------------------------------------------
#pragma once
//-----------------------------------------------------------------------------
#include "acui.h"
//-----------------------------------------------------------------------------
class dockBar : public CAcUiDockControlBar {
DECLARE_DYNAMIC (dockBar)
public:
public:
dockBar ();
virtual ~dockBar ();
virtual BOOL Create (CWnd *pParent, LPCSTR lpszTitle) ;
protected:
virtual void SizeChanged (CRect *lpRect, BOOL bFloating, int flags) ;
afx_msg int OnCreate (LPCREATESTRUCT lpCreateStruct) ;
DECLARE_MESSAGE_MAP()
} ;
//-----------------------------------------------------------------------------
//----- dockBar.cpp : Implementation of dockBar
//-----------------------------------------------------------------------------
#include "StdAfx.h"
#include "resource.h"
#include "dockBar.h"
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC (dockBar, CAcUiDockControlBar)
BEGIN_MESSAGE_MAP(dockBar, CAcUiDockControlBar)
ON_WM_CREATE()
END_MESSAGE_MAP()
//-----------------------------------------------------------------------------
//----- dockBar *pInstance = new dockBar;
//----- pInstance->Create (acedGetAcadFrame (), "My title bar") ;
//----- pInstance->EnableDocking (CBRS_ALIGN_ANY) ;
//----- pInstance->RestoreControlBar () ;
//-----------------------------------------------------------------------------
static CLSID clsdockBar = {0xeab78c04, 0x2194, 0x47ad, {0xa4, 0xf2, 0xad, 0xca, 0x3e, 0x3b, 0xb6, 0x3c}} ;
//-----------------------------------------------------------------------------
dockBar::dockBar () : CAcUiDockControlBar() {
}
//-----------------------------------------------------------------------------
dockBar::~dockBar () {
}
//-----------------------------------------------------------------------------
#ifdef _DEBUG
//- Please uncomment the 2 following lines to avoid linker error when compiling
//- in release mode. But make sure to uncomment these lines only once per project
//- if you derive multiple times from CAdUiDockControlBar/CAcUiDockControlBar
//- classes.
//void CAdUiDockControlBar::AssertValid () const {
//}
#endif
//-----------------------------------------------------------------------------
BOOL dockBar::Create(CWnd *pParent, LPCSTR lpszTitle) {
CString strWndClass ;
strWndClass =AfxRegisterWndClass (CS_DBLCLKS, LoadCursor (NULL, IDC_ARROW)) ;
CRect rect (0, 0, 250, 200) ;
if (!CAcUiDockControlBar::Create(
strWndClass,(LPCTSTR)lpszTitle, WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN,
rect, pParent, 0
)
)
return (FALSE) ;
SetToolID (&clsdockBar) ;
// TODO: Add your code here
return (TRUE) ;
}
//-----------------------------------------------------------------------------
//----- This member function is called when an application requests the window be
//----- created by calling the Create or CreateEx member function
int dockBar::OnCreate (LPCREATESTRUCT lpCreateStruct) {
if ( CAcUiDockControlBar::OnCreate (lpCreateStruct) == -1 )
return (-1) ;
return (0) ;
}
//-----------------------------------------------------------------------------
void dockBar::SizeChanged (CRect *lpRect, BOOL bFloating, int flags) {
}
//-----------------------------------------------------------------------------
//----- acrxEntryPoint.cpp
//-----------------------------------------------------------------------------
#include "StdAfx.h"
#include "resource.h"
//-----------------------------------------------------------------------------
#define szRDS _RXST("Andy")
dockBar* dockBar1 = NULL;
//-----------------------------------------------------------------------------
//----- ObjectARX EntryPoint
class CArxProject11App : public AcRxArxApp {
public:
CArxProject11App () : AcRxArxApp () {}
virtual AcRx::AppRetCode On_kInitAppMsg (void *pkt) {
// TODO: Load dependencies here
// You *must* call On_kInitAppMsg here
AcRx::AppRetCode retCode =AcRxArxApp::On_kInitAppMsg (pkt) ;
// TODO: Add your initialization code here
// Redirect the resource override
CAcModuleResourceOverride res;
// Check to see if the dock bar is not already up
if (dockBar1 == NULL)
{
// Create the dock ctrl bar
dockBar1 = new dockBar;
// Now display it
dockBar1->Create(acedGetAcadFrame(),"DockControlBar");
dockBar1->EnableDocking(CBRS_ALIGN_ANY);
dockBar1->SetWindowText(LPCTSTR("Dock Tool"));
}
if (dockBar1)
{
acedGetAcadFrame()->FloatControlBar(dockBar1, CPoint(750, 150), CBRS_ALIGN_RIGHT); // FloatControBar(...)
//acedGetAcadFrame()->DockControlBar(dockBar, AFX_IDW_DOCKBAR_RIGHT, NULL); // DockControlBar(...)
acedGetAcadFrame()->ShowControlBar(dockBar1, TRUE, FALSE);
}
return (retCode) ;
}
virtual AcRx::AppRetCode On_kUnloadAppMsg (void *pkt) {
// TODO: Add your code here
// You *must* call On_kUnloadAppMsg here
AcRx::AppRetCode retCode =AcRxArxApp::On_kUnloadAppMsg (pkt) ;
// TODO: Unload dependencies here
return (retCode) ;
}
virtual void RegisterServerComponents () {
}
} ;
//-----------------------------------------------------------------------------
IMPLEMENT_ARX_ENTRYPOINT(CArxProject11App)
|
|