winform increase or decrease font size z to textbox

   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);
        }

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325172766&siteId=291194637