namespace WindowsFormsApplication1
{
partial class Form1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.checkBox3 = new System.Windows.Forms.CheckBox();
this.checkBox2 = new System.Windows.Forms.CheckBox();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.radioButton2 = new System.Windows.Forms.RadioButton();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.label1 = new System.Windows.Forms.Label();
this.hScrollBar1 = new System.Windows.Forms.HScrollBar();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.checkBox3);
this.groupBox1.Controls.Add(this.checkBox2);
this.groupBox1.Controls.Add(this.checkBox1);
this.groupBox1.Location = new System.Drawing.Point(33, 149);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(275, 100);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "groupBox1";
//
// checkBox3
//
this.checkBox3.AutoSize = true;
this.checkBox3.Location = new System.Drawing.Point(182, 42);
this.checkBox3.Name = "checkBox3";
this.checkBox3.Size = new System.Drawing.Size(78, 16);
this.checkBox3.TabIndex = 5;
this.checkBox3.Text = "checkBox3";
this.checkBox3.UseVisualStyleBackColor = true;
this.checkBox3.CheckedChanged += new System.EventHandler(this.checkBox3_CheckedChanged);
//
// checkBox2
//
this.checkBox2.AutoSize = true;
this.checkBox2.Location = new System.Drawing.Point(98, 42);
this.checkBox2.Name = "checkBox2";
this.checkBox2.Size = new System.Drawing.Size(78, 16);
this.checkBox2.TabIndex = 4;
this.checkBox2.Text = "checkBox2";
this.checkBox2.UseVisualStyleBackColor = true;
this.checkBox2.CheckedChanged += new System.EventHandler(this.checkBox2_CheckedChanged);
//
// checkBox1
//
this.checkBox1.AutoSize = true;
this.checkBox1.Location = new System.Drawing.Point(17, 42);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(78, 16);
this.checkBox1.TabIndex = 3;
this.checkBox1.Text = "checkBox1";
this.checkBox1.UseVisualStyleBackColor = true;
this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
//
// groupBox2
//
this.groupBox2.Controls.Add(this.radioButton2);
this.groupBox2.Controls.Add(this.radioButton1);
this.groupBox2.Location = new System.Drawing.Point(332, 149);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(203, 100);
this.groupBox2.TabIndex = 1;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "groupBox2";
//
// radioButton2
//
this.radioButton2.AutoSize = true;
this.radioButton2.Location = new System.Drawing.Point(102, 46);
this.radioButton2.Name = "radioButton2";
this.radioButton2.Size = new System.Drawing.Size(95, 16);
this.radioButton2.TabIndex = 1;
this.radioButton2.TabStop = true;
this.radioButton2.Text = "radioButton2";
this.radioButton2.UseVisualStyleBackColor = true;
this.radioButton2.CheckedChanged += new System.EventHandler(this.radioButton2_CheckedChanged);
//
// radioButton1
//
this.radioButton1.AutoSize = true;
this.radioButton1.Location = new System.Drawing.Point(6, 46);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(95, 16);
this.radioButton1.TabIndex = 0;
this.radioButton1.TabStop = true;
this.radioButton1.Text = "radioButton1";
this.radioButton1.UseVisualStyleBackColor = true;
this.radioButton1.CheckedChanged += new System.EventHandler(this.radioButton1_CheckedChanged);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(31, 80);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(41, 12);
this.label1.TabIndex = 2;
this.label1.Text = "label1";
//
// hScrollBar1
//
this.hScrollBar1.Location = new System.Drawing.Point(33, 280);
this.hScrollBar1.Name = "hScrollBar1";
this.hScrollBar1.Size = new System.Drawing.Size(502, 17);
this.hScrollBar1.TabIndex = 3;
this.hScrollBar1.ValueChanged += new System.EventHandler(this.hScrollBar1_ValueChanged);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(577, 316);
this.Controls.Add(this.hScrollBar1);
this.Controls.Add(this.label1);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.CheckBox checkBox3;
private System.Windows.Forms.CheckBox checkBox2;
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.RadioButton radioButton2;
private System.Windows.Forms.RadioButton radioButton1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.HScrollBar hScrollBar1;
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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.Font = new Font("宋体",20);
groupBox1.Text = "字体样式";
groupBox2.Text = "字体";
checkBox1.Text = "斜体";
checkBox2.Text = "粗体";
checkBox3.Text = "下划线";
radioButton1.Text = "黑体";
radioButton2.Text = "楷体";
hScrollBar1.Maximum = 72;
hScrollBar1.Minimum = 4;
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
label1.Font = new Font(label1.Font.Name, label1.Font.Size, label1.Font.Style ^ FontStyle.Italic );
}
private void checkBox2_CheckedChanged(object sender, EventArgs e)
{
label1.Font = new Font(label1.Font.Name, label1.Font.Size, label1.Font.Style ^ FontStyle.Bold );
}
private void checkBox3_CheckedChanged(object sender, EventArgs e)
{
label1.Font = new Font(label1.Font.Name, label1.Font.Size, label1.Font.Style ^ FontStyle.Underline);
}
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
label1.Font = new Font("黑体", 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_ValueChanged(object sender, EventArgs e)
{
this.label1.Font = new Font(this.label1.Font.Name,
this.hScrollBar1.Value,
this.label1.Font.Style);
}
}
}