1 // OptionsDlg.cpp : ʵ���ļ� 2 // 3 4 #include "stdafx.h" 5 #include "MusicPlayer2.h" 6 #include "OptionsDlg.h" 7 #include "afxdialogex.h" 8 9 10 // COptionsDlg �Ի��� 11 12 IMPLEMENT_DYNAMIC(COptionsDlg, CDialog) 13 14 COptionsDlg::COptionsDlg(CWnd* pParent /*=NULL*/) 15 : CDialog(IDD_OPTIONS_DIALOG, pParent) 16 { 17 18 } 19 20 COptionsDlg::~COptionsDlg() 21 { 22 } 23 24 void COptionsDlg::DoDataExchange(CDataExchange* pDX) 25 { 26 CDialog::DoDataExchange(pDX); 27 DDX_Control(pDX, IDC_OPTIONS_TAB, m_tab); 28 } 29 30 31 BEGIN_MESSAGE_MAP(COptionsDlg, CDialog) 32 ON_NOTIFY(TCN_SELCHANGE, IDC_OPTIONS_TAB, &COptionsDlg::OnTcnSelchangeOptionsTab) 33 END_MESSAGE_MAP() 34 35 36 // COptionsDlg ��Ϣ������� 37 38 39 BOOL COptionsDlg::OnInitDialog() 40 { 41 CDialog::OnInitDialog(); 42 43 // TODO: �ڴ���Ӷ���ij�ʼ�� 44 //�����ǩ 45 m_tab.InsertItem(0, _T("����ѡ��")); 46 m_tab.InsertItem(1, _T("�������")); 47 m_tab.InsertItem(2, _T("�����ļ�")); 48 //�����ӶԻ��� 49 m_tab1_dlg.Create(IDD_PLAY_SETTING_DIALOG, &m_tab); 50 m_tab2_dlg.Create(IDD_APPEREANCE_SETTING_DLG, &m_tab); 51 m_tab3_dlg.Create(IDD_DATA_SETTINGS_DIALOG, &m_tab); 52 //�����ӶԻ���Ĵ�С��λ�� 53 CRect rect; 54 m_tab.GetClientRect(rect); 55 CRect rcTabItem; 56 m_tab.GetItemRect(0, rcTabItem); 57 rect.top += rcTabItem.Height() + 4; 58 rect.left += 4; 59 rect.bottom -= 4; 60 rect.right -= 4; 61 m_tab1_dlg.MoveWindow(&rect); 62 m_tab2_dlg.MoveWindow(&rect); 63 m_tab3_dlg.MoveWindow(&rect); 64 65 switch (m_tab_selected) 66 { 67 case 1: 68 m_tab2_dlg.ShowWindow(SW_SHOW); 69 m_tab.SetCurFocus(1); 70 break; 71 case 2: 72 m_tab3_dlg.ShowWindow(SW_SHOW); 73 m_tab.SetCurFocus(2); 74 break; 75 default: 76 m_tab1_dlg.ShowWindow(SW_SHOW); 77 m_tab.SetCurFocus(0); 78 } 79 return TRUE; // return TRUE unless you set the focus to a control 80 // �쳣: OCX ����ҳӦ���� FALSE 81 } 82 83 84 void COptionsDlg::OnTcnSelchangeOptionsTab(NMHDR *pNMHDR, LRESULT *pResult) 85 { 86 // TODO: �ڴ���ӿؼ�֪ͨ���������� 87 m_tab_selected = m_tab.GetCurSel(); 88 switch (m_tab_selected) 89 { 90 case 0: 91 m_tab1_dlg.ShowWindow(SW_SHOW); 92 m_tab2_dlg.ShowWindow(SW_HIDE); 93 m_tab3_dlg.ShowWindow(SW_HIDE); 94 m_tab1_dlg.SetFocus(); 95 break; 96 case 1: 97 m_tab2_dlg.ShowWindow(SW_SHOW); 98 m_tab1_dlg.ShowWindow(SW_HIDE); 99 m_tab3_dlg.ShowWindow(SW_HIDE); 100 m_tab2_dlg.SetFocus(); 101 break; 102 case 2: 103 m_tab3_dlg.ShowWindow(SW_SHOW); 104 m_tab1_dlg.ShowWindow(SW_HIDE); 105 m_tab2_dlg.ShowWindow(SW_HIDE); 106 m_tab3_dlg.SetFocus(); 107 break; 108 } 109 *pResult = 0; 110 } 111 112