Label / TextBox中单个字符的字体大小与预期不符

时间:2018-11-10 03:06:55

标签: c#

我正在使用Visual Studio编写中文GUI程序。

我已经在Visual Studio 2008和2017中测试了此字符。
在两个版本中都会发生此问题。

我使用的字符是\u6236)。
当字体大小为LabelTextBox,按钮文本之类的格式时,字体大小变小。
但是,在标题栏,状态栏或菜单栏中,字符的大小不会改变。

有人可以解释为什么会这样吗?

尚无法发布图片,因此我在此处放置了一个链接。
如您所见,只有此字符变小。

enter image description here

partial class Form1
{
    private void InitializeComponent()
    {
        this.components = new System.ComponentModel.Container();
        this.button1 = new System.Windows.Forms.Button();
        this.checkBox1 = new System.Windows.Forms.CheckBox();
        this.label1 = new System.Windows.Forms.Label();
        this.listView1 = new System.Windows.Forms.ListView();
        this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
        this.textBox1 = new System.Windows.Forms.TextBox();
        this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
        this.toolTip2 = new System.Windows.Forms.ToolTip(this.components);
        this.toolStrip1 = new System.Windows.Forms.ToolStrip();
        this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel();
        this.statusStrip1 = new System.Windows.Forms.StatusStrip();
        this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
        this.toolStrip1.SuspendLayout();
        this.statusStrip1.SuspendLayout();
        this.SuspendLayout();
        // 
        // button1
        // 
        this.button1.Location = new System.Drawing.Point(7, 131);
        this.button1.Name = "button1";
        this.button1.Size = new System.Drawing.Size(75, 23);
        this.button1.TabIndex = 0;
        this.button1.Text = "住戶";
        this.button1.UseVisualStyleBackColor = true;
        // 
        // checkBox1
        // 
        this.checkBox1.AutoSize = true;
        this.checkBox1.Location = new System.Drawing.Point(7, 160);
        this.checkBox1.Name = "checkBox1";
        this.checkBox1.Size = new System.Drawing.Size(47, 17);
        this.checkBox1.TabIndex = 1;
        this.checkBox1.Text = "住戶";
        this.checkBox1.UseVisualStyleBackColor = true;
        // 
        // label1
        // 
        this.label1.AutoSize = true;
        this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.5F);
        this.label1.Location = new System.Drawing.Point(4, 180);
        this.label1.Name = "label1";
        this.label1.Size = new System.Drawing.Size(28, 15);
        this.label1.TabIndex = 2;
        this.label1.Text = "住戶";
        // 
        // listView1
        // 
        this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
        this.columnHeader1});
        this.listView1.Location = new System.Drawing.Point(7, 28);
        this.listView1.Name = "listView1";
        this.listView1.Size = new System.Drawing.Size(121, 97);
        this.listView1.TabIndex = 3;
        this.listView1.UseCompatibleStateImageBehavior = false;
        this.listView1.View = System.Windows.Forms.View.Details;
        // 
        // columnHeader1
        // 
        this.columnHeader1.Text = "住戶";
        // 
        // textBox1
        // 
        this.textBox1.Location = new System.Drawing.Point(7, 198);
        this.textBox1.Name = "textBox1";
        this.textBox1.Size = new System.Drawing.Size(100, 20);
        this.textBox1.TabIndex = 4;
        this.textBox1.Text = "住戶";
        // 
        // toolStrip1
        // 
        this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
        this.toolStripLabel1});
        this.toolStrip1.Location = new System.Drawing.Point(0, 0);
        this.toolStrip1.Name = "toolStrip1";
        this.toolStrip1.Size = new System.Drawing.Size(800, 25);
        this.toolStrip1.TabIndex = 5;
        this.toolStrip1.Text = "toolStrip1";
        // 
        // toolStripLabel1
        // 
        this.toolStripLabel1.Name = "toolStripLabel1";
        this.toolStripLabel1.Size = new System.Drawing.Size(32, 22);
        this.toolStripLabel1.Text = "住戶";
        // 
        // statusStrip1
        // 
        this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
        this.toolStripStatusLabel1});
        this.statusStrip1.Location = new System.Drawing.Point(0, 428);
        this.statusStrip1.Name = "statusStrip1";
        this.statusStrip1.Size = new System.Drawing.Size(800, 22);
        this.statusStrip1.TabIndex = 6;
        this.statusStrip1.Text = "statusStrip1";
        // 
        // toolStripStatusLabel1
        // 
        this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
        this.toolStripStatusLabel1.Size = new System.Drawing.Size(32, 17);
        this.toolStripStatusLabel1.Text = "住戶";
        // 
        // Form1
        // 
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.ClientSize = new System.Drawing.Size(800, 450);
        this.Controls.Add(this.statusStrip1);
        this.Controls.Add(this.toolStrip1);
        this.Controls.Add(this.textBox1);
        this.Controls.Add(this.listView1);
        this.Controls.Add(this.label1);
        this.Controls.Add(this.checkBox1);
        this.Controls.Add(this.button1);
        this.Name = "Form1";
        this.Text = "住戶";
        this.toolStrip1.ResumeLayout(false);
        this.toolStrip1.PerformLayout();
        this.statusStrip1.ResumeLayout(false);
        this.statusStrip1.PerformLayout();
        this.ResumeLayout(false);
        this.PerformLayout();
    }

    private System.Windows.Forms.Button button1;
    private System.Windows.Forms.CheckBox checkBox1;
    private System.Windows.Forms.Label label1;
    private System.Windows.Forms.ListView listView1;
    private System.Windows.Forms.ColumnHeader columnHeader1;
    private System.Windows.Forms.TextBox textBox1;
    private System.Windows.Forms.ToolTip toolTip1;
    private System.Windows.Forms.ToolTip toolTip2;
    private System.Windows.Forms.ToolStrip toolStrip1;
    private System.Windows.Forms.ToolStripLabel toolStripLabel1;
    private System.Windows.Forms.StatusStrip statusStrip1;
    private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
}

1 个答案:

答案 0 :(得分:0)

我相信您遇到的问题与Windows为确保在不同屏幕尺寸上正确缩放而执行的自动缩放有关。

已阅读Automatic scaling in Windows Forms

这可能与您的经历有关。