共用方式為


Control.UpdateStyles 方法

定義

強制將分配的樣式重新套用到控制項上。

protected:
 void UpdateStyles();
protected void UpdateStyles();
member this.UpdateStyles : unit -> unit
Protected Sub UpdateStyles ()

範例

以下程式碼範例允許對 進行 Form 雙重緩衝,並更新樣式以反映變更。

public:
   void EnableDoubleBuffering()
   {
      // Set the value of the double-buffering style bits to true.
      this->SetStyle( static_cast<ControlStyles>(ControlStyles::DoubleBuffer | ControlStyles::UserPaint | ControlStyles::AllPaintingInWmPaint), true );
      this->UpdateStyles();
   }
public void EnableDoubleBuffering()
{
   // Set the value of the double-buffering style bits to true.
   this.SetStyle(ControlStyles.DoubleBuffer | 
      ControlStyles.UserPaint | 
      ControlStyles.AllPaintingInWmPaint,
      true);
   this.UpdateStyles();
}
Public Sub EnableDoubleBuffering()
   ' Set the value of the double-buffering style bits to true.
   Me.SetStyle(ControlStyles.DoubleBuffer _
     Or ControlStyles.UserPaint _
     Or ControlStyles.AllPaintingInWmPaint, _
     True)
   Me.UpdateStyles()
End Sub

備註

此方法呼叫 CreateParams 方法以使樣式套用。 指派給 的StyleExStyle樣式與指派給控制CreateParams項屬性的屬性CreateParams會重新套用。 如有需要,控制器會重新上色以反映風格變化。

若屬性IsHandleCreated值為 false,該UpdateStyles方法無效。

適用於

另請參閱