RichTextBox flickering when SpellCheck Activated and ScrollBar visible

104 views Asked by At

I'm having this problem with my RichTextBox: if I don't activate the spell checker everything goes OK, if I activate the spell checker and the RichTextBox Control doesn't need the scrollbar, everything goes OK, but if I activate the spell checker and the Scrollbar is needed the text starts to flicker when the underlining of the spell mistakes begins.

I've read a lot about DoubleBuffered property but I can't access it in my RichtextBox, even when I try:

public static void SetDoubleBuffered(RichTextBoxcontrol)
{

  // set instance non-public property with name "DoubleBuffered" to true
  typeof(RichTextBox).InvokeMember("DoubleBuffered",
      BindingFlags.SetProperty | BindingFlags.Instance | BindingFlags.NonPublic,
      null, control, new object[] { true });
}

I've also tried accessing CreateParams, but my control is in a System.Windows.Controls.Page, and doesn't have CreateParams property:

protected override CreateParams CreateParams
{  
    get

    {
        if (originalExStyle == -1)
            originalExStyle = base.CreateParams.ExStyle;

        CreateParams cp = base.CreateParams;
        if (enableFormLevelDoubleBuffering)
            cp.ExStyle |= 0x02000000;   // WS_EX_COMPOSITED
        else
            cp.ExStyle = originalExStyle;

        return cp;
    }
}

Does anyone have any idea how to solve the flickering?

Thanks!!

0

There are 0 answers