我們知道要把一個控件置頂的話一般有兩種方法,一種是直接在界面裏選中控件-》右鍵-》置於頂層
另外一種是在界面初始化的時候使用BringToFront方法。
這裏主要介紹第三種方法SetChildIndex:
this.Controls.SetChildIndex(label1, 0);
爲了獲取控件當前的索引,可以使用GetChildIndex方法。
int nZorder = this.Controls.GetChildIndex(label1, true);
我們知道要把一個控件置頂的話一般有兩種方法,一種是直接在界面裏選中控件-》右鍵-》置於頂層
另外一種是在界面初始化的時候使用BringToFront方法。
這裏主要介紹第三種方法SetChildIndex:
this.Controls.SetChildIndex(label1, 0);
爲了獲取控件當前的索引,可以使用GetChildIndex方法。
int nZorder = this.Controls.GetChildIndex(label1, true);