Control.SetBoundsCore(Int32, Int32, Int32, Int32, BoundsSpecified) Metode
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
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
- 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 .