?? subject_50853.htm
字號:
<br>
<a href="javascript:history.go(-1)">返回上頁</a><br><a href=http://www.copathway.com/cndevforum/>訪問論壇</a></p></blockquote>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回復者:愛麗思 回復日期:2003-08-27 10:56:06
<br>內容:計數器需要定義的<BR><BR>刪掉這個OK按鈕,另外創建一個按鈕,寫上OK就可以了<BR>CMyDlg::OnButtonAnotherOK()<BR>{<BR> CDialog::OnOK();<BR>}<BR>
<br>
<a href="javascript:history.go(-1)">返回上頁</a><br><a href=http://www.copathway.com/cndevforum/>訪問論壇</a></p></blockquote>
<hr size=1>
<blockquote><p>
回復者:名字沒想好 回復日期:2003-08-27 11:03:22
<br>內容:謝謝,你的意思我基本上懂了,我回去試試,例子有空幫我看看,非常感謝!<BR>很想和你交朋友!
<br>
<a href="javascript:history.go(-1)">返回上頁</a><br><a href=http://www.copathway.com/cndevforum/>訪問論壇</a></p></blockquote>
<hr size=1>
<blockquote><p>
回復者:名字沒想好 回復日期:2003-08-28 09:53:40
<br>內容:愛麗思,幫我看看例子啊,你的方法我行不通!<BR>各位高手幫忙啊!
<br>
<a href="javascript:history.go(-1)">返回上頁</a><br><a href=http://www.copathway.com/cndevforum/>訪問論壇</a></p></blockquote>
<hr size=1>
<blockquote><p>
回復者:愛麗思 回復日期:2003-08-28 10:58:02
<br>內容:我已經改好了<BR>(1) 增加成員變量,去掉其它的按鈕<BR>(2) 增加OnOK方法<BR>(3) 在OnOK中按我前面寫的:<BR> m_nNum = (m_nNum+1)%m_nTotalNum; <BR> switch(m_nNum)<BR> {<BR> case 0:<BR> m_11.SetFocus();<BR> break;<BR> case 1:<BR> m_22.SetFocus();<BR> break;<BR> ...<BR> }
<br>
<a href="javascript:history.go(-1)">返回上頁</a><br><a href=http://www.copathway.com/cndevforum/>訪問論壇</a></p></blockquote>
<hr size=1>
<blockquote><p>
回復者:名字沒想好 回復日期:2003-08-28 16:46:04
<br>內容:謝謝,我試試!
<br>
<a href="javascript:history.go(-1)">返回上頁</a><br><a href=http://www.copathway.com/cndevforum/>訪問論壇</a></p></blockquote>
<hr size=1>
<blockquote><p>
回復者:名字沒想好 回復日期:2003-08-29 10:03:03
<br>內容:愛麗思,可以將你幫我改好的EDIT的例子傳上來嘛,我試過還是不行,可能是哪兒短路了,謝謝!
<br>
<a href="javascript:history.go(-1)">返回上頁</a><br><a href=http://www.copathway.com/cndevforum/>訪問論壇</a></p></blockquote>
<hr size=1>
<blockquote><p>
回復者:愛麗思 回復日期:2003-08-29 10:11:18
<br>內容:class CEditchangeDlg : public CDialog<BR>{<BR>// Construction<BR>public:<BR> CEditchangeDlg(CWnd* pParent = NULL); // standard constructor<BR><BR>// Dialog Data<BR> //{{AFX_DATA(CEditchangeDlg)<BR> enum { IDD = IDD_EDITCHANGE_DIALOG };<BR> CEdit m_11;<BR> CEdit m_22;<BR> //}}AFX_DATA<BR><BR> // ClassWizard generated virtual function overrides<BR> //{{AFX_VIRTUAL(CEditchangeDlg)<BR> public:<BR> virtual BOOL PreTranslateMessage(MSG* pMsg);<BR> protected:<BR> virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support<BR> //}}AFX_VIRTUAL<BR><BR>// Implementation<BR>protected:<BR> HICON m_hIcon;<BR><BR> // Generated message map functions<BR> //{{AFX_MSG(CEditchangeDlg)<BR> virtual BOOL OnInitDialog();<BR> afx_msg void OnSysCommand(UINT nID, LPARAM lParam);<BR> afx_msg void OnPaint();<BR> afx_msg HCURSOR OnQueryDragIcon();<BR> afx_msg void OnButtonchange();<BR> afx_msg void OnChangeEdit1();<BR> afx_msg void OnButton1();<BR> virtual void OnOK();<BR> //}}AFX_MSG<BR> DECLARE_MESSAGE_MAP()<BR><BR> int m_num;<BR> int m_total;<BR>};<BR>
<br>
<a href="javascript:history.go(-1)">返回上頁</a><br><a href=http://www.copathway.com/cndevforum/>訪問論壇</a></p></blockquote>
<hr size=1>
<blockquote><p>
回復者:愛麗思 回復日期:2003-08-29 10:12:01
<br>內容:CEditchangeDlg::CEditchangeDlg(CWnd* pParent /*=NULL*/)<BR> : CDialog(CEditchangeDlg::IDD, pParent)<BR>{<BR> //{{AFX_DATA_INIT(CEditchangeDlg)<BR> //}}AFX_DATA_INIT<BR> // Note that LoadIcon does not require a subsequent DestroyIcon in Win32<BR> m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);<BR> m_num = 0;<BR> m_total = 2;<BR>}<BR><BR>void CEditchangeDlg::DoDataExchange(CDataExchange* pDX)<BR>{<BR> CDialog::DoDataExchange(pDX);<BR> //{{AFX_DATA_MAP(CEditchangeDlg)<BR> DDX_Control(pDX, IDC_EDIT1, m_11);<BR> DDX_Control(pDX, IDC_EDIT2, m_22);<BR> //}}AFX_DATA_MAP<BR>}<BR><BR>BEGIN_MESSAGE_MAP(CEditchangeDlg, CDialog)<BR> //{{AFX_MSG_MAP(CEditchangeDlg)<BR> ON_WM_SYSCOMMAND()<BR> ON_WM_PAINT()<BR> ON_WM_QUERYDRAGICON()<BR> ON_BN_CLICKED(IDC_BUTTONCHANGE, OnButtonchange)<BR> ON_EN_CHANGE(IDC_EDIT1, OnChangeEdit1)<BR> ON_BN_CLICKED(IDC_BUTTON1, OnButton1)<BR> //}}AFX_MSG_MAP<BR>END_MESSAGE_MAP()<BR><BR>/////////////////////////////////////////////////////////////////////////////<BR>// CEditchangeDlg message handlers<BR><BR>BOOL CEditchangeDlg::OnInitDialog()<BR>{<BR> CDialog::OnInitDialog();<BR><BR> // Add "About..." menu item to system menu.<BR><BR> // IDM_ABOUTBOX must be in the system command range.<BR> ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);<BR> ASSERT(IDM_ABOUTBOX < 0xF000);<BR><BR> CMenu* pSysMenu = GetSystemMenu(FALSE);<BR> if (pSysMenu != NULL)<BR> {<BR> CString strAboutMenu;<BR> strAboutMenu.LoadString(IDS_ABOUTBOX);<BR> if (!strAboutMenu.IsEmpty())<BR> {<BR> pSysMenu->AppendMenu(MF_SEPARATOR);<BR> pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);<BR> }<BR> }<BR><BR> // Set the icon for this dialog. The framework does this automatically<BR> // when the application's main window is not a dialog<BR> SetIcon(m_hIcon, TRUE); // Set big icon<BR> SetIcon(m_hIcon, FALSE); // Set small icon<BR> <BR> // TODO: Add extra initialization here<BR> <BR> return TRUE; // return TRUE unless you set the focus to a control<BR>}<BR><BR>void CEditchangeDlg::OnSysCommand(UINT nID, LPARAM lParam)<BR>{<BR> if ((nID & 0xFFF0) == IDM_ABOUTBOX)<BR> {<BR> CAboutDlg dlgAbout;<BR> dlgAbout.DoModal();<BR> }<BR> else<BR> {<BR> CDialog::OnSysCommand(nID, lParam);<BR> }<BR>}<BR><BR>// If you add a minimize button to your dialog, you will need the code below<BR>// to draw the icon. For MFC applications using the document/view model,<BR>// this is automatically done for you by the framework.<BR><BR>void CEditchangeDlg::OnPaint() <BR>{<BR> if (IsIconic())<BR> {<BR> CPaintDC dc(this); // device context for painting<BR><BR> SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);<BR><BR> // Center icon in client rectangle<BR> int cxIcon = GetSystemMetrics(SM_CXICON);<BR> int cyIcon = GetSystemMetrics(SM_CYICON);<BR> CRect rect;<BR> GetClientRect(&rect);<BR> int x = (rect.Width() - cxIcon + 1) / 2;<BR> int y = (rect.Height() - cyIcon + 1) / 2;<BR><BR> // Draw the icon<BR> dc.DrawIcon(x, y, m_hIcon);<BR> }<BR> else<BR> {<BR> CDialog::OnPaint();<BR> }<BR>}<BR><BR>// The system calls this to obtain the cursor to display while the user drags<BR>// the minimized window.<BR>HCURSOR CEditchangeDlg::OnQueryDragIcon()<BR>{<BR> return (HCURSOR) m_hIcon;<BR>}<BR><BR><BR><BR>void CEditchangeDlg::OnButtonchange() <BR>{<BR> // TODO: Add your control notification handler code here<BR> MessageBox("這是焦點按鈕彈出的對話框");<BR>}<BR><BR>void CEditchangeDlg::OnChangeEdit1() <BR>{<BR> // TODO: If this is a RICHEDIT control, the control will not<BR> // send this notification unless you override the CDialog::OnInitDialog()<BR> // function and call CRichEditCtrl().SetEventMask()<BR> // with the ENM_CHANGE flag ORed into the mask.<BR>// m_change->Setfocus();<BR> // TODO: Add your control notification handler code here<BR> <BR>}<BR><BR>BOOL CEditchangeDlg::PreTranslateMessage(MSG* pMsg) <BR>{<BR> // TODO: Add your specialized code here and/or call the base class<BR> if(pMsg->hwnd == GetDlgItem(IDC_EDIT1)->GetSafeHwnd()<BR> && pMsg->message == WM_KEYDOWN) // 按健消息是發給IDC_EDIT1的<BR> {<BR> if(pMsg->wParam == 13) // 按的是回車<BR> pMsg->wParam = 9; // 換成tab<BR> <BR> } <BR> return CDialog::PreTranslateMessage(pMsg);<BR>}<BR><BR>void CEditchangeDlg::OnButton1() <BR>{<BR> // TODO: Add your control notification handler code here<BR> {AfxMessageBox("23");}<BR>}<BR><BR><BR>void CEditchangeDlg::OnOK() <BR>{<BR> m_num ++;<BR> if (m_num>=m_total)<BR> m_num = 1;<BR> switch(n)<BR> {<BR> case 1:<BR> m_11.SetFocus();<BR> break;<BR> case 2:<BR> m_22.SetFocus();<BR> break;<BR> default:<BR> break;<BR> }<BR>}<BR>
<br>
<a href="javascript:history.go(-1)">返回上頁</a><br><a href=http://www.copathway.com/cndevforum/>訪問論壇</a></p></blockquote>
<hr size=1>
<blockquote><p>
回復者:名字沒想好 回復日期:2003-08-29 10:25:50
<br>內容:非常感謝愛麗思,致敬!
<br>
<a href="javascript:history.go(-1)">返回上頁</a><br><a href=http://www.copathway.com/cndevforum/>訪問論壇</a></p></blockquote>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -