如何使用的WinForms设置控件的Z顺序 [英] How to set Z-order of a Control using WinForms

查看:116
本文介绍了如何使用的WinForms设置控件的Z顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一个自定义的文本框是在获得了焦点改变它的边框样式。

I'm writing a custom TextBox that upon gaining focus changes its border style.

由于添加边框会导致与邻国它重叠控制,我暂时把文本框在对话框的前面(使用 textBox.BringToFront()

As adding a border causes the control to overlap with those neighbouring it, I temporarily bring the text box to the front of the dialog (using textBox.BringToFront()).

然而,一旦完成编辑和重点丢失,我想控制发送回在Z顺序中的原始位置。

However, once editing is complete and focus is lost, I would like to send the control back to its original position in the Z-order.

这是可能的(preferably以简单的方式!)

Is this possible (preferably in a simple way!)

推荐答案

调用 GetChildIndex 和<一个href=\"http://msdn.microsoft.com/en-us/library/system.windows.forms.control.controlcollection.setchildindex.aspx\"><$c$c>SetChildIndex父母的控制方法集合。

这篇关于如何使用的WinForms设置控件的Z顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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