⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subject_50853.htm

📁 一些关于vc的问答
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<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>&nbsp;&nbsp;&nbsp;&nbsp;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>&nbsp;&nbsp;&nbsp;&nbsp;m_nNum = (m_nNum+1)%m_nTotalNum;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;switch(m_nNum)<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;case 0:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_11.SetFocus();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<BR>&nbsp;&nbsp;&nbsp;&nbsp;case 1:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_22.SetFocus();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<BR>&nbsp;&nbsp;&nbsp;&nbsp;...<BR>&nbsp;&nbsp;&nbsp;&nbsp;}
<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>&nbsp;&nbsp;&nbsp;&nbsp;CEditchangeDlg(CWnd* pParent = NULL);&nbsp;&nbsp;&nbsp;&nbsp;// standard constructor<BR><BR>// Dialog Data<BR>&nbsp;&nbsp;&nbsp;&nbsp;//{{AFX_DATA(CEditchangeDlg)<BR>&nbsp;&nbsp;&nbsp;&nbsp;enum { IDD = IDD_EDITCHANGE_DIALOG };<BR>&nbsp;&nbsp;&nbsp;&nbsp;CEdit&nbsp;&nbsp;&nbsp;&nbsp;m_11;<BR>&nbsp;&nbsp;&nbsp;&nbsp;CEdit&nbsp;&nbsp;&nbsp;&nbsp;m_22;<BR>&nbsp;&nbsp;&nbsp;&nbsp;//}}AFX_DATA<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;// ClassWizard generated virtual function overrides<BR>&nbsp;&nbsp;&nbsp;&nbsp;//{{AFX_VIRTUAL(CEditchangeDlg)<BR>&nbsp;&nbsp;&nbsp;&nbsp;public:<BR>&nbsp;&nbsp;&nbsp;&nbsp;virtual BOOL PreTranslateMessage(MSG* pMsg);<BR>&nbsp;&nbsp;&nbsp;&nbsp;protected:<BR>&nbsp;&nbsp;&nbsp;&nbsp;virtual void DoDataExchange(CDataExchange* pDX);&nbsp;&nbsp;&nbsp;&nbsp;// DDX/DDV support<BR>&nbsp;&nbsp;&nbsp;&nbsp;//}}AFX_VIRTUAL<BR><BR>// Implementation<BR>protected:<BR>&nbsp;&nbsp;&nbsp;&nbsp;HICON m_hIcon;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;// Generated message map functions<BR>&nbsp;&nbsp;&nbsp;&nbsp;//{{AFX_MSG(CEditchangeDlg)<BR>&nbsp;&nbsp;&nbsp;&nbsp;virtual BOOL OnInitDialog();<BR>&nbsp;&nbsp;&nbsp;&nbsp;afx_msg void OnSysCommand(UINT nID, LPARAM lParam);<BR>&nbsp;&nbsp;&nbsp;&nbsp;afx_msg void OnPaint();<BR>&nbsp;&nbsp;&nbsp;&nbsp;afx_msg HCURSOR OnQueryDragIcon();<BR>&nbsp;&nbsp;&nbsp;&nbsp;afx_msg void OnButtonchange();<BR>&nbsp;&nbsp;&nbsp;&nbsp;afx_msg void OnChangeEdit1();<BR>&nbsp;&nbsp;&nbsp;&nbsp;afx_msg void OnButton1();<BR>&nbsp;&nbsp;&nbsp;&nbsp;virtual void OnOK();<BR>&nbsp;&nbsp;&nbsp;&nbsp;//}}AFX_MSG<BR>&nbsp;&nbsp;&nbsp;&nbsp;DECLARE_MESSAGE_MAP()<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;int m_num;<BR>&nbsp;&nbsp;&nbsp;&nbsp;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>&nbsp;&nbsp;&nbsp;&nbsp;: CDialog(CEditchangeDlg::IDD, pParent)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;//{{AFX_DATA_INIT(CEditchangeDlg)<BR>&nbsp;&nbsp;&nbsp;&nbsp;//}}AFX_DATA_INIT<BR>&nbsp;&nbsp;&nbsp;&nbsp;// Note that LoadIcon does not require a subsequent DestroyIcon in Win32<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_hIcon = AfxGetApp()-&gt;LoadIcon(IDR_MAINFRAME);<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_num = 0;<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_total = 2;<BR>}<BR><BR>void CEditchangeDlg::DoDataExchange(CDataExchange* pDX)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;CDialog::DoDataExchange(pDX);<BR>&nbsp;&nbsp;&nbsp;&nbsp;//{{AFX_DATA_MAP(CEditchangeDlg)<BR>&nbsp;&nbsp;&nbsp;&nbsp;DDX_Control(pDX, IDC_EDIT1, m_11);<BR>&nbsp;&nbsp;&nbsp;&nbsp;DDX_Control(pDX, IDC_EDIT2, m_22);<BR>&nbsp;&nbsp;&nbsp;&nbsp;//}}AFX_DATA_MAP<BR>}<BR><BR>BEGIN_MESSAGE_MAP(CEditchangeDlg, CDialog)<BR>&nbsp;&nbsp;&nbsp;&nbsp;//{{AFX_MSG_MAP(CEditchangeDlg)<BR>&nbsp;&nbsp;&nbsp;&nbsp;ON_WM_SYSCOMMAND()<BR>&nbsp;&nbsp;&nbsp;&nbsp;ON_WM_PAINT()<BR>&nbsp;&nbsp;&nbsp;&nbsp;ON_WM_QUERYDRAGICON()<BR>&nbsp;&nbsp;&nbsp;&nbsp;ON_BN_CLICKED(IDC_BUTTONCHANGE, OnButtonchange)<BR>&nbsp;&nbsp;&nbsp;&nbsp;ON_EN_CHANGE(IDC_EDIT1, OnChangeEdit1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;ON_BN_CLICKED(IDC_BUTTON1, OnButton1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;//}}AFX_MSG_MAP<BR>END_MESSAGE_MAP()<BR><BR>/////////////////////////////////////////////////////////////////////////////<BR>// CEditchangeDlg message handlers<BR><BR>BOOL CEditchangeDlg::OnInitDialog()<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;CDialog::OnInitDialog();<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;// Add &#34;About...&#34; menu item to system menu.<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;// IDM_ABOUTBOX must be in the system command range.<BR>&nbsp;&nbsp;&nbsp;&nbsp;ASSERT((IDM_ABOUTBOX &amp; 0xFFF0) == IDM_ABOUTBOX);<BR>&nbsp;&nbsp;&nbsp;&nbsp;ASSERT(IDM_ABOUTBOX &lt; 0xF000);<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;CMenu* pSysMenu = GetSystemMenu(FALSE);<BR>&nbsp;&nbsp;&nbsp;&nbsp;if (pSysMenu != NULL)<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CString strAboutMenu;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;strAboutMenu.LoadString(IDS_ABOUTBOX);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (!strAboutMenu.IsEmpty())<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pSysMenu-&gt;AppendMenu(MF_SEPARATOR);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pSysMenu-&gt;AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;// Set the icon for this dialog.&nbsp;&nbsp;The framework does this automatically<BR>&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;&nbsp;when the application's main window is not a dialog<BR>&nbsp;&nbsp;&nbsp;&nbsp;SetIcon(m_hIcon, TRUE);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Set big icon<BR>&nbsp;&nbsp;&nbsp;&nbsp;SetIcon(m_hIcon, FALSE);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Set small icon<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;// TODO: Add extra initialization here<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;return TRUE;&nbsp;&nbsp;// return TRUE&nbsp;&nbsp;unless you set the focus to a control<BR>}<BR><BR>void CEditchangeDlg::OnSysCommand(UINT nID, LPARAM lParam)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;if ((nID &amp; 0xFFF0) == IDM_ABOUTBOX)<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CAboutDlg dlgAbout;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dlgAbout.DoModal();<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CDialog::OnSysCommand(nID, lParam);<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>}<BR><BR>// If you add a minimize button to your dialog, you will need the code below<BR>//&nbsp;&nbsp;to draw the icon.&nbsp;&nbsp;For MFC applications using the document/view model,<BR>//&nbsp;&nbsp;this is automatically done for you by the framework.<BR><BR>void CEditchangeDlg::OnPaint() <BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;if (IsIconic())<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CPaintDC dc(this); // device context for painting<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Center icon in client rectangle<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int cxIcon = GetSystemMetrics(SM_CXICON);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int cyIcon = GetSystemMetrics(SM_CYICON);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CRect rect;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GetClientRect(&amp;rect);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int x = (rect.Width() - cxIcon + 1) / 2;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int y = (rect.Height() - cyIcon + 1) / 2;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Draw the icon<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dc.DrawIcon(x, y, m_hIcon);<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CDialog::OnPaint();<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>}<BR><BR>// The system calls this to obtain the cursor to display while the user drags<BR>//&nbsp;&nbsp;the minimized window.<BR>HCURSOR CEditchangeDlg::OnQueryDragIcon()<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;return (HCURSOR) m_hIcon;<BR>}<BR><BR><BR><BR>void CEditchangeDlg::OnButtonchange() <BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;// TODO: Add your control notification handler code here<BR>&nbsp;&nbsp;&nbsp;&nbsp;MessageBox(&#34;这是焦点按钮弹出的对话框&#34;);<BR>}<BR><BR>void CEditchangeDlg::OnChangeEdit1() <BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;// TODO: If this is a RICHEDIT control, the control will not<BR>&nbsp;&nbsp;&nbsp;&nbsp;// send this notification unless you override the CDialog::OnInitDialog()<BR>&nbsp;&nbsp;&nbsp;&nbsp;// function and call CRichEditCtrl().SetEventMask()<BR>&nbsp;&nbsp;&nbsp;&nbsp;// with the ENM_CHANGE flag ORed into the mask.<BR>//&nbsp;&nbsp;&nbsp;&nbsp;m_change-&gt;Setfocus();<BR>&nbsp;&nbsp;&nbsp;&nbsp;// TODO: Add your control notification handler code here<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>}<BR><BR>BOOL CEditchangeDlg::PreTranslateMessage(MSG* pMsg) <BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;// TODO: Add your specialized code here and/or call the base class<BR>&nbsp;&nbsp;&nbsp;&nbsp;if(pMsg-&gt;hwnd == GetDlgItem(IDC_EDIT1)-&gt;GetSafeHwnd()<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&amp;&amp; pMsg-&gt;message == WM_KEYDOWN)&nbsp;&nbsp;&nbsp;&nbsp;// 按健消息是发给IDC_EDIT1的<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(pMsg-&gt;wParam == 13)&nbsp;&nbsp;&nbsp;&nbsp;// 按的是回车<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pMsg-&gt;wParam = 9;&nbsp;&nbsp;&nbsp;&nbsp;// 换成tab<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;} <BR>&nbsp;&nbsp;&nbsp;&nbsp;return CDialog::PreTranslateMessage(pMsg);<BR>}<BR><BR>void CEditchangeDlg::OnButton1() <BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;// TODO: Add your control notification handler code here<BR>&nbsp;&nbsp;&nbsp;&nbsp;{AfxMessageBox(&#34;23&#34;);}<BR>}<BR><BR><BR>void CEditchangeDlg::OnOK() <BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_num ++;<BR>&nbsp;&nbsp;&nbsp;&nbsp;if (m_num&gt;=m_total)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_num = 1;<BR>&nbsp;&nbsp;&nbsp;&nbsp;switch(n)<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;case 1:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_11.SetFocus();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<BR>&nbsp;&nbsp;&nbsp;&nbsp;case 2:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_22.SetFocus();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<BR>&nbsp;&nbsp;&nbsp;&nbsp;default:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<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 + -