日期:2014-05-17  浏览次数:20917 次

C#上机 第十周 单选按钮和复选框
/* 
* 程序头部注释开始   
* 程序的版权和版本声明部分   
* Copyright (c) 2011, 烟台大学计算机学院学生   
* All rights reserved.   
* 文件名称:单选按钮和复选框                        
* 作    者:薛广晨                               
* 完成日期:2012  年 11 月  12  日   
* 版 本号:x1.0            
   
* 对任务及求解方法的描述部分   
* 输入描述:  
* 问题描述: 
* 程序输出:   
* 程序头部的注释结束 
*/
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;

namespace WindowsFormsApplication3
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            label1.Text = "烟台大学";
            label1.AutoSize = true;
            label1.Font = new Font("宋体", 48, FontStyle.Regular);
        }

        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            label1.Font = new Font(label1.Font.Name, label1.Font.Size, checkBox1.Checked ? label1.Font.Style | FontStyle.Italic : label1.Font.Style ^ (FontStyle.Italic));
        }

        private void checkBox2_CheckedChanged(object sender, EventArgs e)
        {
            label1.Font = new Font(label1.Font.Name, label1.Font.Size, checkBox1.Checked ? label1.Font.Style | FontStyle.Underline : label1.Font.Style ^ (FontStyle.Underline));
        }

        private void radioButton1_CheckedChanged(object sender, EventArgs e)
        {
            label1.Font = new Font("楷体_GB2312", label1.Font.Size, label1.Font.Style);
        }

        private void radioButton2_CheckedChanged(object sender, EventArgs e)
        {
            label1.Font = new Font("宋体", label1.Font.Size, label1.Font.Style);
        }
    }
}


运行结果: