窗体颜色字体改变
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);
}
}
}
评论