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

📄 post.cs

📁 CSDN助手.net 由于csdn论坛改版
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace CSDN
{

	/// <summary>
	/// Post 的摘要说明。
	/// </summary>
	public class Post : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.TextBox textBox1;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.TextBox textBox2;
		private System.Windows.Forms.RadioButton radioButton1;
		private System.Windows.Forms.RadioButton radioButton2;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.TextBox textBox3;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.GroupBox groupBox2;
		private System.Windows.Forms.RadioButton radioButton3;
		private System.Windows.Forms.RadioButton radioButton4;
		private System.Windows.Forms.Button button2;
		private System.Windows.Forms.CheckBox checkBox1;
		private System.Windows.Forms.Button button3;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		ArrayList selectedForumList;
		private bool ok = false;

		public Post()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
		}

		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.button1 = new System.Windows.Forms.Button();
			this.textBox1 = new System.Windows.Forms.TextBox();
			this.label1 = new System.Windows.Forms.Label();
			this.textBox2 = new System.Windows.Forms.TextBox();
			this.radioButton1 = new System.Windows.Forms.RadioButton();
			this.radioButton2 = new System.Windows.Forms.RadioButton();
			this.label3 = new System.Windows.Forms.Label();
			this.textBox3 = new System.Windows.Forms.TextBox();
			this.label4 = new System.Windows.Forms.Label();
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.groupBox2 = new System.Windows.Forms.GroupBox();
			this.button2 = new System.Windows.Forms.Button();
			this.radioButton4 = new System.Windows.Forms.RadioButton();
			this.radioButton3 = new System.Windows.Forms.RadioButton();
			this.checkBox1 = new System.Windows.Forms.CheckBox();
			this.button3 = new System.Windows.Forms.Button();
			this.groupBox1.SuspendLayout();
			this.groupBox2.SuspendLayout();
			this.SuspendLayout();
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point(248, 264);
			this.button1.Name = "button1";
			this.button1.TabIndex = 0;
			this.button1.Text = "确定";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// textBox1
			// 
			this.textBox1.Location = new System.Drawing.Point(8, 120);
			this.textBox1.Multiline = true;
			this.textBox1.Name = "textBox1";
			this.textBox1.Size = new System.Drawing.Size(432, 136);
			this.textBox1.TabIndex = 1;
			this.textBox1.Text = "";
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(8, 70);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(40, 16);
			this.label1.TabIndex = 2;
			this.label1.Text = "标题:";
			// 
			// textBox2
			// 
			this.textBox2.Location = new System.Drawing.Point(48, 64);
			this.textBox2.Name = "textBox2";
			this.textBox2.Size = new System.Drawing.Size(392, 21);
			this.textBox2.TabIndex = 3;
			this.textBox2.Text = "";
			// 
			// radioButton1
			// 
			this.radioButton1.Checked = true;
			this.radioButton1.Location = new System.Drawing.Point(112, 16);
			this.radioButton1.Name = "radioButton1";
			this.radioButton1.Size = new System.Drawing.Size(88, 24);
			this.radioButton1.TabIndex = 5;
			this.radioButton1.TabStop = true;
			this.radioButton1.Text = "技术性问题";
			// 
			// radioButton2
			// 
			this.radioButton2.Location = new System.Drawing.Point(8, 16);
			this.radioButton2.Name = "radioButton2";
			this.radioButton2.TabIndex = 6;
			this.radioButton2.Text = "非技术性问题";
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(288, 101);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(64, 16);
			this.label3.TabIndex = 7;
			this.label3.Text = "贴子给分:";
			// 
			// textBox3
			// 
			this.textBox3.Location = new System.Drawing.Point(360, 96);
			this.textBox3.Name = "textBox3";
			this.textBox3.Size = new System.Drawing.Size(80, 21);
			this.textBox3.TabIndex = 8;
			this.textBox3.Text = "20";
			// 
			// label4
			// 
			this.label4.Location = new System.Drawing.Point(8, 96);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(40, 16);
			this.label4.TabIndex = 9;
			this.label4.Text = "内容:";
			// 
			// groupBox1
			// 
			this.groupBox1.Controls.AddRange(new System.Windows.Forms.Control[] {
																					this.radioButton2,
																					this.radioButton1});
			this.groupBox1.Location = new System.Drawing.Point(232, 8);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(208, 48);
			this.groupBox1.TabIndex = 11;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "帖子类型";
			// 
			// groupBox2
			// 
			this.groupBox2.Controls.AddRange(new System.Windows.Forms.Control[] {
																					this.button2,
																					this.radioButton4,
																					this.radioButton3});
			this.groupBox2.Location = new System.Drawing.Point(8, 8);
			this.groupBox2.Name = "groupBox2";
			this.groupBox2.Size = new System.Drawing.Size(216, 48);
			this.groupBox2.TabIndex = 12;
			this.groupBox2.TabStop = false;
			this.groupBox2.Text = "发贴方式:";
			// 
			// button2
			// 
			this.button2.Enabled = false;
			this.button2.Location = new System.Drawing.Point(128, 16);
			this.button2.Name = "button2";
			this.button2.Size = new System.Drawing.Size(80, 23);
			this.button2.TabIndex = 2;
			this.button2.Text = "论坛列表...";
			this.button2.Click += new System.EventHandler(this.button2_Click);
			// 
			// radioButton4
			// 
			this.radioButton4.Location = new System.Drawing.Point(72, 16);
			this.radioButton4.Name = "radioButton4";
			this.radioButton4.Size = new System.Drawing.Size(48, 24);
			this.radioButton4.TabIndex = 1;
			this.radioButton4.Text = "群发";
			this.radioButton4.CheckedChanged += new System.EventHandler(this.radioButton4_CheckedChanged);
			// 
			// radioButton3
			// 
			this.radioButton3.Checked = true;
			this.radioButton3.Location = new System.Drawing.Point(16, 16);
			this.radioButton3.Name = "radioButton3";
			this.radioButton3.Size = new System.Drawing.Size(48, 24);
			this.radioButton3.TabIndex = 0;
			this.radioButton3.TabStop = true;
			this.radioButton3.Text = "单发";
			// 
			// checkBox1
			// 
			this.checkBox1.Location = new System.Drawing.Point(192, 96);
			this.checkBox1.Name = "checkBox1";
			this.checkBox1.Size = new System.Drawing.Size(80, 24);
			this.checkBox1.TabIndex = 13;
			this.checkBox1.Text = "使用签名";
			// 
			// button3
			// 
			this.button3.Location = new System.Drawing.Point(336, 264);
			this.button3.Name = "button3";
			this.button3.TabIndex = 14;
			this.button3.Text = "取消";
			this.button3.Click += new System.EventHandler(this.button3_Click);
			// 
			// Post
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(450, 296);
			this.ControlBox = false;
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.button3,
																		  this.checkBox1,
																		  this.groupBox2,
																		  this.groupBox1,
																		  this.label4,
																		  this.textBox3,
																		  this.label3,
																		  this.textBox2,
																		  this.label1,
																		  this.textBox1,
																		  this.button1});
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
			this.Name = "Post";
			this.ShowInTaskbar = false;
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "发帖";
			this.Load += new System.EventHandler(this.Post_Load);
			this.groupBox1.ResumeLayout(false);
			this.groupBox2.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		private void Post_Load(object sender, System.EventArgs e)
		{
		
		}

		private void button1_Click(object sender, System.EventArgs e)
		{
			if(this.textBox2.Text == "")
				MessageBox.Show("title not allow null");
			else if(this.textBox1.Text == "")
				MessageBox.Show("content not allow null");
			else if(this.textBox3.Text == "")
				MessageBox.Show("point no allow null");
			else
			{
				try
				{
					Int32.Parse(this.textBox3.Text);
				}
				catch
				{
					MessageBox.Show("not number");
					return;
				}
				this.ok = true;
				Close();
			}
			
		}

		public bool OK
		{
			get
			{
				return ok;
			}
		}

		private void button3_Click(object sender, System.EventArgs e)
		{
			this.ok = false;
			Close();
		}

		public void SetPostRange()
		{
			this.radioButton3.Checked = false;
			this.radioButton4.Checked = true;

			this.button2.Enabled = true;
			this.radioButton3.Enabled = false;
		}

		private void radioButton4_CheckedChanged(object sender, System.EventArgs e)
		{
			if(this.radioButton4.Checked)
				this.button2.Enabled = true;
			else
				this.button2.Enabled = false;
		}

		private void button2_Click(object sender, System.EventArgs e)
		{
			ForumList forumList = new ForumList();
			forumList.ShowDialog();
			this.selectedForumList = forumList.SelectedForumList;
		}

		public ArrayList SelectedForumList
		{
			get
			{
				return selectedForumList;
			}
		}

		public int PostRange
		{
			get
			{
				if(this.radioButton3.Checked)
					return 1;
				else
					return 2;
			}
		}

		public int TypeState
		{
			get
			{
				if(this.radioButton1.Checked)
					return 1;
				else
					return 0;
			}
		}

		public string Title
		{
			get
			{
				return this.textBox2.Text;
			}
		}

		public string Content
		{
			get
			{
				return this.textBox1.Text;
			}
		}

		public int Point
		{
			get
			{
				return Int32.Parse(this.textBox3.Text);
			}
		}

		public bool AddMark
		{
			get
			{
				return this.checkBox1.Checked;
			}
		}
	}
}

⌨️ 快捷键说明

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