如何使用的WinForms设置控件的Z顺序 [英] How to set Z-order of a Control using WinForms
问题描述
我正在写一个自定义的文本框
是在获得了焦点改变它的边框样式。
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$c$c>父母的控制方法
集合。
这篇关于如何使用的WinForms设置控件的Z顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!