Is it possible to apply a shadow to text that you have adjusted using html. It seems that I can apply a shadow to text that has not been changed via html. But, If I make size, color, etc changes to text in a label, I cannot successfully apply a label. Here is what I have tried, without success.
Any help would be appreciated.
lblDateTime.Text =
"<html>"
& Format(
CStr
(DateTime.Now),
"Long Date"
) &
"<br><font=Arial Black><size=34><color="
& darkNight.ToArgb &
">"
& Format(
CStr
(DateTime.Now),
"Short time"
)
Dim
primitive
As
TextPrimitive =
DirectCast
(
Me
.lblDateTime.RootElement.Children(0).Children(2).Children(1), TextPrimitive)
primitive.Shadow =
New
Telerik.WinControls.Paint.ShadowSettings(
New
Point(2, 2), Color.Red)
Any help would be appreciated.
6 Answers, 1 is accepted
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 02 May 2012, 05:02 PM
Hi Bob,
As far as I'm aware, the HTML rendering replaces the properties of those of the Primitive. You can see for example what happens if you set.
Regards,
Richard
As far as I'm aware, the HTML rendering replaces the properties of those of the Primitive. You can see for example what happens if you set.
primitive.DisableHTMLRendering =
True
Regards,
Richard
0
Richard Slade
Top achievements
Rank 2
answered on 02 May 2012, 05:06 PM
However, why not just format the font via the primitive rather than via HTML.
E.g
Hope this helps
Richard
E.g
primitive.DisableHTMLRendering =
True
primitive.Font =
New
Font(
"Arial"
, 34)
primitive.ForeColor = Color.Black
primitive.Shadow =
New
Telerik.WinControls.Paint.ShadowSettings(
New
Point(2, 2), Color.Red)
lblDateTime.Text = Format(
CStr
(DateTime.Now),
"Long Date"
) & Format(
CStr
(DateTime.Now),
"Short time"
)
Hope this helps
Richard
0
Bob
Top achievements
Rank 2
answered on 02 May 2012, 05:23 PM
Thanks for your response. The biggest reason that I was rendering via html was that the label contains two different fonts. The date is displayed smaller and then the time in a larger font. That way I could use a single label, instead of 2. I actually have several places where this is the case. Using a single label helps with arrangement and docking, which is always helpful. Another example is in a RadRotator, in which I've added a label item. For appearance sake, there are font, boldness and other changes in the displayed text, but again, it appears that I can't add a shadow.
I could break the date and time label into 2 labels and apply changes through the primitive, but was just hoping there was a way to render text, with html AND apply a shadow.
Thanks again for your input.
I could break the date and time label into 2 labels and apply changes through the primitive, but was just hoping there was a way to render text, with html AND apply a shadow.
Thanks again for your input.
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 02 May 2012, 05:29 PM
Hi Bob,
I may be mistaken, but I'm pretty sure that's the way you'd have to do it as HTML rendered text overrides the primitives properties.
I guess you could also build your own user control with the two labels inside that are rendered as you require to act as one control also?
Regards,
Richard
I may be mistaken, but I'm pretty sure that's the way you'd have to do it as HTML rendered text overrides the primitives properties.
I guess you could also build your own user control with the two labels inside that are rendered as you require to act as one control also?
Regards,
Richard
0
Bob
Top achievements
Rank 2
answered on 02 May 2012, 05:55 PM
Ok. Thanks Richard. That provides some clarity.
0
Hello Bob,
Thank you for writing.
I just want to confirm Richard's words that the HTML-like Text Formatting does not support text shadows.
Do not hesitate to contact us if you have other questions.
All the best,
Peter
the Telerik team
Thank you for writing.
I just want to confirm Richard's words that the HTML-like Text Formatting does not support text shadows.
Do not hesitate to contact us if you have other questions.
All the best,
Peter
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>