Add Two functions to set and clear the underline formats

public void SetUnderline()
{
      IntPtr lParam = IntPtr.Zero;
      this.SelectAll();
      SendMessage(new HandleRef(this, Handle),
                  TX_SETFONTATTR, FA_UL_REDZIGZAG, ref lParam);
}
public void ResetUnderline()
{
      IntPtr lParam = IntPtr.Zero;
      this.SelectAll();
      SendMessage(new HandleRef(this, Handle),
                  TX_SETFONTATTR, FA_UL_NOREDZIGZAG , ref lParam);
}
Note: I have used SelectAll() function to select all of the text and format them. It is also possible to select a particular word using Select(int,int) function of TxTextControl and format the required word.

      Open the Form1 designer code and change the textControl1 declaration from TextControl          to MyTextControl
      Goto InitializeComponent() function and change the instance creation from TextControl to          MyTextControl()
      Add the following code to “Mark All” button click event:

textControl1.SetUnderline();

       Add the following code to “Unmark All” button click event

textControl1.ResetUnderline();

<  1 2 3 4  >


 

 

© 2008. UnitedPro Software Solutions Pvt. Ltd