Hi Admins.
I am developing an application which have the functionality to change the theme at rune time.
When i use the Telerik Themes. Message on the RadMessaageBox not shown properly (see attached image)
the code for displaying the MesageBox is
string msg = "<html>Are you sure?<br><br><b>You want to close the Application</b></html>";
DialogResult result = RadMessageBox.Show(
msg, "Sales Digitization", MessageBoxButtons.OKCancel, RadMessageIcon.Question, MessageBoxDefaultButton.Button1);
Is this theme problem that is not compatible with html tags.
5 Answers, 1 is accepted
Hello, Kashif,
According to the provided screenshot, it seems that you are using the Fluent theme to your application. I have tested the provided code and it displays the message box as expected:
Have you changed the font of the message box? Because the different fonts may result in different result when rendering the text.
By default we use GDI+ to measure the text, however, GDI+ is a known suspect for reporting wrong sizes of the text and this is also the case here. You can easily force the element to use GDI instead of GDI+ by setting the UseCompatibleTextRendering property to false and this should improve the rendering of normal text. However, for HTML-like text rendering, the possible solution that I can suggest is to use a suitable font.
I am looking forwrad to your reply.
Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
The screenshot which i have provided is from TelerikBlueTheme.
i have not apply any kind of fond on MessageBox. It is using default font.
Fluent Theme is also working fine at my end.
I was complaining about TelerikMetroBlue and TelerikMetro themes
Please check the attached image, it is taken from the sample project you have attached in the previous post, I have only added TelerikMetro theme
public
RadForm1()
{
InitializeComponent();
ThemeResolutionService.ApplicationThemeName =
"TelerikMetro"
;
string
msg =
"<html>Are you sure?<br><br><b>You want to close the Application</b></html>"
;
DialogResult result = RadMessageBox.Show(msg,
"Sales Digitization"
, MessageBoxButtons.OKCancel, RadMessageIcon.Question, MessageBoxDefaultButton.Button1);
}
I suppose that you mean TelerikMetroBlue theme. Indeed, with HTML-like text, the text rendering is not as expected with the default font for the theme. However, you can improve the text rendering by changing the TextRenderingHint as follows:
((RadLabel)RadMessageBox.Instance.Controls["radLabel1"]).LabelElement.LabelText.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
Could you please give a try and see how it works on your end?
Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Thank you very much for the quick reply.
Its Working, Just apply this code at the application startup.