找传奇、传世资源到传世资源站!

窗体颜色字体改变

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

窗体颜色字体改变
窗体颜色字体改变 C#语言基础-第1张
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 WindowsFormsApplication2
{
    public partial class Form1 : Form
    {
        private bool largeText, smallText;
        private string fontName = "Arial";
        public Form1()
        {
            InitializeComponent();
        }

        private void label4_Click(object sender, EventArgs e)
        {

        }

        private void Form1_Scroll(object sender, ScrollEventArgs e)
        {

        }

        private void label5_Click(object sender, EventArgs e)
        {

        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string cn = comboBox1.SelectedItem.ToString();
            pictureBox1.BackColor = Color.FromName(cn);
        }

        private void hScrollBar1_Scroll(object sender, ScrollEventArgs e)
        {
            pictureBox1.BackColor = Color.FromArgb(255,hScrollBar1.Value,hScrollBar2.Value,hScrollBar3.Value);
        }

        private void hScrollBar2_Scroll(object sender, ScrollEventArgs e)
        {
            pictureBox1.BackColor = Color.FromArgb(255, hScrollBar1.Value, hScrollBar2.Value,hScrollBar3.Value);
        }

        private void hScrollBar3_Scroll(object sender, ScrollEventArgs e)
        {
            pictureBox1.BackColor = Color.FromArgb(255, hScrollBar1.Value, hScrollBar2.Value,hScrollBar3.Value);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            tabPage1.BackColor = pictureBox1.BackColor;
            this.BackColor = pictureBox1.BackColor;
        }

        private void domainUpDown1_SelectedItemChanged(object sender, EventArgs e)
        {
            fontName = domainUpDown1.SelectedItem.ToString();
            if(largeText){
                label6.Font = new Font(fontName ,14);
            
            }
            else{
                label6.Font = new Font(fontName,8);
            }
        }

        private void radioButton1_CheckedChanged(object sender, EventArgs e)
        {
            largeText = true;
            smallText = false;
            label6.Font = new Font(fontName,14);
        }

        private void radioButton2_CheckedChanged(object sender, EventArgs e)
        {
            smallText = true;
            largeText = false;
            label6.Font = new Font(fontName,8);
        }    

       
       
    }
}

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复