Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
210
How to insert formatted text through code?
posted

Hi,

I have a Windows form having a UltraFormattedTextEditor, and a button.

When I click that button it will insert some text("User") in the UltraformattedTextEditor . When I insert that text i want to change the background of the text to "Yellow" and make it Bold, and after that if i type something it will appear as normal text, with default background.

i want to achive it through C# code. If it is possible, please provide me some sample.

Thanks,

 

Parents
No Data
Reply
  • 5520
    Suggested Answer
    posted

       private void ultraButton1_Click(object sender, EventArgs e)
            {
            
                ultraFormattedTextEditor1.Appearance.BackColor = Color.Yellow;
                ultraFormattedTextEditor1.Appearance.FontData.Bold = Infragistics.Win.DefaultableBoolean.True;
                ultraFormattedTextEditor1.Text = "User";
            }

     private void ultraFormattedTextEditor1_ValueChanged(object sender, EventArgs e)
            {
                if (ultraFormattedTextEditor1.Text != "User")
                {
                    ultraFormattedTextEditor1.Appearance.BackColor = Color.Empty;
                    ultraFormattedTextEditor1.Appearance.FontData.Bold = Infragistics.Win.DefaultableBoolean.Default;
                }
            }

    hope this helps

Children
No Data