Increase Decrease font size programmatically

Write a program to increase and decrease font size programmatically.

HTML

 

    
<%--//==== Label to shwo output.--%> <%--//==== Font-Size="10" is used to set the initial font size.--%>
<%--//==== Button to Decrease font size.--%>   <%--//==== Button to Increase font size.--%>

 

Code Behind:

 

protected void btnDecreaseFont_Click(object sender, EventArgs e)
    {
        //==== Get the current font size of the lable and remove pt concated with font size.
        int currentSize = Convert.ToInt32(lblOutput.Font.Size.ToString().Replace("pt",""));

        //==== Decrease font size by 1pt.
        lblOutput.Font.Size = currentSize - 1;
    }
    protected void btnIncreaseFont_Click(object sender, EventArgs e)
    {
        //==== Get the current font size of the lable and remove pt concated with font size.
        int currentSize = Convert.ToInt32(lblOutput.Font.Size.ToString().Replace("pt", ""));

        //==== Increase font size by 1pt.
        lblOutput.Font.Size = currentSize + 1;
    }

 


Final Output:

 Increase-Decrease-font-size-programmatically-asp-net-practical-question-codingfusion

 
Best quality Asp .Net Ajax Control Toolkit tutorials.
hello sir,first of all i would like to thanks to you to giving such types of examples,i want to know that deeply about statemanagment concept in asp.net kindly plss send me some examples with output,,,
10-Mar-2014 From  Raj
Hi Raj Thanks. I'll surely send you some examples.
6-Apr-2014 From  Anuj

Give your valuable comments.

Name
Email
Comment
6 + 3 =
 

About Us | Terms of Use | Privacy Policy | Disclaimer | Contact Us Copyright © 2012-2024 CodingFusion
50+ C# Programs for beginners to practice