4 Answers, 1 is accepted
0
Richard Slade
Top achievements
Rank 2
answered on 09 Feb 2011, 11:12 AM
Hello,
As far as I'm aware, it is not currently possible to change the font italics of the null text.
Regards,
Richard
As far as I'm aware, it is not currently possible to change the font italics of the null text.
Regards,
Richard
0
Hello regina,
Thank you for contacting us. You should use code to provide this functionality. Please consider the following code snippet:
It's a good idea to have the fonts created once because the creation of a Font is a heavy operation and can lead to memory leaks.
I hope this will help you. If you need further assistance I would be glad to provide it.
Regards,
Ivan Petrov
the Telerik team
Thank you for contacting us. You should use code to provide this functionality. Please consider the following code snippet:
private
Font regularFont;
private
Font italicFont;
public
Form1()
{
InitializeComponent();
Font editorFont =
this
.radMaskedEditBox1.Font;
this
.regularFont =
new
Font(editorFont.FontFamily, editorFont.SizeInPoints, FontStyle.Regular);
this
.italicFont =
new
Font(editorFont.FontFamily, editorFont.SizeInPoints, FontStyle.Italic);
}
private
void
radMaskedEditBox1_Enter(
object
sender, EventArgs e)
{
this
.radMaskedEditBox1.Font = regularFont;
}
private
void
radMaskedEditBox1_Leave(
object
sender, EventArgs e)
{
if
(
this
.radMaskedEditBox1.Text.Length == 0)
{
this
.radMaskedEditBox1.Font = italicFont;
}
}
It's a good idea to have the fonts created once because the creation of a Font is a heavy operation and can lead to memory leaks.
I hope this will help you. If you need further assistance I would be glad to provide it.
Regards,
Ivan Petrov
the Telerik team
0
Richard Slade
Top achievements
Rank 2
answered on 11 Feb 2011, 11:14 AM
Hi,
I've learnt something new here. Thanks.
May I suggest a slight change though. we can cut down on the number of events called and also we need to ensure that this is called from from_load as well in case the RadMaskedEditBox does not have a value when the form loads
and in form load
Hope that helps
Richard
I've learnt something new here. Thanks.
May I suggest a slight change though. we can cut down on the number of events called and also we need to ensure that this is called from from_load as well in case the RadMaskedEditBox does not have a value when the form loads
private
void
radMaskedEditBox1_TextChanged(
object
sender, EventArgs e)
{
if
(
this
.radMaskedEditBox1.Text.Length == 0)
{
this
.radMaskedEditBox1.Font = italicFont;}
else
{
this
.radMaskedEditBox1.Font = regularFont;}
}
and in form load
radMaskedEditBox1_TextChanged(
null
,
null
);
Hope that helps
Richard
0
Richard Slade
Top achievements
Rank 2
answered on 11 Feb 2011, 01:21 PM
@Ivan,
Actually, your way will fire less, and so better, but this would still need the check on load
Richard
Actually, your way will fire less, and so better, but this would still need the check on load
if
(
this
.radMaskedEditBox1.Text.Length == 0)
{
this
.radMaskedEditBox1.Font = italicFont;
}