Control.BringToFront 方法

定義

將控制項帶到疊置順序的前面。

public:
 void BringToFront();
public void BringToFront ();
member this.BringToFront : unit -> unit
Public Sub BringToFront ()

範例

下列程式碼範例會藉由呼叫 其 BringToFront 方法,確保 Label 可見。 此範例需要您具有 FormPanelpanel1 的 ,以及 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();
      }
   }
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 事件。

適用於

另請參閱