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)
        {

        }
    }
}
运行结果截图:



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


  • 12
    点赞
  • 71
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

lady_killer9

感谢您的打赏,我会加倍努力!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值