C#窗体-个人简历生成(自己设计并编写一个 Windows 应用程序,要求用到TextBox、GroupBox、RadioButton )

/*自己设计并编写一个 Windows 应用程序,要求用到
 * TextBox 文本框 显示简历内容
 * GroupBox 分组框
 * RadioButton 单选按钮 选择性别
 * CheckBox  多选框
 * ComboBox  组合框
 * ListBox  列表框
 * 控件。

 * 将程序功能、界面布局和运行结果的截图与事件代码写在实验报告中。 */

代码:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices; //文件对话框所需头文件

namespace _20153236_于博_sy3_2
{
    public partial class Form1 : Form
    {
        public Form1()  //窗体初始化结果
        {
            InitializeComponent();
            radioButton1.Checked = true;
            label8.Parent = pictureBox1;
            label8.BackColor = Color.Transparent;
            label9.Parent = pictureBox1;
            label9.BackColor = Color.Transparent;
            label10.Parent = pictureBox1;
            label10.BackColor = Color.Transparent;
            label11.Parent = pictureBox1;
            label11.BackColor = Color.Transparent;
            label12.Parent = pictureBox1;
            label12.BackColor = Color.Transparent;
            label13.Parent = pictureBox1;
            label13.BackColor = Color.Transparent;
            label14.Parent = pictureBox1;
            label14.BackColor = Color.Transparent;
            label15.Parent = pictureBox1;
            label15.BackColor = Color.Transparent;
            label16.Parent = pictureBox1;
            label16.BackColor = Color.Transparent;
            label17.Parent = pictureBox1;
            label17.BackColor = Color.Transparent;
            label18.Parent = pictureBox1;
            label18.BackColor = Color.Transparent;
            label19.Parent = pictureBox1;
            label19.BackColor = Color.Transparent;
            label20.Parent = pictureBox1;
            label20.BackColor = Color.Transparent;
        }
        private class BaseTextBox : TextBox
        {
            [DllImport("kernel32.dll", CharSet = CharSet.Auto)]
            private static extern IntPtr LoadLibrary(string lpFileName);
            protected override CreateParams CreateParams
            {
                get
                {
                    CreateParams prams = base.CreateParams;
                    if (LoadLibrary("msftedit.dll") != IntPtr.Zero)
                    {
                        prams.ExStyle |= 0x020; // transparent   
                        prams.ClassName = "RICHEDIT50W";
                    }
                    return prams;
                }
            }
        }  
        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void checkedListBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void checkBox3_CheckedChanged(object sender, EventArgs e)
        {

        }

        private void checkBox5_CheckedChanged(object sender, EventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {
            if (textBox2.Text != "") { label8.Text = textBox2.Text; }                                  //姓名
            else MessageBox.Show("姓名不能为空!\n");
            if (radioButton1.Checked) { label9.Text = radioButton1.Text; } //男
            if (radioButton2.Checked) { label9.Text = radioButton2.Text; } //女
            if (checkBox1.CheckState == CheckState.Checked) { label10.Text = checkBox1.Text; }//看书
            else label10.Text = "";
            if (checkBox2.CheckState == CheckState.Checked) { label11.Text = checkBox2.Text; }//编程
            else label11.Text = "";
            if (checkBox3.CheckState == CheckState.Checked) { label12.Text = checkBox3.Text; }//羽毛球
            else label12.Text = "";
            if (checkBox1.CheckState == CheckState.Unchecked && checkBox2.CheckState == CheckState.Unchecked && checkBox3.CheckState == CheckState.Unchecked) { MessageBox.Show("选个爱好吧!\n"); }
            if (comboBox1.Text != "") { label13.Text = comboBox1.Text; }//班级
            else MessageBox.Show("班级不能为空!\n");
            if (listBox1.Text != "") { label14.Text = listBox1.Text; } //座右铭
            else MessageBox.Show("选个座右铭吧!\n");
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {

        }

        private void checkBox2_CheckedChanged(object sender, EventArgs e)
        {

        }

     

        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {

        }

        private void groupBox1_Enter(object sender, EventArgs e)
        {

        }

        private void radioButton2_CheckedChanged(object sender, EventArgs e)
        {

        }

        private void radioButton1_CheckedChanged(object sender, EventArgs e)
        {
            
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {

        }

        private void button3_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                this.pictureBox1.Image = Image.FromFile(openFileDialog.FileName);
            }
            this.pictureBox1.ImageLocation = openFileDialog.FileName;
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void label6_Click(object sender, EventArgs e)
        {

        }

        private void label8_Click(object sender, EventArgs e)
        {

        }

        private void label13_Click(object sender, EventArgs e)
        {

        }

        private void label12_Click(object sender, EventArgs e)
        {

        }

        private void label14_Click(object sender, EventArgs e)
        {

        }

        private void label10_Click(object sender, EventArgs e)
        {

        }

        private void label20_Click(object sender, EventArgs e)
        {

        }

        private void label4_Click(object sender, EventArgs e)
        {

        }
    }
}
运行结果截图:

C#窗体-个人简历生成(自己设计并编写一个 Windows 应用程序,要求用到TextBox、GroupBox、RadioButton )_第1张图片


C#窗体-个人简历生成(自己设计并编写一个 Windows 应用程序,要求用到TextBox、GroupBox、RadioButton )_第2张图片

有问题请下方评论,转载请注明出处,并附有原文链接,谢谢!如有侵权,请及时联系。


你可能感兴趣的:(C#窗体-个人简历生成(自己设计并编写一个 Windows 应用程序,要求用到TextBox、GroupBox、RadioButton ))