Bagikan melalui


Control.UpdateStyles Metode

Definisi

Memaksa gaya yang ditetapkan untuk diterapkan kembali ke kontrol.

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

Contoh

Contoh kode berikut memungkinkan buffering ganda pada Form dan memperbarui gaya untuk mencerminkan perubahan.

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

Keterangan

Metode ini memanggil CreateParams metode untuk mendapatkan gaya yang akan diterapkan. Gaya yang ditetapkan ke Style properti dan ExStyle yang CreateParams ditetapkan ke properti kontrol CreateParams diterapkan kembali. Kontrol dicat ulang untuk mencerminkan perubahan gaya jika perlu.

Metode UpdateStyles ini tidak berpengaruh jika IsHandleCreated nilai properti adalah false.

Berlaku untuk

Lihat juga