基于非对话框的MFC应用程序上的按钮 [英] Button on Non-Dialog Based MFC Application

查看:108
本文介绍了基于非对话框的MFC应用程序上的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



是否可以在基于非对话框的MFCApplication中的客户区域上添加按钮,就像我可以在其中绘制矩形一样?

PS:我是C ++,MFC和CodeProject的新手,所以对不起.


Nelek,感谢您的链接.我设法用CButton类创建按钮.
但是现在,正如您所说,我认为我可以基于对话框来完成我的项目,因为这样会更容易学习基础知识.

Pallini,thansk是链接,但我认为它描述了对话框按钮的使用(对话框句柄).

PS:谢谢你们双方的答复.我看到我有很多事情要做.

对不起,一团糟.试图删除我的答案.

在OP答案后添加"之后:
再次感谢您的建议.将阅读更多内容并尝试.

Hi,

Is it possible to add a button on client area in Non-Dialog Based MFCApplication, just like I can draw there a rectangle ?

PS: I am new to C++, MFC and CodeProject so sorry for anything wrong.


Nelek, thanks for link. I managed to create button with CButton class.
But now, as You say, I think that I can do my project based on dialogs as it would be easier to learn the basics.

Pallini, thansk for link, but I think it describes dialog use of buttons (Dialog handles).

PS: Thanks both of You for replies. I see that I have a lot of reading to do.

Sorry for the mess. Trying to remove my answer.

After ''Addition after OP answer'':
Thanks again for suggestions. Will read some more and try this.

推荐答案

是的,您可以这样做,请参阅 [
Yes, you can do it, see "Using Buttons"[^] on MSDN.
:)


可能的是,按钮是CWnd派生的,因此您可以独立于对话框使用它们.主要区别在于您可能可能必须通过代码来完成所有操作( CFormView也可以使用编辑器).使用对话框编辑器和向导,对话框变得更加容易.

如果您想要/需要这样做:进行一些调查(在codeproject中的
MSDN中 [ ^ ]或Google一点……您将获得很多信息),进行测试,并询问您不了解的内容或所得到的错误.

带下划线的文本和MSDN链接已添加


在OP答案之后添加:
不客气.
另一方面,如果您更喜欢使用CView类,则可以使用 CFormView [ ^ ](就像我之前在第一次编辑中所说的那样.此类作为CDialog或多或少",但是您具有更大的功能,而无需使用向导将其复杂得多.

这取决于您的要求.

例如:
我将使用CDialog创建一个新元素,从用户那里获取一些具体数据,更改对象的某些属性,显示简单的事情……(您暂时需要的过程或相当局部的"过程)

但是我会使用CFormView来包含应用程序中最重要和最常用的控件,显示图形或更详细的控件,与其他视图进行交互,打印...(在整个运行时和/或全局"过程中可能需要的过程) )
Possible it is possible, buttons are CWnd derived so you can use them independantly of Dialogs. The main difference is that you will probably have to do all through code (CFormView can use Editor as well). Dialogs make it much easier with the dialog editor and the wizard.

If you want/need to do it: investigate a bit (here in codeproject, in MSDN [^] or google a bit... you will have a lot of info), make your tests, and ask aboout what you don''t understand or the errors you get.

Underlined text and MSDN link added


Addition after OP answer:
You are welcome.
On the other hand, if you prefer using CView classes you can use CFormView[^] (as I said before in my first edit). This class is "more or less" as a CDialog, but you have a bigger functionality without complicating it so much using the wizard.

It depends on your requirements.

For example:
I would use CDialog to create a new element, getting some concrete data from the user, changing some properties of an object, showing easy things... (processes that you need just temporally or that are "quite local")

But I would use a CFormView to contain the most important and used controls of the application, displaying graphics or more elaborated controls, interacting with other views, printing... (processes that you could need during the whole runtime and/or "globally")


Nelek,感谢您的链接.我设法用CButton类创建按钮.
但是现在,正如您所说,我认为我可以基于对话框来完成我的项目,因为这样会更容易学习基础知识.

Pallini,thansk是链接,但我认为它描述了对话框按钮的使用(对话框句柄).

PS:谢谢你们双方的答复.我看到我有很多事要做.
Nelek, thanks for link. I managed to create button with CButton class.
But now, as You say, I think that I can do my project based on dialogs as it would be easier to learn the basics.

Pallini, thansk for link, but I think it describes dialog use of buttons (Dialog handles).

PS: Thanks both of You for replies. I see that I have a lot of reading to do.


这篇关于基于非对话框的MFC应用程序上的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆