Control.BringToFront 方法
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將控制項帶到疊置順序的前面。
public:
void BringToFront();
C#
public void BringToFront();
member this.BringToFront : unit -> unit
Public Sub BringToFront ()
下列程式碼範例會藉由呼叫 其 BringToFront 方法,確保 Label 可見。 此範例需要您具有 Form 具 Panel 名 panel1
的 ,以及 Label 具名 的 label1
。
private:
void MakeLabelVisible()
{
/* If the panel contains label1, bring it
* to the front to make sure it is visible. */
if ( panel1->Contains( label1 ) )
{
label1->BringToFront();
}
}
C#
private void MakeLabelVisible()
{
/* If the panel contains label1, bring it
* to the front to make sure it is visible. */
if(panel1.Contains(label1))
{
label1.BringToFront();
}
}
Private Sub MakeLabelVisible()
' If the panel contains label1, bring it
' to the front to make sure it is visible.
If panel1.Contains(label1) Then
label1.BringToFront()
End If
End Sub
控制項會移至迭置順序的前面。 如果控制項是另一個控制項的子系,子控制項就會移至 z 順序的前端。 BringToFront 不會讓控制項成為最上層控制項,也不會引發 Paint 事件。
產品 | 版本 |
---|---|
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |