您的位置:首页 > Web前端 > CSS

1)复选框中文字在左边;2)水平滚动条最小值为4、最大值为72;且在窗体Load事件中通过代码设置;3)单击任何复选框,标签上文字样式都发生变化;4)单击任意单选按钮,标签上文字字体都发生改变;5)拖

2013-04-24 19:49 701 查看
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 WindowsFormsApplication1

{

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

            hScrollBar1.Maximum = 72;

            hScrollBar1.Minimum = 4;

        }

        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, checkBox2.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);

        }

        private void hScrollBar1_Scroll(object sender, ScrollEventArgs e)

        {

            label1.Font = new Font(label1 .Font.Name,hScrollBar1.Value,label1.Font.Style);

        }

    

    }

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐