日期:2014-05-18  浏览次数:20838 次

堆叠控件(Z轴顺序)!!!
请问控件的SendToBack()方法和BringToFront()方法的具体是怎么工作的,比如他们是怎么改变控件的z轴顺序的。谢谢。

------解决方案--------------------
反编译去看看源码吧,比如
C# code

public void SendToBack()
{
    if (this.parent != null)
    {
        this.parent.Controls.SetChildIndex(this, -1);
    }
    else if (this.IsHandleCreated && this.GetTopLevel())
    {
        SafeNativeMethods.SetWindowPos(new HandleRef(this.window, this.Handle), NativeMethods.HWND_BOTTOM, 0, 0, 0, 0, 3);
    }
}
关键在SetChildIndex