C# /WindowsForm35 메세지 박스 YesNo,OkCancel 이벤트 받기 DialogResult dialogResult = MessageBox.Show("작업이 시작되면 다시 복구할수 없습니다 실행하시겠습니까?", "경고", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2, 0, true); if (dialogResult == DialogResult.Yes) { MessageBox.Show("테스트"); } else { return; } MessageBoxButtons.OKCancel 경우에는 조건문 if문에 DialogResult.OK 또는 DialogResult.No를 이용하면 된다. 2013. 3. 26. 간단한 폼 생성 MDI폼이 아니면 부모자식관계가 없다... ex) NewAddFrm frmAddMail = new NewAddFrm(); private void Add_Click(object sender, EventArgs e) { frmAddMail.ShowDialog(); frmAddMail.Show(); } frmAddMail.ShowDialog(); = 모달다이얼로그 다른창에 포커스가 안된다 frmAddMail.Show(); = 모달리스 형식 다른창에도 포커스가 가능하다 2013. 3. 26. Form 숨기기 몇가지 예제 Windows API 예제. [DllImport("user32.dll")] static extern int ShowWindow(IntPtr hWnd, int nCmdShow); const int SW_MINIMIZED = 6; const int SW_HIDE = 0; const int SW_SHOW = 5; public void HideForm() { //ShowWindow(this.Handle, SW_MINIMIZED); ShowWindow(this.Handle, SW_HIDE); } private void Form_Activated(object sender, EventArgs e) { HideForm(); // 폼이 활성화 될때 숨긴다. } 폼 속성을 이용한 방법 private void Form_Lo.. 2013. 3. 26. 이전 1 ··· 6 7 8 9 다음