Initial commit
This commit is contained in:
		| @@ -0,0 +1,190 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.ComponentModel; | ||||
| using System.Data; | ||||
| using System.Drawing; | ||||
| using System.Linq; | ||||
| using System.Text; | ||||
| using System.Threading.Tasks; | ||||
| using System.Windows.Forms; | ||||
|  | ||||
| namespace Project | ||||
| { | ||||
|     public partial class fMsgWindow : Form | ||||
|     { | ||||
|         private Boolean fMove = false; | ||||
|         private Point MDownPos; | ||||
|         private string _msg = string.Empty; | ||||
|         public Boolean DialogMode = false; | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 사용자가 이 창을 닫을수 있는가? | ||||
|         /// </summary> | ||||
|         public Boolean EnableUserClose | ||||
|         { | ||||
|             get { return _enableuserclose; } | ||||
|             set | ||||
|             { | ||||
|                 _enableuserclose = value; | ||||
|                 // if (!EnableUserClose) btClose.Visible = false; | ||||
|             } | ||||
|         } | ||||
|         private Boolean _enableuserclose = true; | ||||
|      | ||||
|         public void setMessage(string msg) | ||||
|         { | ||||
|             //msg를 분리해서 표시를 한다. | ||||
|             var lbs = new arCtl.arLabel[] { lbTitle, lb1, lb2, lb3, lb4, lb5, lb6, lb7 }; | ||||
|             var lineBuf = msg.Replace("\r", "").Split('\n'); | ||||
|             int maxLine = Math.Min(lbs.Length, lineBuf.Length); | ||||
|  | ||||
|             for (int i = 0; i < lbs.Length; i++)   //최대줄을 넘어가는건 표시불가 | ||||
|             { | ||||
|                 if (i >= lineBuf.Length) | ||||
|                 { | ||||
|                     lbs[i].Text = string.Empty; | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     if (i > 0) lbs[i].Text = string.Format("{1}", i, lineBuf[i]); | ||||
|                     else lbs[i].Text = lineBuf[i]; | ||||
|                 } | ||||
|                  | ||||
|             } | ||||
|         } | ||||
|         //Dialog.fBlurPanel fb; | ||||
|         public fMsgWindow(string msg, string filename = "") | ||||
|         { | ||||
|             EnableUserClose = true; | ||||
|             InitializeComponent(); | ||||
|  | ||||
|             if (System.Diagnostics.Debugger.IsAttached == false) | ||||
|             { | ||||
|                 //fb = new Dialog.fBlurPanel(); | ||||
|                 //fb.Show(); | ||||
|             } | ||||
|         | ||||
|  | ||||
|             this.FormClosing += fMsgWindow_FormClosing; | ||||
|             this.KeyDown += (s1, e1) => { if (EnableUserClose && e1.KeyCode == Keys.Escape) this.Close(); }; | ||||
|             this._msg = msg; | ||||
|  | ||||
|  | ||||
|             if (filename != "") | ||||
|             { | ||||
|                 string fullname = AppDomain.CurrentDomain.BaseDirectory + "Image\\" + filename; | ||||
|                 if (System.IO.File.Exists(fullname)) | ||||
|                 { | ||||
|                     var img = this.lb1.BackgroundImage; | ||||
|                     this.lb1.BackgroundImage = Image.FromFile(fullname); | ||||
|                     if (img != null) img.Dispose(); | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     msg += "\nNo Image File\n" + filename; | ||||
|                 } | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 var img = this.lb1.BackgroundImage; | ||||
|                 this.lb1.BackgroundImage = null; | ||||
|                 if (img != null) img.Dispose(); | ||||
|             } | ||||
|             setMessage(msg); | ||||
|             this.lbTitle.MouseMove += label1_MouseMove; | ||||
|             lbTitle.MouseUp += label1_MouseUp; | ||||
|             lbTitle.MouseDown += label1_MouseDown; | ||||
|             lbTitle.MouseDoubleClick += label1_MouseDoubleClick; | ||||
|             this.VisibleChanged += FMsgWindow_VisibleChanged; | ||||
|             //btClose.Click += arLabel1_Click; | ||||
|         } | ||||
|  | ||||
|         private void FMsgWindow_VisibleChanged(object sender, EventArgs e) | ||||
|         { | ||||
|             //if (fb != null) | ||||
|             //{ | ||||
|             //    if (this.Visible) fb.Show(); | ||||
|             //    else fb.Hide(); | ||||
|             //} | ||||
|         } | ||||
|  | ||||
|         private void FMsgWindow_Shown(object sender, EventArgs e) | ||||
|         { | ||||
|             | ||||
|         } | ||||
|  | ||||
|         void fMsgWindow_FormClosing(object sender, FormClosingEventArgs e) | ||||
|         { | ||||
|             //if (fb != null) fb.Dispose(); | ||||
|             //if (DialogMode==false) | ||||
|             //{ | ||||
|             //    e.Cancel = true; | ||||
|             //    return; | ||||
|             //} | ||||
|         } | ||||
|  | ||||
|         private void fMsg_Load(object sender, EventArgs e) | ||||
|         { | ||||
|  | ||||
|         } | ||||
|  | ||||
|         private void label1_MouseMove(object sender, MouseEventArgs e) | ||||
|         { | ||||
|             if (fMove) | ||||
|             { | ||||
|                 Point offset = new Point(e.X - MDownPos.X, e.Y - MDownPos.Y); | ||||
|                 this.Left += offset.X; | ||||
|                 this.Top += offset.Y; | ||||
|                 offset = new Point(0, 0); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         private void label1_MouseUp(object sender, MouseEventArgs e) | ||||
|         { | ||||
|             fMove = false; | ||||
|         } | ||||
|  | ||||
|         private void label1_MouseDown(object sender, MouseEventArgs e) | ||||
|         { | ||||
|             MDownPos = new Point(e.X, e.Y); | ||||
|             fMove = true; | ||||
|         } | ||||
|  | ||||
|         private void label1_MouseDoubleClick(object sender, MouseEventArgs e) | ||||
|         { | ||||
|             if (EnableUserClose) | ||||
|             { | ||||
|                 if (DialogMode == false) | ||||
|                 { | ||||
|                     //if (fb != null) fb.Visible = false; | ||||
|                     this.Visible = false; | ||||
|                 } | ||||
|                 else this.Close(); | ||||
|             } | ||||
|                  | ||||
|         } | ||||
|  | ||||
|  | ||||
|         private void lbTitle_Click(object sender, EventArgs e) | ||||
|         { | ||||
|             if (EnableUserClose) | ||||
|             { | ||||
|                 if (DialogMode == false) | ||||
|                 { | ||||
|                     //if (fb != null) fb.Visible = false; | ||||
|                     this.Visible = false; | ||||
|  | ||||
|                 } | ||||
|                 else this.Close(); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         private void tmBlink_Tick(object sender, EventArgs e) | ||||
|         { | ||||
|             var bg1 = lbTitle.BackColor; | ||||
|             var bg2 = lbTitle.BackColor2; | ||||
|             lbTitle.BackColor = bg2; | ||||
|             lbTitle.BackColor2 = bg1; | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 ChiKyun Kim
					ChiKyun Kim