⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dlgfrmmsg.cs

📁 报刊广告管理系统。CSharp编写
💻 CS
字号:
using System;using System.Collections;using System.ComponentModel;using System.Drawing;using System.Windows.Forms;namespace WWAM.Forms.Dlg{	public class DlgFrmMsg : WWAM.Forms.Dlg.DlgBase	{
		#region DlgFrmMsg
		private System.Windows.Forms.RichTextBox txt;
		private System.Windows.Forms.PictureBox pic;
		private System.Windows.Forms.ImageList pics;		private System.ComponentModel.IContainer components = null;		public DlgFrmMsg()		{			// 该调用是 Windows 窗体设计器所必需的。			InitializeComponent();			// TODO: 在 InitializeComponent 调用后添加任何初始化		}		public DlgFrmMsg(Form form):base(form)		{			InitializeComponent();		}		/// <summary>		/// 清理所有正在使用的资源。		/// </summary>		protected override void Dispose( bool disposing )		{			if( disposing )			{				if (components != null) 				{					components.Dispose();				}			}			base.Dispose( disposing );		}		#region 设计器生成的代码		/// <summary>		/// 设计器支持所需的方法 - 不要使用代码编辑器修改		/// 此方法的内容。		/// </summary>		private void InitializeComponent()		{			this.components = new System.ComponentModel.Container();
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(DlgFrmMsg));
			this.txt = new System.Windows.Forms.RichTextBox();
			this.pic = new System.Windows.Forms.PictureBox();
			this.pics = new System.Windows.Forms.ImageList(this.components);
			this.SuspendLayout();
			// 
			// btnAccept
			// 
			this.btnAccept.DialogResult = System.Windows.Forms.DialogResult.OK;
			this.btnAccept.Location = new System.Drawing.Point(136, 128);
			this.btnAccept.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Skin;
			this.btnAccept.LookAndFeel.UseWindowsXPTheme = false;
			this.btnAccept.Name = "btnAccept";
			// 
			// btnCancel
			// 
			this.btnCancel.Location = new System.Drawing.Point(232, 128);
			this.btnCancel.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Skin;
			this.btnCancel.LookAndFeel.UseWindowsXPTheme = false;
			this.btnCancel.Name = "btnCancel";
			// 
			// txt
			// 
			this.txt.BorderStyle = System.Windows.Forms.BorderStyle.None;
			this.txt.Location = new System.Drawing.Point(16, 16);
			this.txt.Name = "txt";
			this.txt.ReadOnly = true;
			this.txt.Size = new System.Drawing.Size(296, 96);
			this.txt.TabIndex = 2;
			this.txt.Text = "";
			// 
			// pic
			// 
			this.pic.Location = new System.Drawing.Point(16, 24);
			this.pic.Name = "pic";
			this.pic.Size = new System.Drawing.Size(32, 32);
			this.pic.TabIndex = 3;
			this.pic.TabStop = false;
			// 
			// pics
			// 
			this.pics.ColorDepth = System.Windows.Forms.ColorDepth.Depth24Bit;
			this.pics.ImageSize = new System.Drawing.Size(32, 32);
			this.pics.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("pics.ImageStream")));
			this.pics.TransparentColor = System.Drawing.Color.Transparent;
			// 
			// DlgFrmMsg
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(322, 168);
			this.Controls.Add(this.txt);
			this.Controls.Add(this.pic);
			this.Name = "DlgFrmMsg";
			this.Controls.SetChildIndex(this.pic, 0);
			this.Controls.SetChildIndex(this.btnCancel, 0);
			this.Controls.SetChildIndex(this.btnAccept, 0);
			this.Controls.SetChildIndex(this.txt, 0);
			this.ResumeLayout(false);

		}		#endregion		#endregion
		#region Variable		bool cancelFouce = false;		#endregion				#region OnFromShow		protected override void OnFormShow()
		{
			base.OnFormShow ();
			if(cancelFouce && this.btnCancel.Visible)
			{
				this.btnCancel.Focus();
			}
			else
			{
				this.btnAccept.Focus();
			}
		}
		#endregion		#region ShowDialog		public DialogResult ShowDialog(string text, string caption, Icons icon, bool cancelBtn, bool cancelBtnFouce)		{			this.btnCancel.Visible = cancelBtn;
			this.cancelFouce = cancelBtnFouce;
			if(cancelBtn)
			{
				this.btnAccept.Location = new Point(136, 128);
			}
			else
			{
				this.btnAccept.Location = new Point(232, 128);
			}
			if(icon==Icons.None)
			{
				this.txt.Size = new Size(296,96);
				this.txt.Location = new Point(16,16);
				this.pic.Image = null;
			}
			else
			{
				this.txt.Size = new Size(256,96);
				this.txt.Location = new Point(56,16);
				this.pic.Image = this.pics.Images[(int)icon];
			}
			this.txt.Text = text;
			this.txt.BackColor = this.BackColor;
			this.Text = caption;
			return base.ShowDialog();
		}		#endregion		#region Show		#region Text		public DialogResult ShowText(string text, string caption)		{			return ShowDialog(text,caption,Icons.None,false,false);		}		public DialogResult ShowText(string text)		{			return ShowDialog(text,"",Icons.None,false,false);		}		#endregion		#region No		public DialogResult ShowNo(string text, string caption)		{			return ShowDialog(text,caption,Icons.No,false,false);		}		public DialogResult ShowNo(string text)		{			return ShowDialog(text,"错误",Icons.No,false,false);		}		#endregion		#region Info		public DialogResult ShowInfo(string text, string caption)		{			return ShowDialog(text,caption,Icons.Info,false,false);		}		public DialogResult ShowInfo(string text)		{			return ShowDialog(text,"信息",Icons.Info,false,false);		}		#endregion		#region Warning		public DialogResult ShowWarning(string text, string caption)		{			return ShowDialog(text,caption,Icons.Warning,false,false);		}		public DialogResult ShowWarning(string text)		{			return ShowDialog(text,"警告",Icons.Warning,false,false);		}		#endregion		#region Question		public DialogResult ShowQuestion(string text, string caption)		{			return ShowDialog(text,caption,Icons.Question,true,true);		}		public DialogResult ShowQuestion(string text)		{			return ShowDialog(text,"询问",Icons.Question,true,true);		}		#endregion		#endregion		#region Icons		public enum Icons : int		{			None = -1,			No = 0,			Info = 1,			Warning = 2,			Question = 3,		}		#endregion	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -