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);
}
}
}
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);
}
}
}
相关文章推荐
- :1)复选框中文字在左边;2)最下部为水平滚动条。水平滚动条最小值为4、最大值为72;且在窗体Load事件中通过代码设置;3)单击任何复选框,标签上文字样式都发生变化;4)单击任意单选按钮,标签上文字
- 窗体上有两个文本框:一个文本框中最多输入字符6个;一个文本框中输入任何内容都显示*号。再添加一个按钮、2个单选按钮。实现单击按钮后,根据单选按钮,将对应文本框中内容显示在标签
- 设置一个Label控件上文字的字体样式和字体大小随机的代码.
- 。窗体上有一个文本框(多行、且带有垂直滚动条)、一个标签(字体颜色红色、字号16)、一个按钮(该按钮被单击时,实现将文本框中选择文本复制至标签。
- java swing中实现列表中加入单选按钮,单选按钮发生变化时能触发事件
- 在窗体上增加一个按钮,并设置按钮显示文字为“结束程序”。单击该按钮显示如下消息框,若选择是,则结束程序,否则只是关闭消息框。
- Java 组件及事件处理实训 实训1: 编写一个窗体程序,能够对文本区中的文字设置字体和大小。
- 【java】事件监听——通过点击不同的按钮,让面板的背景色发生相应的变化
- Flex中通过textAlign样式在一个按钮(Button)控件中设置标签(label)对齐方式的例子
- Java中的事件处理—通过点击不同的按钮,让面板的背景色发生变化
- textView设置按下和焦点改变时让字体颜色发生变化
- html网页什么样的字体最好看,css设置各种中文字体样式代码
- 通过设置窗体的AcceptButton属性,可以设置窗体的“接受”按钮,若此设计,则用户每次按下Enter键都相当于单击该按钮
- C#--第11周实验--任务3--设计一个窗体,窗体上有两个文本框,一个按钮,2个单选按钮--实现单击按钮后,根据单选按钮,将对应文本框中内容显示在标签。
- android textview改变部分文字的颜色和string.xml中文字的替换及部分内容设置颜色、字体、超链接、图片
- 2014-05-13MFC对话框:改变MFC中按钮的文字,更改窗体的大小,通过类名能够查找到该类对应的对话框,MFC中获取文本框中的内容,updatedata函数,两种对话框比较,oncreate起点
- 设置一个Label控件上文字的字体样式和字体大小随机的代码
- android代码中设置EditText的hint字体大小而不改变EditText的文字大小
- MFC 通过发送消息完成按钮操作模拟鼠标单击事件的发生的问题
- textView可否设置按下和焦点改变时让字体颜色发生变化