📄 messagewrite.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace personal
{
/// <summary>
/// message 的摘要说明。
/// </summary>
public class messagewrite : System.Windows.Forms.Form
{
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.TextBox messagename;
private System.Windows.Forms.TextBox messageschool;
private System.Windows.Forms.TextBox messagespecial;
private System.Windows.Forms.TextBox messagefrom;
private System.Windows.Forms.TextBox messagelanguage;
private System.Windows.Forms.RadioButton rbnboy;
private System.Windows.Forms.RadioButton rbngirl;
private System.Windows.Forms.Button brewrite;
private System.Windows.Forms.Button btnwrite;
private System.Windows.Forms.RichTextBox rtbcontent;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public messagewrite()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(messagewrite));
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.messagename = new System.Windows.Forms.TextBox();
this.messageschool = new System.Windows.Forms.TextBox();
this.messagespecial = new System.Windows.Forms.TextBox();
this.messagefrom = new System.Windows.Forms.TextBox();
this.messagelanguage = new System.Windows.Forms.TextBox();
this.rbnboy = new System.Windows.Forms.RadioButton();
this.rbngirl = new System.Windows.Forms.RadioButton();
this.brewrite = new System.Windows.Forms.Button();
this.btnwrite = new System.Windows.Forms.Button();
this.rtbcontent = new System.Windows.Forms.RichTextBox();
this.SuspendLayout();
//
// pictureBox1
//
this.pictureBox1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBox1.BackgroundImage")));
this.pictureBox1.Location = new System.Drawing.Point(0, 0);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(360, 50);
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// label1
//
this.label1.Location = new System.Drawing.Point(16, 72);
this.label1.Name = "label1";
this.label1.TabIndex = 1;
this.label1.Text = "姓名";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label2
//
this.label2.Location = new System.Drawing.Point(16, 152);
this.label2.Name = "label2";
this.label2.TabIndex = 2;
this.label2.Text = "专业";
//
// label3
//
this.label3.Location = new System.Drawing.Point(16, 184);
this.label3.Name = "label3";
this.label3.TabIndex = 3;
this.label3.Text = "来自";
//
// label4
//
this.label4.Location = new System.Drawing.Point(16, 112);
this.label4.Name = "label4";
this.label4.TabIndex = 1;
this.label4.Text = "学校";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label5
//
this.label5.Location = new System.Drawing.Point(16, 224);
this.label5.Name = "label5";
this.label5.TabIndex = 3;
this.label5.Text = "性别";
//
// label6
//
this.label6.Location = new System.Drawing.Point(16, 264);
this.label6.Name = "label6";
this.label6.TabIndex = 3;
this.label6.Text = "人生格言";
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label7
//
this.label7.Location = new System.Drawing.Point(16, 304);
this.label7.Name = "label7";
this.label7.TabIndex = 3;
this.label7.Text = "生活目标";
//
// messagename
//
this.messagename.Location = new System.Drawing.Point(152, 72);
this.messagename.Name = "messagename";
this.messagename.TabIndex = 4;
this.messagename.Text = "";
//
// messageschool
//
this.messageschool.Location = new System.Drawing.Point(152, 104);
this.messageschool.Name = "messageschool";
this.messageschool.TabIndex = 4;
this.messageschool.Text = "";
//
// messagespecial
//
this.messagespecial.Location = new System.Drawing.Point(152, 152);
this.messagespecial.Name = "messagespecial";
this.messagespecial.TabIndex = 4;
this.messagespecial.Text = "";
//
// messagefrom
//
this.messagefrom.Location = new System.Drawing.Point(152, 184);
this.messagefrom.Name = "messagefrom";
this.messagefrom.TabIndex = 4;
this.messagefrom.Text = "";
//
// messagelanguage
//
this.messagelanguage.Location = new System.Drawing.Point(152, 272);
this.messagelanguage.Name = "messagelanguage";
this.messagelanguage.TabIndex = 4;
this.messagelanguage.Text = "";
//
// rbnboy
//
this.rbnboy.Image = ((System.Drawing.Image)(resources.GetObject("rbnboy.Image")));
this.rbnboy.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.rbnboy.Location = new System.Drawing.Point(216, 232);
this.rbnboy.Name = "rbnboy";
this.rbnboy.Size = new System.Drawing.Size(32, 24);
this.rbnboy.TabIndex = 5;
//
// rbngirl
//
this.rbngirl.Checked = true;
this.rbngirl.Image = ((System.Drawing.Image)(resources.GetObject("rbngirl.Image")));
this.rbngirl.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.rbngirl.Location = new System.Drawing.Point(152, 232);
this.rbngirl.Name = "rbngirl";
this.rbngirl.Size = new System.Drawing.Size(40, 24);
this.rbngirl.TabIndex = 5;
this.rbngirl.TabStop = true;
//
// brewrite
//
this.brewrite.Location = new System.Drawing.Point(192, 440);
this.brewrite.Name = "brewrite";
this.brewrite.Size = new System.Drawing.Size(72, 24);
this.brewrite.TabIndex = 6;
this.brewrite.Text = "重写";
//
// btnwrite
//
this.btnwrite.Location = new System.Drawing.Point(56, 440);
this.btnwrite.Name = "btnwrite";
this.btnwrite.Size = new System.Drawing.Size(72, 24);
this.btnwrite.TabIndex = 6;
this.btnwrite.Text = "提交";
this.btnwrite.Click += new System.EventHandler(this.btnwrite_Click);
//
// rtbcontent
//
this.rtbcontent.Location = new System.Drawing.Point(152, 312);
this.rtbcontent.Name = "rtbcontent";
this.rtbcontent.Size = new System.Drawing.Size(192, 96);
this.rtbcontent.TabIndex = 7;
this.rtbcontent.Text = "";
//
// messagewrite
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(235)), ((System.Byte)(246)), ((System.Byte)(255)));
this.ClientSize = new System.Drawing.Size(352, 470);
this.Controls.Add(this.rtbcontent);
this.Controls.Add(this.brewrite);
this.Controls.Add(this.rbnboy);
this.Controls.Add(this.messagename);
this.Controls.Add(this.messageschool);
this.Controls.Add(this.messagespecial);
this.Controls.Add(this.messagefrom);
this.Controls.Add(this.messagelanguage);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.label4);
this.Controls.Add(this.label5);
this.Controls.Add(this.label6);
this.Controls.Add(this.label7);
this.Controls.Add(this.rbngirl);
this.Controls.Add(this.btnwrite);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "messagewrite";
this.Text = "个人信息管理系统";
this.Load += new System.EventHandler(this.messagewrite_Load);
this.ResumeLayout(false);
}
#endregion
private void messagewrite_Load(object sender, System.EventArgs e)
{
}
private void brewrite_Click(object sender, System.EventArgs e)
{
messagename.Text="";
messageschool.Text="";
messagespecial.Text="";
messagefrom.Text="";
rtbcontent.Text="";
messagelanguage.Text="";
}
private void btnwrite_Click(object sender, System.EventArgs e)
{
if(messagename.Text==""||messageschool.Text==""||messagespecial.Text==""||messagefrom.Text==""||rtbcontent.Text==""||messagelanguage.Text=="")
{
MessageBox.Show("请填写完整信息!");
}
else
{
datalink mydl = new datalink();
string sex;
if (rbnboy.Checked==true)
sex="images/member_male.gif";
else
sex="imaged/member_female.gif";
string sql="insert into message(message_name,message_school,message_special,message_from,message_sex,message_language,message_target,message_time) values('"+messagename.Text+"','"+messageschool.Text+"','"+messagespecial.Text+"','"+messagefrom.Text+"','"+sex+"','"+messagelanguage.Text+"','"+rtbcontent.Text+"','"+DateTime.Now.ToString()+"')";
if (mydl.executesql(sql))
{
MessageBox.Show("信息录入成功!");
}
else
{
MessageBox.Show("信息录入失败!");
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -