Completed
Last Updated: 19 Jun 2017 12:28 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 03 May 2017 13:44
Category: Editors
Type: Bug Report
2
FIX. RadTextBoxControl - the SelectionColor is not rendered correctly
To reproduce: Add a RadTextBoxControl and set the SelectionColor property to Red. You will notice that the selection color is semi-transparent and it seems like pink. In order to obtain real Red selection color, it is necessary to set the SelectionOpacity property to 255. However, the selected text is not visible. Please refer to the attached screenshot.

Workaround:

public class CustomTextBoxControl : RadTextBoxControl
{
    public override string ThemeClassName
    {
        get
        {
            return typeof(RadTextBoxControl).FullName;
        }
    }
    protected override RadTextBoxControlElement CreateTextBoxElement()
    {
        return new CustomRadTextBoxControlElement();
    }
}

public class CustomRadTextBoxControlElement : RadTextBoxControlElement
{
    protected override Type ThemeEffectiveType
    {
        get
        {
            return typeof(RadTextBoxControlElement);
        }
    }
    protected override TextBoxViewElement CreateViewElement()
    {
        return new CustomTextBoxViewElement();
    }
}

public class CustomTextBoxViewElement : TextBoxViewElement
{
    protected override void PaintChildren(IGraphics graphics, Rectangle clipRectange, float angle, 
        SizeF scale, bool useRelativeTransformation)
    {
        this.SelectionPrimitive.PaintPrimitive(graphics, angle, scale);
        base.PaintChildren(graphics, clipRectange, angle, scale, useRelativeTransformation);
    }

    protected override void PostPaintChildren(IGraphics graphics, Rectangle clipRectange, float angle, SizeF scale)
    {
        if (this.SelectionPrimitive == null)
        {
            return;
        }

        if (this.Multiline && this.WordWrap)
        {
            this.SelectionPrimitive.TextBoxElement.Navigator.RestoreSelection();
        }
    }
}


0 comments