CButton::Create
Windows düğmesi denetimi oluşturur ve ekler CButton nesnesi.
virtual BOOL Create(
LPCTSTR lpszCaption,
DWORD dwStyle,
const RECT& rect,
CWnd* pParentWnd,
UINT nID
);
Parametreler
lpszCaption
Düğmesine denetimin metni belirtir.dwStyle
Button denetiminin stil belirler.Herhangi bir birleşimi geçerli Düğme stillerini düğmesine.rect
Düğmesine denetimin boyutunu ve konumunu belirtir.Şunlardan biri olabilir bir CRect nesne veya bir RECT yapısı.pParentWnd
Genellikle düğme denetimin üst pencere belirtir bir CDialog.Olmaması gereken null.nID
Düğmesine denetimin kimliğini belirtir.
Dönüş Değeri
Başarılı olursa sıfırdan farklı; Aksi halde 0.
Notlar
Yapılandırma, bir CButton iki adımda nesne.İlk olarak, yapıcıyı çağırır ve sonra call Create, Windows düğmesi denetimi oluşturur ve ekler CButton nesnesi.
WS_VISIBLE stili verilir, Windows düğmesi denetimi etkinleştirmek ve Göster düğmesi için gerekli tüm iletileri gönderir.
Aşağıdaki uygulama Pencere stilleri için bir button denetimi:
WS_CHILD her zaman
WS_VISIBLE genellikle
WS_DISABLED nadiren
ws_group için denetimleri gruplandırın.
ws_tabstop sekme sırasını düğme eklemek için
Örnek
CButton myButton1, myButton2, myButton3, myButton4;
// Create a push button.
myButton1.Create(_T("My button"), WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,
CRect(10,10,100,30), pParentWnd, 1);
// Create a radio button.
myButton2.Create(_T("My button"), WS_CHILD|WS_VISIBLE|BS_RADIOBUTTON,
CRect(10,40,100,70), pParentWnd, 2);
// Create an auto 3-state button.
myButton3.Create(_T("My button"), WS_CHILD|WS_VISIBLE|BS_AUTO3STATE,
CRect(10,70,100,100), pParentWnd, 3);
// Create an auto check box.
myButton4.Create(_T("My button"), WS_CHILD|WS_VISIBLE|BS_AUTOCHECKBOX,
CRect(10,100,100,130), pParentWnd, 4);
Gereksinimler
Başlık: afxwin.h