BEGIN_MESSAGE_MAP(CTry04Dlg, CDialog)
//{{AFX_MSG_MAP(CTry04Dlg)
...
ON_NOTIFY(TCN_SELCHANGE, IDC_TAB, OnSelchangeTab)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
...
BOOL CTry04Dlg::OnInitDialog()
{
...
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
// {
CreateTabDlg();
InitControl();
// }
return TRUE; // return TRUE unless you set the focus to a control
}
...
void CTry04Dlg::InitControl(void)
{
m_Tab.InsertItem(0, "Tab1");
m_Tab.InsertItem(1, "Tab2");
}
// 첫번째 탭 다이얼로그 생성
m_DlgTab1.Create(CDlgTab1::IDD, this);
m_DlgTab1.MoveWindow(rCtrl);
m_DlgTab1.ShowWindow(SW_SHOW);
// 두번째 탭 다이얼로그 생성
m_DlgTab2.Create(CDlgTab2::IDD, this);
m_DlgTab2.MoveWindow(rCtrl);
}
void CTry04Dlg::OnSelchangeTab(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
// {
int nSelItemNo=0;
// 선택된 탭 번호를 구한다
nSelItemNo = m_Tab.GetCurSel();
BOOL CTry04Dlg::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
// {
switch(pMsg->message)
{
case WM_KEYDOWN:
{
switch(pMsg->wParam)
{
case VK_ESCAPE:
case VK_RETURN:
return TRUE;
}
}
}
// }
return CDialog::PreTranslateMessage(pMsg);
}
BEGIN_MESSAGE_MAP(CPractice9_1Dlg, CDialog)
//{{AFX_MSG_MAP(CPractice9_1Dlg)
... ON_NOTIFY(TCN_SELCHANGE, IDC_TAB_SELECTION, OnSelchangeTabSelection)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
...
BOOL CPractice9_1Dlg::OnInitDialog()
{
...
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
// { TC_ITEM tabItem; char* tabName[2] = {"도형 선택", "색깔 선택"}; for (int i = 0; i < 2; i++ ) { tabItem.mask = TCIF_TEXT; tabItem.pszText = tabName[i]; m_tabSelection.InsertItem(i, &tabItem); }
GetDlgItem(IDC_RADIO_RECTANGLE)->ShowWindow(TRUE);
... GetDlgItem(IDC_STATIC_RED)->ShowWindow(FALSE);
...
// }
return TRUE; // return TRUE unless you set the focus to a control
}
... void CPractice9_1Dlg::OnSelchangeTabSelection(NMHDR* pNMHDR, LRESULT* pResult) {
// TODO: Add your control notification handler code here
// { int nSelection = m_tabSelection.GetCurSel(); switch( nSelection ) { case 0: GetDlgItem(IDC_RADIO_RECTANGLE)->ShowWindow(TRUE);
... GetDlgItem(IDC_STATIC_RED)->ShowWindow(FALSE);
... break;