using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; using System.Drawing; // Color using Janus.Windows.Ribbon; using Janus.Windows.EditControls; namespace IControls_FireManager { // 팝업 메세지는 여기 클래스에서 전담한다 /// /// 지정자 정의 /// // 팝업 타입 public enum Popup_Type { Confirm, Dialog, Progress, ConfirmNoBtn } // 확인 팝업 타입중 세분화시킨 타입 public enum Popup_Style { Normal, Return, Alarm } public static class _Popup { /// /// 모달 메세지 박스 (윈도우에서 기본적으로 제공하는 팝업창) /// 제어권을 반납하지 않으므로 켜져있는동안 부모 윈도우에서 작업을 하지 못하므로 사용에 주의바람. /// // 타입은 아래와 같다 //public enum MessageBoxButtons //{ // // 요약: // // 메시지 상자에 확인 단추가 있습니다. // OK = 0, // // // // 요약: // // 메시지 상자에 확인 및 취소 단추가 있습니다. // OKCancel = 1, // // // // 요약: // // 메시지 상자에 중단, 다시 시도 및 무시 단추가 있습니다 // AbortRetryIgnore = 2, // // // // 요약: // // 메시지 상자에 예, 아니요 및 취소 단추가 있습니다. // YesNoCancel = 3, // // // // 요약: // // 메시지 상자에 예 및 아니요 단추가 있습니다. // YesNo = 4, // // // // 요약: // // 메시지 상자에 다시 시도 및 취소 단추가 있습니다. // RetryCancel = 5, //} public static DialogResult MessageBoxPopup_Dialog(MessageBoxButtons Type, string Message, string ButtonText) { return MessageBox.Show(Message, ButtonText, Type); } public static void MessageBoxPopup(MessageBoxButtons Type, string Message, string ButtonText) { MessageBox.Show(Message, ButtonText, Type); } /// /// 모달리스 메세지 박스 (팝업 윈도우를 동적 생성함) /// 팝업창을 닫지 않아도 부모에 제어권이 유지되는 장점이 있지만, 종료 및 기타 이벤트 처리를 직접 구현해야하므로 타입에 맞게 이벤트 핸들러를 등록해야 함. /// 단,타입에 따라 배경색도 바뀌고 텍스트 글자 길이에 의해 가변적으로 창 사이즈가 변경된다 /// // 팝업창은 3가지 타입이 있다. // 1.알림 팝업 (버튼 : OK, 일반 / 복구 / 경보 에 의해 배경색이 변경) // 2.대화 팝업 (버튼 : Yes / NO , 사용자의 선택을 유도함) // 3.진행 팝업 (버튼 : OK, 시간 진행 혹은 작업 진행 순으로 진행바가 늘어남) // // 알림 팝업 (Confirm) // // 예시 //// 일반 팝업 // _Popup.Create(Popup_Type.Confirm,Popup_Style.Normal, _Text.OK, 250, 150, _Text.SaveDataInform,0); // // 복귀 팝업 // _Popup.Create(Popup_Type.Confirm,Popup_Style.Return, _Text.OK, 600, 150, "ㄴㅇ란ㅇ란ㅇㄹㄴㅇ러ㅏㅣㄴㅇ러ㅏㅣㄴㅇ러ㅏㅣㄴㅇㄹㄴㅇ러ㅏㅣㅓㅏㅣㄴㅇ러ㅏㅣ",0); //// 경보 팝업 // _Popup.Create(Popup_Type.Confirm,Popup_Style.Alarm, _Text.OK, 250, 150, _Text.SaveDataInform,0); // // 대화 팝업 (Dialog) // // 예시 //Form test = new Form(); //private void button2_Click(object sender, EventArgs e) //{ // // 대화 팝업 // test = _Popup.Create(Popup_Type.Dialog, Popup_Style.Normal, _Text.OK, 250, 150, _Text.SaveDataInform,0); // // 대화 팝업은 특별처리 // _Event.PopupClose_SendMessage_Event += new _Event.PopupClose_SendMessage_Handler(_Event_PopupClose_SendMessage_Event); //} //public void _Event_PopupClose_SendMessage_Event(object sender, object etc) //{ // // 대화 팝업 주체 // Form popup = (Form)sender; // if (test.Name == popup.Name && etc.ToString() == _Text.OK) // { // ; // } // // 대화 팝업은 특별처리 // _Event.PopupClose_SendMessage_Event -= new _Event.PopupClose_SendMessage_Handler(_Event_PopupClose_SendMessage_Event); //} // // 진행 팝업 (Progress) // // 예시 //Form_Popup tst = new Form(); //private void button2_Click(object sender, EventArgs e) //{ // // 진행 팝업 // test = _Popup.Create(Popup_Type.Progress, Popup_Style.Normal, _Text.OK, 250, 200, _Text.SaveDataInform, 10); //} //static int a = 0; //// 타이머 시작버튼 (기본 타이머 사용 , interval 은 250) //private void uiButton1_Click(object sender, EventArgs e) //{ // a = 0; // timer1.Start(); //} //// 타이머 tick 핸들러 //private void timer1_Tick(object sender, EventArgs e) //{ // // 클릭하면서 카운터가 증가한다 // _Event.ProgressPopupCount_SendMessage(test, ++a); //} // 모달리스 메세지 팝업중에 진행 팝업 타입에서만 사용하는 변수 // 진행 팝업 활성화 상태 public static bool ProcessPopup_Enable = false; // 진행 팝업 프로그레스바 총 프로세스 개수 public static int ProcessPopup_Processbar_AllCnt = 0; // 진행 팝업 프로그레스바 현재 프로세스 public static int ProcessPopup_Processbar_Cnt = 0; public static UIProgressBar ProcessPopup_progressbar = null; // 생성자 public static Form Create( Popup_Type Type, Popup_Style Style, string FormText, int FormWidth, int FormHeight, string ContentsText, int ProgressbarAllcount) { // 진행타입 체크 (프로그레스바의 경우 진행중이엿다면 관련 변수는 모두 초기화하고 진행한다) // cyim 2013.5.27 if (Type == Popup_Type.Progress && (ProcessPopup_Enable == true || ProgressbarAllcount <= 0)) { ProcessPopup_Enable = false; ProcessPopup_Processbar_AllCnt = 0; ProcessPopup_Processbar_Cnt = 0; //return null; } // 팝업창 Form Popup = new Form(); // 폼 스타일에 의하여 아래의 변수가 변경됨 Office2007ColorScheme HeaderScheme = Office2007ColorScheme.Default; Color HeaderColor = new Color(); //Color FormBackground = new Color(); Janus.Windows.UI.Dock.PanelVisualStyle GroupBoxPanelStyle = Janus.Windows.UI.Dock.PanelVisualStyle.Office2007; Janus.Windows.UI.Office2007ColorScheme ButtonScheme = Janus.Windows.UI.Office2007ColorScheme.Default; switch (Style) { case Popup_Style.Normal: if (_Data.Style_VisualStyle == Janus.Windows.UI.VisualStyle.Office2007) { HeaderScheme = Office2007ColorScheme.Custom; HeaderColor = System.Drawing.SystemColors.GradientInactiveCaption; //FormBackground = System.Drawing.SystemColors.InactiveCaptionText; GroupBoxPanelStyle = Janus.Windows.UI.Dock.PanelVisualStyle.Office2007; ButtonScheme = Janus.Windows.UI.Office2007ColorScheme.Blue; } else if (_Data.Style_VisualStyle == Janus.Windows.UI.VisualStyle.Office2003) { HeaderScheme = Office2007ColorScheme.Custom; HeaderColor = System.Drawing.SystemColors.GradientInactiveCaption; //FormBackground = System.Drawing.SystemColors.InactiveCaptionText; GroupBoxPanelStyle = Janus.Windows.UI.Dock.PanelVisualStyle.Office2003; ButtonScheme = Janus.Windows.UI.Office2007ColorScheme.Blue; } else if (_Data.Style_VisualStyle == Janus.Windows.UI.VisualStyle.Standard) { HeaderScheme = Office2007ColorScheme.Custom; HeaderColor = System.Drawing.Color.DarkGray; //FormBackground = System.Drawing.SystemColors.Control; GroupBoxPanelStyle = Janus.Windows.UI.Dock.PanelVisualStyle.Standard; ButtonScheme = Janus.Windows.UI.Office2007ColorScheme.Default; } else if (_Data.Style_VisualStyle == Janus.Windows.UI.VisualStyle.VS2005) { HeaderScheme = Office2007ColorScheme.Custom; HeaderColor = System.Drawing.Color.LightGray; //FormBackground = System.Drawing.SystemColors.ControlLight; GroupBoxPanelStyle = Janus.Windows.UI.Dock.PanelVisualStyle.VS2005; ButtonScheme = Janus.Windows.UI.Office2007ColorScheme.Default; } else { HeaderScheme = Office2007ColorScheme.Custom; HeaderColor = System.Drawing.SystemColors.GradientInactiveCaption; //FormBackground = System.Drawing.SystemColors.InactiveCaptionText; GroupBoxPanelStyle = Janus.Windows.UI.Dock.PanelVisualStyle.Office2007; ButtonScheme = Janus.Windows.UI.Office2007ColorScheme.Default; } break; case Popup_Style.Alarm: HeaderScheme = Office2007ColorScheme.Custom; HeaderColor = Color.Red; //FormBackground = Color.Tomato; GroupBoxPanelStyle = Janus.Windows.UI.Dock.PanelVisualStyle.Office2007; ButtonScheme = Janus.Windows.UI.Office2007ColorScheme.Custom; break; case Popup_Style.Return: HeaderScheme = Office2007ColorScheme.Custom; HeaderColor = Color.Gold; //FormBackground = Color.LemonChiffon; GroupBoxPanelStyle = Janus.Windows.UI.Dock.PanelVisualStyle.Office2007; ButtonScheme = Janus.Windows.UI.Office2007ColorScheme.Custom; break; } // 위치 : 가운데 생성 Popup.StartPosition = FormStartPosition.CenterScreen; // 폼텍스트 Popup.Text = FormText; // 폼크기 Popup.Size = new Size(FormWidth + ContentsText.Length, FormHeight); // 제일 위로 보이게 한다 Popup.TopMost = true; // 폼의 배경색 Popup.BackColor = System.Drawing.SystemColors.Control; //FormBackground // 폼의 컨트롤박스는 삭제 Popup.ControlBox = false; // 폼 사이즈 변경 금지 Popup.FormBorderStyle = FormBorderStyle.FixedSingle; // 폼 키이벤트 추가 Popup.KeyPreview = true; Popup.KeyDown += new KeyEventHandler(Popup_KeyDown); // 옵션 (OfficeFormAdorner 추가) OfficeFormAdorner FormAdorner = new OfficeFormAdorner(); FormAdorner.Form = Popup; FormAdorner.Office2007ColorScheme = HeaderScheme; FormAdorner.Office2007CustomColor = HeaderColor; // 옵션 (그룹박스 추가) UIGroupBox uiGroupBox = new UIGroupBox(); uiGroupBox.BackgroundStyle = Janus.Windows.EditControls.BackgroundStyle.Panel; uiGroupBox.BorderColor = System.Drawing.Color.Transparent; uiGroupBox.Dock = System.Windows.Forms.DockStyle.Fill; //uiGroupBox.Location = new System.Drawing.Point(0, 0); uiGroupBox.Name = "uiGroupBox"; //uiGroupBox.Size = new System.Drawing.Size(781, 442); uiGroupBox.TabIndex = 0; uiGroupBox.VisualStyle = GroupBoxPanelStyle; // 옵션 (라벨추가) Label label = new Label(); // 글자 label.Text = ContentsText; // 배경색 label.BackColor = System.Drawing.Color.Transparent; // 라벨은 사이즈는 가변 label.AutoSize = true; // 폼에 포함 //Popup.Controls.Add(label); uiGroupBox.Controls.Add(label); // 팝업 태그에 라벨 추가 Popup.Tag = label; // 옵션 (확인버튼추가) UIButton button_OK = new UIButton(); // 이름 button_OK.Name = "button_OK"; // 글자 if (Type == Popup_Type.Dialog) button_OK.Text = _Text.Yes; else button_OK.Text = _Text.OK; // 부모 지정 button_OK.Tag = Popup; // 스타일 지정 button_OK.VisualStyle = _Data.Style_VisualStyle; // 색지정 button_OK.Office2007ColorScheme = ButtonScheme; button_OK.Office2007CustomColor = HeaderColor; // 이벤트 핸들러 등록 if (Type == Popup_Type.Progress) button_OK.Click += new EventHandler(Progress_OK_Click); else button_OK.Click += new EventHandler(Button_OK_Click); // 버튼 보여주기 속성 if (Type == Popup_Type.ConfirmNoBtn) button_OK.Visible = false; // 폼에 포함 //Popup.Controls.Add(button_OK); uiGroupBox.Controls.Add(button_OK); // 옵션 (취소버튼추가) UIButton button_Cancle = new UIButton(); if (Type == Popup_Type.Dialog) { // 이름 button_Cancle.Name = "button_Cancle"; // 글자 button_Cancle.Text = _Text.No; // 부모 지정 button_Cancle.Tag = Popup; // 스타일 지정 button_Cancle.VisualStyle = _Data.Style_VisualStyle; // 색지정 button_Cancle.Office2007ColorScheme = ButtonScheme; button_Cancle.Office2007CustomColor = HeaderColor; // 이벤트 핸들러 등록 button_Cancle.Click += new EventHandler(Button_Cancle_Click); // 폼에 포함 //Popup.Controls.Add(button_Cancle); uiGroupBox.Controls.Add(button_Cancle); } // 옵션 (진행 프로그레스바 추가) if (Type == Popup_Type.Progress) { // 관련 COM 변수 메모리 할당 ProcessPopup_progressbar = new UIProgressBar(); // 진행팝업창은 중간에 확인 버튼을 누를수가 없다 button_OK.Enabled = false; // 총 진행개수 ProcessPopup_Processbar_AllCnt = ProgressbarAllcount; // 현재 진행개수 초기화 ProcessPopup_Processbar_Cnt = 0; // 시작 ProcessPopup_Enable = true; // 진행 ProcessPopup_progressbar.Value = 0; // 부모 지정 ProcessPopup_progressbar.Tag = Popup; // 스타일 지정 ProcessPopup_progressbar.VisualStyle = _Data.Style_VisualStyle; // 색지정 ProcessPopup_progressbar.Office2007ColorScheme = ButtonScheme; ProcessPopup_progressbar.Office2007CustomColor = HeaderColor; // 진행바 크기 ProcessPopup_progressbar.Width = Popup.Width / 3 * 2; ProcessPopup_progressbar.Height = 30; // 카운트 이벤트 핸들로 등록 _Event.ProgressPopupCount_SendMessage_Event += new _Event.ProgressPopupCount_SendMessage_Handler(_Event_ProgressPopupCount_SendMessage_Event); // 폼에 포함 //Popup.Controls.Add(ProcessPopup_progressbar); uiGroupBox.Controls.Add(ProcessPopup_progressbar); } // 보여주기 Popup.StartPosition = FormStartPosition.CenterScreen; Popup.Controls.Add(uiGroupBox);// 그룹박스 추가 Popup.Show(); // 위치 정보 switch (Type) { case Popup_Type.Confirm: case Popup_Type.ConfirmNoBtn: // 라벨 위치 label.Location = new System.Drawing.Point((Popup.Width - label.Width) / 2, (Popup.Height - label.Height) / 4 * 1); // 확인 버튼 위치 button_OK.Location = new System.Drawing.Point((Popup.Width - button_OK.Width) / 2 * 1, (Popup.Height - button_OK.Height) / 8 * 5); break; case Popup_Type.Dialog: // 라벨 위치 label.Location = new System.Drawing.Point((Popup.Width - label.Width) / 2, (Popup.Height - label.Height) / 4 * 1); // 확인 버튼 위치 button_OK.Location = new System.Drawing.Point((Popup.Width / 2) - 80, (Popup.Height - button_OK.Height) / 9 * 5); // 취소 버튼 위치 button_Cancle.Location = new System.Drawing.Point((Popup.Width / 2) + 5 / 11 * 8, (Popup.Height - button_OK.Height) / 9 * 5); break; case Popup_Type.Progress: // 라벨 위치 label.Location = new System.Drawing.Point((Popup.Width - label.Width) / 2, (Popup.Height - label.Height) / 5 * 1); // 프로그레스바 위치 ProcessPopup_progressbar.Location = new System.Drawing.Point((Popup.Width - ProcessPopup_progressbar.Width) / 2 * 1, (Popup.Height - ProcessPopup_progressbar.Height) / 9 * 4); // 확인 버튼 위치 button_OK.Location = new System.Drawing.Point((Popup.Width - button_OK.Width) / 2 * 1, (Popup.Height - button_OK.Height) / 7 * 5); break; } // 버튼 포커스 해결 label.Focus(); // 업데이트 Popup.Update(); // 팝업창 정보 리턴 return Popup; } // 확인 버튼을 누르는 경우 public static void Button_OK_Click(object sender, EventArgs e) { // 버튼 정보 UIButton senderForm = (UIButton)sender; // 버튼의 태그를 이용하여 폼정보 받아옴 Form poupup = (Form)senderForm.Tag; // 잔상 정리 poupup.Hide(); // 이벤트 발생 _Event.PopupClose_SendMessage(poupup, _Text.OK); // 폼종료 poupup.Close(); } // 취소 버튼을 누르는 경우 public static void Button_Cancle_Click(object sender, EventArgs e) { // 버튼 정보 UIButton senderForm = (UIButton)sender; // 버튼의 태그를 이용하여 폼정보 받아옴 Form poupup = (Form)senderForm.Tag; // 잔상 정리 poupup.Hide(); // 이벤트 발생 _Event.PopupClose_SendMessage(poupup, _Text.Cancle); // 폼종료 poupup.Close(); } // 프로그레스 팝업 확인 버튼을 누르는 경우 public static void Progress_OK_Click(object sender, EventArgs e) { // 버튼 정보 UIButton senderForm = (UIButton)sender; // 버튼의 태그를 이용하여 폼정보 받아옴 Form poupup = (Form)senderForm.Tag; // 잔상 정리 poupup.Hide(); // 이벤트 발생 _Event.PopupClose_SendMessage(poupup, _Text.OK); // 현재 진행개수 초기화 ProcessPopup_Processbar_Cnt = 0; // 총 진행개수 초기화 ProcessPopup_Processbar_AllCnt = 0; // 시작 ProcessPopup_Enable = false; // 진행 팝업 _Event.ProgressPopupCount_SendMessage_Event -= new _Event.ProgressPopupCount_SendMessage_Handler(_Event_ProgressPopupCount_SendMessage_Event); // 폼종료 poupup.Close(); } // 특별키 처리 (O : OK , P : Cancle) public static void Popup_KeyDown(object sender, KeyEventArgs e) { switch (e.KeyCode) { case Keys.O: { // 버튼의 태그를 이용하여 폼정보 받아옴 Form poupup = (Form)sender; // 잔상 정리 poupup.Hide(); // 이벤트 발생 _Event.PopupClose_SendMessage(poupup, _Text.OK); // 폼종료 poupup.Close(); } break; case Keys.P: { // 버튼의 태그를 이용하여 폼정보 받아옴 Form poupup = (Form)sender; // 잔상 정리 poupup.Hide(); // 이벤트 발생 _Event.PopupClose_SendMessage(poupup, _Text.Cancle); // 폼종료 poupup.Close(); } break; } } // 팝업 셋팅을 위한 전용 델리게이트 delegate void Popup_SetCallback(object sender, object etc); // 이벤트로 인하여 진행됨 public static void _Event_ProgressPopupCount_SendMessage_Event(object sender, object etc) { // 카운터가 증가하면 포커스가 여기로 Form popup = (Form)sender; if (popup == null) return; if (popup.InvokeRequired) { Popup_SetCallback d = new Popup_SetCallback(_Event_ProgressPopupCount_SendMessage_Event); popup.Invoke(d, new object[] { sender, etc }); } else { popup.TopMost = true; popup.Focus(); // 값 ProcessPopup_Processbar_Cnt = (int)etc; // 전체 진행개수가 더 작다면 동작 안함 if (ProcessPopup_Processbar_Cnt <= ProcessPopup_Processbar_AllCnt) { // 진행바 표시 ProcessPopup_progressbar.Value = (int)((ProcessPopup_Processbar_Cnt * 100) / ProcessPopup_Processbar_AllCnt); // 진행바가 모두 진행되면 타이머종료 if (ProcessPopup_progressbar.Value >= 100) { // 진행팝업창은 중간에 확인 버튼을 누를수가 없지만 진행이 완료되면 해제 된다 Control[] Btn = popup.Controls.Find("button_OK", true); ((UIButton)Btn[0]).Enabled = true; // 팝업창의 라벨정보를 얻음 Label label = (Label)(popup.Tag); // 완료되었습니다 label.Text = _Data.Result_Text; // 라벨 위치 label.Location = new System.Drawing.Point((popup.Width - label.Width) / 2, (popup.Height - label.Height) / 5 * 1); } } } } } // // 특별히 다이얼로그 (예: 사용자에게 예 혹은 아니오 묻는경우)의 경우에 한해서 특별처리를 위함, 반드시 Popup_Type.Dialog 에서만 사용하도록한다 // public static class _PopupDialog { // 중복 처리 public static string DialogPopupText = null; // 팝업창에 종료 핸들러 추가 public static Form Create( Popup_Type Type, Popup_Style Style, string FormText, int FormWidth, int FormHeight, string ContentsText, _Event.PopupClose_SendMessage_Handler PopupClose_Func ) { // 팝업창 Form Popup = new Form(); // 특별처리 다이얼로그 팝업창 (사용자의 예,아니오 선택을 유도하는 팝업창)의 경우 불필요한 중복 클릭을 방지하기 위하여 동일한 텍스트가 들어오면 못하게 방지한다 // 나머지 알림의 팝업창은 중복여부와는 상관없이 활성화되도록 한다 if (Type == Popup_Type.Dialog) { if (DialogPopupText == ContentsText) return Popup; else DialogPopupText = ContentsText; } else return Popup; // 나머지 타입은 받아들일수 없다 if (PopupClose_Func != null) { // 폼닫을때 발생하는 이벤트 해제를 위하여 함수포인터 등록 Popup.Tag = PopupClose_Func; // 폼닫기 이벤트 등록 Popup.FormClosing += new FormClosingEventHandler(CreateForm_FormClosing); // 폼닫을때 발생하는 이벤트 등록 _Event.PopupClose_SendMessage_Event += new _Event.PopupClose_SendMessage_Handler(PopupClose_Func); } // 폼 스타일에 의하여 아래의 변수가 변경됨 Office2007ColorScheme HeaderScheme = Office2007ColorScheme.Default; Color HeaderColor = new Color(); //Color FormBackground = new Color(); Janus.Windows.UI.Dock.PanelVisualStyle GroupBoxPanelStyle = Janus.Windows.UI.Dock.PanelVisualStyle.Office2007; Janus.Windows.UI.Office2007ColorScheme ButtonScheme = Janus.Windows.UI.Office2007ColorScheme.Default; switch (Style) { case Popup_Style.Normal: if (_Data.Style_VisualStyle == Janus.Windows.UI.VisualStyle.Office2007) { HeaderScheme = Office2007ColorScheme.Custom; HeaderColor = System.Drawing.SystemColors.GradientInactiveCaption; //FormBackground = System.Drawing.SystemColors.InactiveCaptionText; GroupBoxPanelStyle = Janus.Windows.UI.Dock.PanelVisualStyle.Office2007; ButtonScheme = Janus.Windows.UI.Office2007ColorScheme.Blue; } else if (_Data.Style_VisualStyle == Janus.Windows.UI.VisualStyle.Office2003) { HeaderScheme = Office2007ColorScheme.Custom; HeaderColor = System.Drawing.SystemColors.GradientInactiveCaption; //FormBackground = System.Drawing.SystemColors.InactiveCaptionText; GroupBoxPanelStyle = Janus.Windows.UI.Dock.PanelVisualStyle.Office2003; ButtonScheme = Janus.Windows.UI.Office2007ColorScheme.Blue; } else if (_Data.Style_VisualStyle == Janus.Windows.UI.VisualStyle.Standard) { HeaderScheme = Office2007ColorScheme.Custom; HeaderColor = System.Drawing.Color.DarkGray; //FormBackground = System.Drawing.SystemColors.Control; GroupBoxPanelStyle = Janus.Windows.UI.Dock.PanelVisualStyle.Standard; ButtonScheme = Janus.Windows.UI.Office2007ColorScheme.Default; } else if (_Data.Style_VisualStyle == Janus.Windows.UI.VisualStyle.VS2005) { HeaderScheme = Office2007ColorScheme.Custom; HeaderColor = System.Drawing.Color.LightGray; //FormBackground = System.Drawing.SystemColors.ControlLight; GroupBoxPanelStyle = Janus.Windows.UI.Dock.PanelVisualStyle.VS2005; ButtonScheme = Janus.Windows.UI.Office2007ColorScheme.Default; } else { HeaderScheme = Office2007ColorScheme.Custom; HeaderColor = System.Drawing.SystemColors.GradientInactiveCaption; //FormBackground = System.Drawing.SystemColors.InactiveCaptionText; GroupBoxPanelStyle = Janus.Windows.UI.Dock.PanelVisualStyle.Office2007; ButtonScheme = Janus.Windows.UI.Office2007ColorScheme.Default; } break; case Popup_Style.Alarm: HeaderScheme = Office2007ColorScheme.Custom; HeaderColor = Color.Red; //FormBackground = Color.Tomato; GroupBoxPanelStyle = Janus.Windows.UI.Dock.PanelVisualStyle.Office2007; ButtonScheme = Janus.Windows.UI.Office2007ColorScheme.Custom; break; case Popup_Style.Return: HeaderScheme = Office2007ColorScheme.Custom; HeaderColor = Color.Gold; //FormBackground = Color.LemonChiffon; GroupBoxPanelStyle = Janus.Windows.UI.Dock.PanelVisualStyle.Office2007; ButtonScheme = Janus.Windows.UI.Office2007ColorScheme.Custom; break; } // 위치 : 가운데 생성 Popup.StartPosition = FormStartPosition.CenterScreen; // 폼텍스트 Popup.Text = FormText; // 동적으로 팝업창 사이즈 변경 FormWidth = ContentsText.Length * 10 + 100; // 폼크기 Popup.Size = new Size(FormWidth + ContentsText.Length, FormHeight); // 제일 위로 보이게 한다 Popup.TopMost = true; // 폼의 배경색 Popup.BackColor = System.Drawing.SystemColors.Control; //FormBackground // 폼의 컨트롤박스는 삭제 Popup.ControlBox = false; // 폼 사이즈 변경 금지 Popup.FormBorderStyle = FormBorderStyle.FixedSingle; Popup.MaximizeBox = false; // 옵션 (OfficeFormAdorner 추가) OfficeFormAdorner FormAdorner = new OfficeFormAdorner(); FormAdorner.Form = Popup; FormAdorner.Office2007ColorScheme = HeaderScheme; FormAdorner.Office2007CustomColor = HeaderColor; // 옵션 (그룹박스 추가) UIGroupBox uiGroupBox = new UIGroupBox(); uiGroupBox.BackgroundStyle = Janus.Windows.EditControls.BackgroundStyle.Panel; uiGroupBox.BorderColor = System.Drawing.Color.Transparent; uiGroupBox.Dock = System.Windows.Forms.DockStyle.Fill; //uiGroupBox.Location = new System.Drawing.Point(0, 0); uiGroupBox.Name = "uiGroupBox"; //uiGroupBox.Size = new System.Drawing.Size(781, 442); uiGroupBox.TabIndex = 0; uiGroupBox.VisualStyle = GroupBoxPanelStyle; // 옵션 (라벨추가) Label label = new Label(); // 글자 label.Text = ContentsText; // 배경색 label.BackColor = System.Drawing.Color.Transparent; // 라벨은 사이즈는 가변 label.AutoSize = true; // 폼에 포함 //Popup.Controls.Add(label); uiGroupBox.Controls.Add(label); // 팝업 태그에 라벨 추가 //Popup.Tag = label; // 옵션 (확인버튼추가) UIButton button_OK = new UIButton(); // 이름 button_OK.Name = "button_OK"; // 글자 if (Type == Popup_Type.Dialog) button_OK.Text = _Text.Yes; else button_OK.Text = _Text.OK; // 부모 지정 button_OK.Tag = Popup; // 스타일 지정 button_OK.VisualStyle = _Data.Style_VisualStyle; // 색지정 button_OK.Office2007ColorScheme = ButtonScheme; button_OK.Office2007CustomColor = HeaderColor; // 이벤트 핸들러 등록 button_OK.Click += new EventHandler(Button_OK_Click); button_OK.HighlightActiveButton = false; // 버튼 보여주기 속성 if (Type == Popup_Type.ConfirmNoBtn) button_OK.Visible = false; // 폼에 포함 //Popup.Controls.Add(button_OK); uiGroupBox.Controls.Add(button_OK); // 옵션 (취소버튼추가) UIButton button_Cancle = new UIButton(); if (Type == Popup_Type.Dialog) { // 이름 button_Cancle.Name = "button_Cancle"; // 글자 button_Cancle.Text = _Text.No; // 부모 지정 button_Cancle.Tag = Popup; // 스타일 지정 button_Cancle.VisualStyle = _Data.Style_VisualStyle; // 색지정 button_Cancle.Office2007ColorScheme = ButtonScheme; button_Cancle.Office2007CustomColor = HeaderColor; // 이벤트 핸들러 등록 button_Cancle.Click += new EventHandler(Button_Cancle_Click); button_Cancle.HighlightActiveButton = false; // 폼에 포함 //Popup.Controls.Add(button_Cancle); uiGroupBox.Controls.Add(button_Cancle); } // 보여주기 Popup.StartPosition = FormStartPosition.CenterScreen; Popup.Controls.Add(uiGroupBox);// 그룹박스 추가 Popup.Show(); // // 위치 정보 // // 라벨 위치 label.Location = new System.Drawing.Point((Popup.Width - label.Width) / 2, (Popup.Height - label.Height) / 4 * 1); // 확인 버튼 위치 button_OK.Location = new System.Drawing.Point((Popup.Width / 2) - 80, (Popup.Height - button_OK.Height) / 9 * 5); // 취소 버튼 위치 button_Cancle.Location = new System.Drawing.Point((Popup.Width / 2) + 5 / 11 * 8, (Popup.Height - button_OK.Height) / 9 * 5); // 버튼 포커스 해결 label.Focus(); // 업데이트 Popup.Update(); // 팝업창 정보 리턴 return Popup; } public static void CreateForm_FormClosing(object sender, FormClosingEventArgs e) { Form form = (Form)sender; DialogPopupText = null;// 텍스트는 초기화 _Event.PopupClose_SendMessage_Event -= new _Event.PopupClose_SendMessage_Handler((_Event.PopupClose_SendMessage_Handler)form.Tag); } // 확인 버튼을 누르는 경우 public static void Button_OK_Click(object sender, EventArgs e) { // 버튼 정보 UIButton senderForm = (UIButton)sender; // 버튼의 태그를 이용하여 폼정보 받아옴 Form poupup = (Form)senderForm.Tag; // 잔상 정리 poupup.Hide(); // 이벤트 발생 _Event.PopupClose_SendMessage(poupup, _Text.OK); // 폼종료 poupup.Close(); } // 취소 버튼을 누르는 경우 public static void Button_Cancle_Click(object sender, EventArgs e) { // 버튼 정보 UIButton senderForm = (UIButton)sender; // 버튼의 태그를 이용하여 폼정보 받아옴 Form poupup = (Form)senderForm.Tag; // 잔상 정리 poupup.Hide(); // 이벤트 발생 _Event.PopupClose_SendMessage(poupup, _Text.Cancle); // 폼종료 poupup.Close(); } } }