private string _ButtonText(stMessageBox.Style style) { switch (style) { case Style.Error: { return(global::stUI.Properties.Resources.MboxErrorStr); } case Style.Info: { return(global::stUI.Properties.Resources.MboxInfoStr); } case Style.Allow: { return(global::stUI.Properties.Resources.MboxAllowStr); } case Style.Deny: { return(global::stUI.Properties.Resources.MboxDenyStr); } default: { return(global::stUI.Properties.Resources.MboxDefaultStr); } } }
private System.Windows.Forms.Form _Dialog(System.Windows.Forms.Control ctrl, stMessageBox.Style style, string msg, string btn, int sec) { if ( (ctrl == null) || (this._stMessageBoxGetForm(ctrl) == null) ) { throw new ArgumentNullException( string.Format( global::stUI.Properties.Resources.UIExceptionHead, global::stUI.Properties.Resources.UIExceptionParentIsNull ) ); } this.MboxButton.Text = ((string.IsNullOrEmpty(btn)) ? this._ButtonText(style) : btn ); this.MboxText.Text = ((string.IsNullOrEmpty(msg)) ? global::stUI.Properties.Resources.MboxDefaultMsg : msg ); this._Style(style); if (sec > 0) { this.stMessageBoxAutoClose(sec); } return(this.pForm); }
private static void _stMessageBoxInit(System.Windows.Forms.Control ctrl, object ostyle, string msg, string btn, int sec) { System.Windows.Forms.Form frm; if (ctrl == null) { return; } if ((stMessageBox._mBox = new stMessageBox()) == null) { throw new ArgumentNullException( string.Format( global::stUI.Properties.Resources.UIExceptionHead, global::stUI.Properties.Resources.MboxIsNull ) ); } stMessageBox.Style style = ((ostyle is stMessageBox.Style) ? (stMessageBox.Style)ostyle : stMessageBox.Style.Error); if ((frm = (System.Windows.Forms.Form)stMessageBox._mBox._Dialog(ctrl, style, msg, btn, sec)) == null) { return; } frm.Controls.Add(stMessageBox._mBox); stMessageBox._mBox.BringToFront(); stMessageBox._mBox.Update(); }
private void _Style(stMessageBox.Style style) { switch (style) { case Style.Error: { this.BackColor = this.MboxButton.BackColor = Color.Firebrick; this.MboxPicture.Image = global::stUI.Properties.Resources.MboxError; break; } case Style.Info: { this.BackColor = this.MboxButton.BackColor = Color.OliveDrab; this.MboxPicture.Image = global::stUI.Properties.Resources.MboxInfo; break; } case Style.Allow: { this.BackColor = this.MboxButton.BackColor = Color.Crimson; this.MboxPicture.Image = global::stUI.Properties.Resources.MboxAllow; break; } case Style.Deny: { this.BackColor = this.MboxButton.BackColor = Color.Goldenrod; this.MboxPicture.Image = global::stUI.Properties.Resources.MboxDeny; break; } default: { this.BackColor = this.MboxButton.BackColor = Color.Firebrick; this.MboxPicture.Image = global::stUI.Properties.Resources.MboxDefault; break; } } }