龙湖建设工程有限公司网站,中国最好的域名注册网站,有虚拟主机wordpress,南宁公司网站建设公司设置字体大小无法这么写#xff0c; button1.Font.Size 20#xff1b;
这个是只读属性#xff1b;
把字体大小改为16#xff0c; button2.Font new Font(button2.Font.Name, 16); 程序运行的时候先看一下窗体和控件的默认字体尺寸#xff0c;都是9#xff1b;然后点b…设置字体大小无法这么写 button1.Font.Size 20
这个是只读属性
把字体大小改为16 button2.Font new Font(button2.Font.Name, 16); 程序运行的时候先看一下窗体和控件的默认字体尺寸都是9然后点button4把button2的字体调为16结果如下 然后点button3把窗体的字体大小改为16再输出窗体和控件的字体大小结果如下 控件的字体也会同时变为16如果把窗体的字体调大窗体尺寸会变大
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 fontdemo
{public partial class Form1 : Form{public Form1(){InitializeComponent();}private void Form1_Load(object sender, EventArgs e){textBox1.Text this.Font.Size.ToString();textBox2.Text button1.Font.Size.ToString();}private void button4_Click(object sender, EventArgs e){button2.Font new Font(button2.Font.Name, 16);}private void button3_Click(object sender, EventArgs e){this.Font new Font(this.Font.Name, 16);textBox1.Text this.Font.Size.ToString();textBox2.Text button1.Font.Size.ToString();}}
}