Bagikan melalui


Control.SetBoundsCore(Int32, Int32, Int32, Int32, BoundsSpecified) Metode

Definisi

Melakukan pekerjaan pengaturan batas kontrol ini yang ditentukan.

protected:
 virtual void SetBoundsCore(int x, int y, int width, int height, System::Windows::Forms::BoundsSpecified specified);
protected virtual void SetBoundsCore(int x, int y, int width, int height, System.Windows.Forms.BoundsSpecified specified);
abstract member SetBoundsCore : int * int * int * int * System.Windows.Forms.BoundsSpecified -> unit
override this.SetBoundsCore : int * int * int * int * System.Windows.Forms.BoundsSpecified -> unit
Protected Overridable Sub SetBoundsCore (x As Integer, y As Integer, width As Integer, height As Integer, specified As BoundsSpecified)

Parameter

x
Int32

Nilai properti baru Left kontrol.

y
Int32

Nilai properti baru Top kontrol.

width
Int32

Nilai properti baru Width kontrol.

height
Int32

Nilai properti baru Height kontrol.

specified
BoundsSpecified

Kombinasi bitwise dari BoundsSpecified nilai.

Contoh

Contoh kode berikut mengambil alih SetBoundsCore metode untuk memastikan bahwa kontrol tetap berukuran tetap. Contoh ini mengharuskan Anda memiliki kelas yang berasal dari kelas secara Control langsung atau tidak langsung.

protected:
   virtual void SetBoundsCore( int x, int y, int width, int height, BoundsSpecified specified ) override
   {
      // Set a fixed height and width for the control.
      UserControl::SetBoundsCore( x, y, 150, 75, specified );
   }
protected override void SetBoundsCore(int x, int y, 
   int width, int height, BoundsSpecified specified)
{
   // Set a fixed height and width for the control.
   base.SetBoundsCore(x, y, 150, 75, specified);
}
Protected Overrides Sub SetBoundsCore(x As Integer, _
  y As Integer, width As Integer, _
  height As Integer, specified As BoundsSpecified)
   ' Set a fixed height and width for the control.
   MyBase.SetBoundsCore(x, y, 150, 75, specified)
End Sub

Keterangan

Biasanya, parameter yang sesuai dengan batas yang tidak disertakan dalam specified parameter diteruskan dengan nilainya saat ini. Misalnya, Heightproperti , , Widthatau X atau YLocation properti properti dapat diteruskan dengan referensi ke instans kontrol saat ini. Namun semua nilai yang diteruskan dihormati dan diterapkan ke kontrol.

Parameter boundsSpecified mewakili elemen kontrol yang Bounds diubah oleh aplikasi Anda. Misalnya, jika Anda mengubah Size kontrol, boundsSpecified nilai parameter adalah Size nilai .BoundsSpecified Namun, jika Size disesuaikan sebagai respons terhadap properti yang Dock ditetapkan, boundsSpecified nilai parameter adalah None nilai .BoundsSpecified

Nota

Pada sistem Windows Server 2003, ukuran dibatasi Form oleh lebar piksel maksimum dan tinggi monitor.

Catatan Bagi Inheritor

Saat mengambil alih kelas turunan SetBoundsCore(Int32, Int32, Int32, Int32, BoundsSpecified) , pastikan untuk memanggil metode kelas SetBoundsCore(Int32, Int32, Int32, Int32, BoundsSpecified) dasar untuk memaksa batas kontrol berubah. Kelas turunan dapat menambahkan pembatasan ukuran ke SetBoundsCore(Int32, Int32, Int32, Int32, BoundsSpecified) metode .

Berlaku untuk

Lihat juga