如何在对话框的标题栏中创建自定义按钮? [英] How to create custom button in dialog's titlebar?
本文介绍了如何在对话框的标题栏中创建自定义按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何在对话框的标题栏中创建自定义按钮吗?并且该按钮的外观应与其他图标(例如最大化或最小化或帮助上下文图标)相同.我也想知道自定义按钮单击事件的处理程序.请帮我解决一下这个 .在此先感谢.
Hi,
I want to know how to create a custom button in dialog''s title bar? and that button look should be same as other icons like maximize or minimize or help context icon. And I want to know the handler also for the custom button click event. Please help me with this . Thanks in advance.
推荐答案
这很困难,但确实可行.基本上,您需要处理Windows消息WM_NCCALCSIZE, WM_NCPAINT, WM_NCBUTTONUP, WM_NCBUTTONDOWN, WM_NCMOUSEMOVE, WM_NCRBUTTONDBLCLK
并实现按钮操作的逻辑.在那些WM_NC...
消息名称中,"NC"表示非客户端.
您还需要参考系统指标以正确设置按钮的大小和位置,请参阅 http ://msdn.microsoft.com/zh-CN/library/ms724385(v = vs.85).aspx [
This is pretty difficult but quite doable. Basically, you need to handle Windows messagesWM_NCCALCSIZE, WM_NCPAINT, WM_NCBUTTONUP, WM_NCBUTTONDOWN, WM_NCMOUSEMOVE, WM_NCRBUTTONDBLCLK
and implement of the logic of button operation. In thoseWM_NC...
message names "NC" means non-client.
You also need to consult system metrics to correctly size and position your button, see http://msdn.microsoft.com/en-us/library/ms724385(v=vs.85).aspx[^].
—SA
也请检查此内容,
CCaptionButton(标题栏按钮) [
Check this also,
CCaptionButton (buttons for the titlebar)[^]
为什么不创建单个文档,而派生视图类CFormView.那很容易.
why not to create single document and the view class is derive the CFormView.That is easy what you do.
这篇关于如何在对话框的标题栏中创建自定义按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文