VS리소스 에디터에서 툴을 사용하면 디자인 모드에서
Edit Box옆에서 스핀버튼을 버디로 선언하면 알아서 탭순서에 따라 버디로 선언된 컨트롤에 가서 붙는다.
그런데 필요에 따라 버디 기능을 활성화 하거나 비활성화 하려면
아래 코드와 같이 사용하면 된다.
Creating a Control at Runtime
The CAxWindow class provides a mechanism to create and host ActiveX controls in a similar manner to any other window class. This may be desirable if the parent window of the control is also created at runtime.
AtlAxWinInit();
CAxWindow wnd;
//m_hWnd is the parent window handle
//rect is the size of ActiveX control in client coordinates
//IDC_MYCTL is a unique ID to identify the controls window
RECT rect = {10,10,400,300};
wnd.Create(m_hWnd, rect, _T("esriReaderControl.ReaderControl"), WS_CHILD|WS_VISIBLE, 0, IDC_MYCTL);
Setting the Buddy Control Property
The ToolbarControl and TOCControl need to be associated with a "buddy" control on the dialog box. This is typically performed in the OnInitDialog windows message handler of a dialog box.
LRESULT CEngineControlsDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
// Get the Control's interfaces into class member variables
GetDlgControl(IDC_TOOLBARCONTROL, IID_IToolbarControl, (void **) &m_ipToolbarControl);
GetDlgControl(IDC_TOCCONTROL, IID_ITOCControl, (void **) &m_ipTOCControl);
GetDlgControl(IDC_PAGELAYOUTCONTROL, IID_IPageLayoutControl, (void **) &m_ipPageLayoutControl);
// Connect to the controls
AtlAdviseSinkMap(this, TRUE);
// Set buddy controls
m_ipTOCControl->SetBuddyControl(m_ipPageLayoutControl);
m_ipToolbarControl->SetBuddyControl(m_ipPageLayoutControl);
return TRUE;
}
'개발언어 > c++' 카테고리의 다른 글
RGB 색상 관련글 (0) | 2016.06.13 |
---|---|
List Column 고정하기 (0) | 2016.06.13 |
Object instantiation / Template / Reference (0) | 2016.06.13 |
Template 상속받는 UI클래스 구현 (0) | 2016.06.13 |
switch case 에 문자열 사용하기 (0) | 2016.06.13 |