显示和隐藏不同对话框的控件 [英] showing and hiding controls of different dialog

查看:172
本文介绍了显示和隐藏不同对话框的控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我有一个基于对话框的应用程序.其中有3个对话框.我想通过更改组合框项目来清除所有对话框上显示的所有控件.应该基于组合框值.我已经尝试了事件,但是在此过程中,它显示了新的控件以及以前的控件.我想隐藏所有以前的控件并想要显示新的控件.我该如何移动用这个吗?请帮帮我..

解决方案

您应该选择一种在对话框之间发送数据的方法.

您可以在每个应该接收信息的对话框中放置一些公共函数,以便从原始对话框中调用它们,然后在目的地对话框中作出反应.

您还可以将消息发送到具有数据结构的不同对话框...

为了显示或隐藏控件,您可以将ShowWindow函数与SW_HIDE或SW_SHOW一起使用;


Joan的回答是正确的...但是我要补充一点,MFC的正确方法是这是通过SendMessage()PostMessage()以及接收对话框中的事件处理程序进行的(事件处理程序将管理内部控件).


hi all, i''ve a dialog based application.where in i''ve 3 dialogs.i want to clear all the controls which are displying on all dialogs by changing the combobox items.that means, the controls on dialog should be based on combobox value.i''ve tried with events, but in that, it is showing the new controls along with the previous controls.i want to hide all previous controls and want to show the new controls.how can i move with this?please help me..
thank you in advance.

解决方案

You should choose a method to send data between dialogs.

You can put some public functions in each dialog that should receive information in order to call them from the original one and then react in the destiny dialogs.

You can also send messages to the different dialogs with a structure with data...

In order to show or hide controls you can use the function ShowWindow with SW_HIDE or SW_SHOW;


Joan''s answer is correct... but I would add that the MFC proper way of doing this is through SendMessage() or PostMessage() and an event handler in the receiving dialog (the event handler would manage the internal controls).


这篇关于显示和隐藏不同对话框的控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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