c# windows编程控件学习-1

 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 proj9_1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void button1_Click(object sender, EventArgs e)
{
Form myform = new Form1_1();
myform.ShowDialog(); } private void Form1_Load(object sender, EventArgs e)
{
//MessageBox.Show("3个按钮", "信息提示", MessageBoxButtons.AbortRetryIgnore);
listBox1.Items.Add("清华大学"); listBox1.Items.Add("北京大学");
listBox1.Items.Add("北京航空航天大学"); listBox1.Items.Add("人民大学");
listBox1.Items.Add("南京大学"); listBox1.Items.Add("武汉大学");
listBox1.Items.Add("山东大学"); listBox1.Items.Add("复旦大学");
enbutton();
} private void enbutton()
{
if (listBox1.Items.Count == )
{
button7.Enabled = false; button8.Enabled = false;
}
else
{
button7.Enabled = true; button8.Enabled = true;
}
if (listBox2.Items.Count == )
{
button9.Enabled = false; button10.Enabled = false;
}
else
{
button9.Enabled = true; button10.Enabled = true;
}
} private void button2_Click(object sender, EventArgs e)
{
Form myform = new Form1_2();
myform.Show();
} private void richTextBox1_TextChanged(object sender, EventArgs e)
{ } private void groupBox1_Enter(object sender, EventArgs e)
{ } private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
MessageBox.Show("3个按钮", "信息提示", MessageBoxButtons.AbortRetryIgnore);
} private void button3_Click(object sender, EventArgs e)
{
if (checkBox1.Checked && checkBox3.Checked && !checkBox2.Checked && !checkBox4.Checked)
{
MessageBox.Show("您答对了,真的很棒!!!", "信息提示", MessageBoxButtons.OK);
}
else
MessageBox.Show("您答错了,继续努力。", "信息提示", MessageBoxButtons.OK);
} private void button4_Click(object sender, EventArgs e)
{
if (radioButton3.Checked)
{
MessageBox.Show("您选对了", "提示", MessageBoxButtons.OK);
}
else if (radioButton1.Checked || radioButton4.Checked)
{
MessageBox.Show("您选错了", "提示", MessageBoxButtons.OKCancel);
}
else
{
MessageBox.Show("您选错了,这是数据库系统", "提示", MessageBoxButtons.OKCancel);
}
} private void button5_Click(object sender, EventArgs e)
{
pictureBox1.Image = Image.FromFile("E:\\flac3d.jpg"); } private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{ } private void button6_Click(object sender, EventArgs e)
{
if (textBox1.Text != "")
if (!comboBox1.Items.Contains(textBox1.Text))
comboBox1.Items.Add(textBox1);
} private void button7_Click(object sender, EventArgs e)
{
if (listBox1.SelectedIndex >= )
{
listBox2.Items.Add(listBox1.SelectedItem);
listBox1.Items.RemoveAt(listBox1.SelectedIndex);
}
enbutton();
}
private void button8_Click(object sender, EventArgs e)
{
foreach (var item in listBox1.Items)
{
listBox2.Items.Add(item);
}
enbutton();
listBox1.Items.Clear();
} }
}

c# windows编程控件学习-1

上一篇:mysql 插入汉字出现问号 解决方法


下一篇:(转)如何构建高性能,稳定SOA应用之-负载均衡-Decoupled Invocation(一)