Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

5인용C++스터디/버튼과체크박스: Difference between revisions

From ZeroWiki
imported>Unknown
No edit summary
 
(Repair batch-0001 pages from live compare)
 
Line 89: Line 89:
{| class="wikitable"
{| class="wikitable"
|-
|-
| [[:File:CButton.zip|CButton.zip]]
| CButton.zip
|}
|}

Latest revision as of 23:55, 26 March 2026

  • 발표에 꼭 들어가야 할 것들
    • 푸쉬버튼은 어떻게 만드나?
    • 푸쉬버튼을 눌렀을 때의 처리는 어떻게 하나?
    • 라디오버튼은 어떻게 만드나?
    • 라디오버튼이 선택되어 있는지 어떻게 확인하나?
    • 체크박스는 어떻게 만드나?
    • 체크박스가 체크되어 있는지 어떻게 확인하나?
    • 다이얼로그 박스에서 만들고 사용하는 방법을 발표하면 안됨!


버튼

CMy111View

public:

CButton myButton1, myButton2, myButton3, myButton4;
protected:
//{{AFX_MSG(CMy111View)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
BEGIN_MESSAGE_MAP(CMy111View, CView)
	//{{AFX_MSG_MAP(CMy111View)
	ON_WM_CREATE()
	ON_BN_CLICKED(1,OnButton1Click)
// CMy111View message handlers
int CMy111View::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CView::OnCreate(lpCreateStruct) == -1)
		return -1;


// Create a push button.
myButton1.Create(_T("푸시 버튼"), WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON, 
   CRect(10,10,200,30), this, 1);

// Create a radio button.
myButton2.Create(_T("라디오 버튼"), WS_CHILD|WS_VISIBLE|BS_RADIOBUTTON, 
   CRect(10,40,200,70), this, 2);

// Create an auto 3-state button.
myButton3.Create(_T("3상태 버튼"), WS_CHILD|WS_VISIBLE|BS_AUTO3STATE, 
   CRect(10,70,200,100), this, 3);

// Create an auto check box.
myButton4.Create(_T("체크박스"), WS_CHILD|WS_VISIBLE|BS_AUTOCHECKBOX, 
   CRect(10,100,200,130), this, 4);
	return 0;
}

void CMy111View::OnButton1Click()
{
	MessageBox(_T("버튼이 눌려졌습니다."));
}


Value Meaning
BST_UNCHECKED Button state is unchecked.
BST_CHECKED Button state is checked.
BST_INDETERMINATE Button state is indeterminate (applies only if the button has the BS_3STATE or BS_AUTO3STATE style).
void CMy111View::OnButton1Click()
{
	check3=myButton3.GetCheck();
	if(check3==BST_CHECKED)
		MessageBox(_T("3버튼 체크되어 있음"));
	else if(check3==BST_UNCHECKED)
		MessageBox(_T("3버튼 체크 안되어 잇음"));
	else if(check3==BST_INDETERMINATE)
		MessageBox(_T("3버튼 희끄므리하게 체크되어 있음"));
}
myButton2.SetCheck( BST_CHECKED );
	check2=myButton2.GetCheck();
	if(check3==BST_CHECKED)
		MessageBox(_T("라디오버튼 체크되어 있음"));
	else if(check3==BST_UNCHECKED)
		MessageBox(_T("라이오버튼 체크 안되어 잇음"));


CButton.zip