Unplanned
Last Updated: 30 Mar 2016 13:14 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 11 Sep 2013 06:45
Category: Editors
Type: Bug Report
0
FIX. RadTextBox - NullText is not rendred correctly when changing the Font
To reproduce: 
- add a RadTextBox with empty Text property but NullText property has some value.
- change the Font style to Microsoft Sans Serif, 8.5pt. As a result the RadTextBox height is decresed a little and the NullText is cut off

Workaround: use Text property instead of NullText and cutomize its ForeColor to gray:
Font newFont = new Font("Microsoft Sans Serif", 8.5f);

public Form1()
{
    InitializeComponent();

    this.radTextBox1.Font = newFont;
    this.radTextBox1.Text = this.radTextBox1.NullText;
    this.radTextBox1.TextBoxElement.ForeColor = Color.Gray;
    this.radTextBox1.GotFocus+=radTextBox1_GotFocus;
    this.radTextBox1.LostFocus+=radTextBox1_LostFocus;

    this.radButton1.Select();
}

private void radTextBox1_LostFocus(object sender, EventArgs e)
{
   if (this.radTextBox1.Text==this.radTextBox1.NullText||this.radTextBox1.Text==string.Empty)
    {
        this.radTextBox1.Text = this.radTextBox1.NullText;
        this.radTextBox1.TextBoxElement.ForeColor = Color.Gray;
    }
    else
    {
         this.radTextBox1.TextBoxElement.ForeColor = Color.Black;
    }
}

private void radTextBox1_GotFocus(object sender, EventArgs e)
{
    if (this.radTextBox1.Text==this.radTextBox1.NullText)
    {
        this.radTextBox1.Text = string.Empty;
        this.radTextBox1.TextBoxElement.ForeColor = Color.Gray;
    }
    else
    {
         this.radTextBox1.TextBoxElement.ForeColor = Color.Black;
    }
}
0 comments