在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
主窗体: 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 myone//命名空间 { public partial class mainform : Form//窗口 { public mainform()//界面 { InitializeComponent(); } //下面是业务逻辑、事件 //组合框时间 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { // string mess = comboBox1.SelectedItem.ToString(); comboBox2.SelectedItem = mess; listBox1.SelectedItem = mess; intext1.Text = mess; } //添加信息 private void button1_Click(object sender, EventArgs e) { } //退出 private void button4_Click(object sender, EventArgs e) { Application.Exit(); } // 取消 private void button3_Click(object sender, EventArgs e) { intext1.Enabled = false; listBox1.Enabled = false; } //确定 private void button2_Click(object sender, EventArgs e) { intext1.Enabled = true; listBox1.Enabled = true; comboBox1.SelectedIndex = 0; intext1.Focus(); } private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { linkLabel1.LinkVisited = true; Form2 newForm = new Form2(); newForm.Show(); this.Hide(); } private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { label7.Show(); } private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { label7.Hide(); } private void mainform_Load(object sender, EventArgs e) { this.listBox1.Items.Add("软件部"); this.listBox1.Items.Add("硬件部"); this.listBox1.Items.Add("财务部"); this.listBox1.Items.Add("人事部"); this.listBox1.SelectedIndex = 1; this.comboBox1.Items.Add("软件部"); this.comboBox1.Items.Add("硬件部"); this.comboBox1.Items.Add("财务部"); this.comboBox1.Items.Add("人事部"); this.comboBox1.SelectedIndex = 1; this.comboBox2.Items.Add("软件部"); this.comboBox2.Items.Add("硬件部"); this.comboBox2.Items.Add("财务部"); this.comboBox2.Items.Add("人事部"); this.comboBox2.SelectedIndex = 1; this.intext1.Text = "硬件部"; } private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { MessageBox.Show("您选择的部门是:"+listBox1.SelectedItem.ToString()+",位列第"+listBox1.SelectedIndex.ToString(),"信息提示"); } //窗口1 private void button5_Click(object sender, EventArgs e) { MessageBox.Show("简单提示!", "信息提示"); } //窗口2 private void button6_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("简单提示!", "信息提示",MessageBoxButtons.YesNo); if(result==DialogResult.Yes) { label1.Text = "您选择了图标YES"; } else { label1.Text = "您选择了图标NO"; } } //窗口3 private void button7_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("简单提示!", "信息提示", MessageBoxButtons.YesNoCancel,MessageBoxIcon.Question, MessageBoxDefaultButton.Button3,MessageBoxOptions.RightAlign); if(result ==DialogResult.Yes) { label1.Text="YES"; } else if(result== DialogResult.No) { label1.Text="NO"; } else if(result==DialogResult.Cancel) { label1.Text="CANCEL"; } } private void button9_Click(object sender, EventArgs e) { //mainform mf = new mainform(); business f2 = new business(); this.Visible = false; f2.ShowDialog(); // this.Visible = true;// } } } form2 : 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 myone { public partial class Form2 : Form { public Form2() { InitializeComponent(); } //返回主对话框 private void button1_Click(object sender, EventArgs e) { mainform firstform = new mainform(); firstform.Show(); this.Hide(); } //返回 private void toolStripButton1_Click(object sender, EventArgs e) { //返回后,窗体信息初始化 mainform firstform = new mainform(); firstform.Show(); this.Hide(); } //登陆 private void toolStripButton2_Click(object sender, EventArgs e) { business busform = new business(); busform.Show(); this.Hide(); } private void Clear() { zhanhao.Clear(); mima.Clear(); zhanhao.Focus(); } //登陆到主业务窗口 private void 登录ToolStripMenuItem_Click(object sender, EventArgs e) { if(zhanhao.Text == string.Empty || mima.Text == string.Empty) { MessageBox.Show("请出入登录信息!","登录出错"); Clear(); return; } if(!zhanhao.Text.Equals("admin")|| !mima.Text.Equals("admin")) { MessageBox.Show("用户名称和密码不正确!","登录提示"); Clear(); return; } else { business busform = new business(); busform.Show(); this.Hide(); } // //business busform = new business(); //busform.Show(); // this.Hide(); } private void 按钮ToolStripMenuItem_Click(object sender, EventArgs e) { } } } business:
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 myone { public partial class business : Form { public business() { InitializeComponent(); } private void 返回主界面ToolStripMenuItem_Click(object sender, EventArgs e) { mainform firform = new mainform(); firform.Show(); this.Hide(); } } }
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论