如何在MFC中将控件置于最前面 [英] How can you bring a control to front in mfc

查看:1797
本文介绍了如何在MFC中将控件置于最前面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在设计时在MFC中更改控件的Z顺序 -即我无法使用SetWindowPos或在运行时执行此操作-我想在设计器中查看更改后的Z顺序(即使我不得不直接编辑.rc代码也是如此).

How do you change controls' Z-order in MFC at design time - i.e. I can't use SetWindowPos or do this at runtime - I want to see the changed z-order in the designer (even if I have to resort to direct-editing the .rc code).

我有一个要向其中添加控件的MFC对话框.如果控件的边缘之间有重叠,我想将其中一个放在另一个的前面.在Windows窗体或WPF中,等等.我在MFC中找不到这些选项,也无法说出它是如何确定前面的内容的,因为刚添加的控件通常位于之前存在的控件的后面.如何在MFC中操纵Z顺序?即使我必须直接操作.rc文件代码(即在设计器中最终运行).

I have an MFC dialog to which I am adding controls. If there is overlap between the edges of the controls, I want to bring one to the front of the other. In Windows Forms or WPF, etc. I can Bring to Front, Send to Back, Bring Forward, Send Back. I don't find these options in MFC, nor can I tell how it determines what is in front, as a control just added is often behind a control that was there previously. How can I manipulate the Z-order in MFC? Even if I have to manipulate the .rc file code directly (i.e. end-run around the designer).

推荐答案

我认为前面的控件将是rc文件中出现的最后一个控件.换句话说,对话框编辑器将在rc文件中从上到下绘制每个控件,并在必要时将它们重叠.

I think the control in front will be the last control that occurs in the rc file. In other words, the dialog editor will draw each control as it is encountered from top to bottom in the rc file, overlapping them when necessary.

您可以编辑rc文件以对它们重新排序,也可以在编辑器中更改选项卡顺序,这也是一样,因为选项卡顺序也是根据控件在文件中的出现顺序设置的.据我所知,MFC在设计时没有提供任何其他方式来对重叠控件进行分层.

You can edit the rc file to reorder them, or you can change the tab order in the editor, which does the same thing since tab order is also set based on the order that the controls occur in the file. To my knowledge MFC doesn't offer any other way of layering overlapping controls at design time.

这篇关于如何在MFC中将控件置于最前面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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