winform 给textbox 增加 或 减小字体大小 z

   private void btnAddFont_Click(object sender, EventArgs e)
        {
            float fSize = this.txtResult.Font.Size;
           
            if (fSize > 22.0) { return; }

            fSize = fSize + 1;
            txtResult.Font = new Font(txtResult.Font.FontFamily, fSize, txtResult.Font.Style);
        }

        private void btnSubtractFont_Click(object sender, EventArgs e)
        {
            float fSize = this.txtResult.Font.Size;

            if (fSize <6.0) { return; }

            fSize = fSize - 1;
            txtResult.Font = new Font(txtResult.Font.FontFamily, fSize, txtResult.Font.Style);
        }

 

猜你喜欢

转载自www.cnblogs.com/zeroone/p/8983652.html