we´re (still) updating to RadControls Q3SP1 an we still experience problems with RadMessageBox and large text, like 4000 characters.
In the program we collect multiple messages and append them to a StringBuilder using AppendLine. If this text exceeded 4000 characters, it is cut (StringBuilder.Length = 4000) and a "text-was-cut-message" is appended, so the resulting string has about 4100 charaters and is passed to the RadMessageBoxes Show method.
The resulting MessageBox shows the whole text in the upper portion of the control and is that big (rest (half) of the messagebox is empty), you can´t click "Ok-Button", because it´s located just under the bottom of my monitor.
So, if text is that big - we have to use MS MessageBox.
What I found out while making the screenshot is, that this behaviour depends on the text. I tried to make an example where I put a space after every 50 or 100 characters and a newline after every 500 characters and the text was almost shown as expected.
Greetings,
Daniel
19 Answers, 1 is accepted
Thank you for writing. You have run across a known issue with the TextPrimitive that has been used in RadMessageBox object. We are going to address this in the next release (it is possible to include a fix in the next internal builds as well). Currently, you can place the <html> tag before your string. If this does not help, you can try to manually format the text in a couple of rows by including new lines in your string.
Greetings, Martin Vasilev
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
I have a problem i am using Telerik windows form rad message box and display arabic text in the rad message box, but the problem is that text wrap to second line(although the message is very short and no need to go in second line) and is not visible, the same text is working fine when i use .NET Core MessageBox.
Some times rad messagebox shows a very big message in one or two lines and that is visible.
i dont understand the exact problem, whether some characters are creating the problem or what ??, i have matched the character in different message but find no clue :(
any suggestions.
Thank you.
Thanks.
Please find the attached images for more clarification.
- Arabic text problem in Rad Message Box
- same text is showing perfect in Windows Message Box.
Thanks.
Thank you writing.
In version Q1 2013(2013.1.220) we had an issue with RadMassageBox that may lead to the undesired behavior in your case. I am glad to inform you that this issue is already resolved in our latest release Q1 2013 SP1 (2013.1.320). So my advice is to upgrade to latest version and if you continue to experience the issue to provide code snippets that demonstrate your case so I can investigate it and provide you with adequate assistance.
I hope this helps. I am looking forward to your reply.
Greetings,
Anton
the Telerik team
Thank you Anton.
We are looking to upgrade the telerik controls and if issues arise again, we will put a support ticket.
Thanks.
can we manipulate Telerik Rad MessageBox functionality through reflection.
Thanks.
Thank you for writing back.
Yes, you can manipulate the functionality through reflection. There are cases when we are providing workarounds with reflection due implementation of members that are not public and cannot be accessed without reflection. But to be able to assist you I need more information about your case and what you are trying to accomplish. So please open support ticket where you can attache project and steps how to reproduce the issue and I will be glad to help further.
I am looking forward to your reply.
Greetings,
Anton
the Telerik team
RadMessageBox.Show("<html>One Line<br/>Second Line</html>", ":: Notice ::", MessageBoxButtons.OK, RadMessageIcon.Info);
Kind Regards.
Thank you for replying.
Can you please elaborate your latest post? I find it hard to understand what you are trying to accomplish or what your goal is. I tested the provided code with the latest version (2014.1 226) and it seems to work as expected.
Looking forward to your response.
Regards,
George
Telerik
RadMessageBox.Show("<html>One Line<br/>Second
Line</html>", ":: Notice ::", MessageBoxButtons.OK,
RadMessageIcon.Info);
Kind Regards.
Thank you for your reply.
I tested with a few lines and the behavior still seems OK on my end. Can you please share your concerns, what behavior you are expecting etc. ? Moreover I am attaching a screenshot of the shown RadMessageBox for reference.
Looking forward to your reply.
Regards,
George
Telerik
DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.
RadMessageBox.Show("<html><b><span style=\"color:#f26609; font-size:18pt\">Title:</span></b><br/><br/><span style=\"color:blue; font-size:16pt\">Error on Save..!!</span><br/><span style=\"color:gray; font-size:12pt\">Check with your Administrator.</span></html>", ":: Notice ::", MessageBoxButtons.OK, RadMessageIcon.Exclamation);
You can see the image attached.
I hope to answer your questions.
Kind Regards.
The following code snippet demonstrates how to customize the OK button's color and title bar' color:
private
void
radButton1_Click(
object
sender, EventArgs e)
{
RadButton OKbutton = RadMessageBox.Instance.Controls[
"radButton1"
]
as
RadButton;
OKbutton.BackColor = Color.Red;
OKbutton.ButtonElement.ButtonFillElement.GradientStyle = GradientStyles.Solid;
RadMessageBox.Instance.FormElement.TitleBar.TitleBarFill.BackColor = Color.Yellow;
RadMessageBox.Instance.FormElement.TitleBar.TitleBarFill.GradientStyle = GradientStyles.Solid;
RadMessageBox.Show(
"Text"
,
"Caption"
, MessageBoxButtons.OK);
}
I hope this information helps. If you need any further assistance please don't hesitate to contact me.
Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
thank you dess for the reply...i found it on another way....
RadMessageBox.Instance.ButtonSize = new System.Drawing.Size(95, 30);
RadMessageBox.Instance.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(AppTheme.Formcolor1)))), ((int)(((byte)(AppTheme.Formcolor2)))), ((int)(((byte)(AppTheme.Formcolor3)))));
RadMessageBox.Instance.FormElement.TitleBar.TitlePrimitive.StretchHorizontally = true;
RadMessageBox.Instance.FormElement.TitleBar.TitlePrimitive.TextAlignment = ContentAlignment.MiddleLeft;
RadMessageBox.Instance.FormElement.TitleBar.Font = new Font("Verdata", 8f, FontStyle.Bold | FontStyle.Regular);
//RadMessageBox.Instance.FormElement.TitleBar.FillPrimitive
RadMessageBox.Instance.FormElement.TitleBar.FillPrimitive.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(AppTheme.RadCommandBarBackcolor1)))), ((int)(((byte)(AppTheme.RadCommandBarBackcolor2)))), ((int)(((byte)(AppTheme.RadCommandBarBackcolor3)))));
RadMessageBox.Instance.FormElement.TitleBar.FillPrimitive.BackColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(AppTheme.RadCommandBarBackcolor1)))), ((int)(((byte)(AppTheme.RadCommandBarBackcolor2)))), ((int)(((byte)(AppTheme.RadCommandBarBackcolor3)))));
RadMessageBox.Instance.FormElement.TitleBar.FillPrimitive.BackColor3 = System.Drawing.Color.FromArgb(((int)(((byte)(AppTheme.RadCommandBarBackcolor1)))), ((int)(((byte)(AppTheme.RadCommandBarBackcolor2)))), ((int)(((byte)(AppTheme.RadCommandBarBackcolor3)))));
RadMessageBox.Instance.FormElement.TitleBar.FillPrimitive.BackColor4 = System.Drawing.Color.FromArgb(((int)(((byte)(AppTheme.RadCommandBarBackcolor1)))), ((int)(((byte)(AppTheme.RadCommandBarBackcolor2)))), ((int)(((byte)(AppTheme.RadCommandBarBackcolor3)))));
RadMessageBox.Instance.FormElement.TitleBar.FillPrimitive.GradientStyle = Telerik.WinControls.GradientStyles.Solid;
RadMessageBox.Instance.FormElement.TitleBar.BorderPrimitive.BoxStyle = Telerik.WinControls.BorderBoxStyle.SingleBorder;
RadMessageBox.Instance.FormElement.TitleBar.BorderPrimitive.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(AppTheme.RadCommandBarBackcolor1)))), ((int)(((byte)(AppTheme.RadCommandBarBackcolor2)))), ((int)(((byte)(AppTheme.RadCommandBarBackcolor3)))));
RadMessageBox.Instance.FormElement.TitleBar.TitlePrimitive.ForeColor = Color.White;
foreach (Control control in RadMessageBox.Instance.Controls)
{
if (control is RadButton)
{
string name = control.Name;
((Telerik.WinControls.Primitives.TextPrimitive)((RadButton)control).GetChildAt(0).GetChildAt(1).GetChildAt(1)).ForeColor = Color.White;
((Telerik.WinControls.Primitives.FillPrimitive)((RadButton)control).GetChildAt(0).GetChildAt(0)).BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(AppTheme.RadCommandBarBackcolor1)))), ((int)(((byte)(AppTheme.RadCommandBarBackcolor2)))), ((int)(((byte)(AppTheme.RadCommandBarBackcolor3)))));
((Telerik.WinControls.Primitives.FillPrimitive)((RadButton)control).GetChildAt(0).GetChildAt(0)).BackColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(AppTheme.RadCommandBarBackcolor1)))), ((int)(((byte)(AppTheme.RadCommandBarBackcolor2)))), ((int)(((byte)(AppTheme.RadCommandBarBackcolor3)))));
((Telerik.WinControls.Primitives.FillPrimitive)((RadButton)control).GetChildAt(0).GetChildAt(0)).BackColor3 = System.Drawing.Color.FromArgb(((int)(((byte)(AppTheme.RadCommandBarBackcolor1)))), ((int)(((byte)(AppTheme.RadCommandBarBackcolor2)))), ((int)(((byte)(AppTheme.RadCommandBarBackcolor3)))));
((Telerik.WinControls.Primitives.FillPrimitive)((RadButton)control).GetChildAt(0).GetChildAt(0)).BackColor4 = System.Drawing.Color.FromArgb(((int)(((byte)(AppTheme.RadCommandBarBackcolor1)))), ((int)(((byte)(AppTheme.RadCommandBarBackcolor2)))), ((int)(((byte)(AppTheme.RadCommandBarBackcolor3)))));
control.Font = new Font("Verdata", 11f, FontStyle.Regular | FontStyle.Regular);
// control.Size = new System.Drawing.Size(98, 36);
((RadButton)control).MouseEnter += new System.EventHandler(RadMessageBoxButton_MouseEnter);
((RadButton)control).MouseLeave += new System.EventHandler(RadMessageBoxButton_MouseLeave);
}
else if (control is RadLabel)
{
string name = control.Name;
control.Font = new Font("Verdata", 11f, FontStyle.Regular | FontStyle.Regular);
}
else if (control is PictureBox)
{
((PictureBox)control).MouseEnter += new System.EventHandler(RadMessagepictureBox1_MouseEnter);
((PictureBox)control).MouseLeave += new System.EventHandler(RadMessagepictureBox1_MouseLeave);
}
RadMessageBox.Instance.ButtonSize =
new
System.Drawing.Size(95, 30);
RadMessageBox.Instance.BackColor = System.Drawing.Color.FromArgb(((
int
)(((
byte
)(AppTheme.Formcolor1)))), ((
int
)(((
byte
)(AppTheme.Formcolor2)))), ((
int
)(((
byte
)(AppTheme.Formcolor3)))));
RadMessageBox.Instance.FormElement.TitleBar.TitlePrimitive.StretchHorizontally =
true
;
RadMessageBox.Instance.FormElement.TitleBar.TitlePrimitive.TextAlignment = ContentAlignment.MiddleLeft;
RadMessageBox.Instance.FormElement.TitleBar.Font =
new
Font(
"Verdata"
, 8f, FontStyle.Bold | FontStyle.Regular);
//RadMessageBox.Instance.FormElement.TitleBar.FillPrimitive
RadMessageBox.Instance.FormElement.TitleBar.FillPrimitive.BackColor = System.Drawing.Color.FromArgb(((
int
)(((
byte
)(AppTheme.RadCommandBarBackcolor1)))), ((
int
)(((
byte
)(AppTheme.RadCommandBarBackcolor2)))), ((
int
)(((
byte
)(AppTheme.RadCommandBarBackcolor3)))));
RadMessageBox.Instance.FormElement.TitleBar.FillPrimitive.BackColor2 = System.Drawing.Color.FromArgb(((
int
)(((
byte
)(AppTheme.RadCommandBarBackcolor1)))), ((
int
)(((
byte
)(AppTheme.RadCommandBarBackcolor2)))), ((
int
)(((
byte
)(AppTheme.RadCommandBarBackcolor3)))));
RadMessageBox.Instance.FormElement.TitleBar.FillPrimitive.BackColor3 = System.Drawing.Color.FromArgb(((
int
)(((
byte
)(AppTheme.RadCommandBarBackcolor1)))), ((
int
)(((
byte
)(AppTheme.RadCommandBarBackcolor2)))), ((
int
)(((
byte
)(AppTheme.RadCommandBarBackcolor3)))));
RadMessageBox.Instance.FormElement.TitleBar.FillPrimitive.BackColor4 = System.Drawing.Color.FromArgb(((
int
)(((
byte
)(AppTheme.RadCommandBarBackcolor1)))), ((
int
)(((
byte
)(AppTheme.RadCommandBarBackcolor2)))), ((
int
)(((
byte
)(AppTheme.RadCommandBarBackcolor3)))));
RadMessageBox.Instance.FormElement.TitleBar.FillPrimitive.GradientStyle = Telerik.WinControls.GradientStyles.Solid;
RadMessageBox.Instance.FormElement.TitleBar.BorderPrimitive.BoxStyle = Telerik.WinControls.BorderBoxStyle.SingleBorder;
RadMessageBox.Instance.FormElement.TitleBar.BorderPrimitive.ForeColor = System.Drawing.Color.FromArgb(((
int
)(((
byte
)(AppTheme.RadCommandBarBackcolor1)))), ((
int
)(((
byte
)(AppTheme.RadCommandBarBackcolor2)))), ((
int
)(((
byte
)(AppTheme.RadCommandBarBackcolor3)))));
RadMessageBox.Instance.FormElement.TitleBar.TitlePrimitive.ForeColor = Color.White;
foreach
(Control control
in
RadMessageBox.Instance.Controls)
{
if
(control
is
RadButton)
{
string
name = control.Name;
((Telerik.WinControls.Primitives.TextPrimitive)((RadButton)control).GetChildAt(0).GetChildAt(1).GetChildAt(1)).ForeColor = Color.White;
((Telerik.WinControls.Primitives.FillPrimitive)((RadButton)control).GetChildAt(0).GetChildAt(0)).BackColor = System.Drawing.Color.FromArgb(((
int
)(((
byte
)(AppTheme.RadCommandBarBackcolor1)))), ((
int
)(((
byte
)(AppTheme.RadCommandBarBackcolor2)))), ((
int
)(((
byte
)(AppTheme.RadCommandBarBackcolor3)))));
((Telerik.WinControls.Primitives.FillPrimitive)((RadButton)control).GetChildAt(0).GetChildAt(0)).BackColor2 = System.Drawing.Color.FromArgb(((
int
)(((
byte
)(AppTheme.RadCommandBarBackcolor1)))), ((
int
)(((
byte
)(AppTheme.RadCommandBarBackcolor2)))), ((
int
)(((
byte
)(AppTheme.RadCommandBarBackcolor3)))));
((Telerik.WinControls.Primitives.FillPrimitive)((RadButton)control).GetChildAt(0).GetChildAt(0)).BackColor3 = System.Drawing.Color.FromArgb(((
int
)(((
byte
)(AppTheme.RadCommandBarBackcolor1)))), ((
int
)(((
byte
)(AppTheme.RadCommandBarBackcolor2)))), ((
int
)(((
byte
)(AppTheme.RadCommandBarBackcolor3)))));
((Telerik.WinControls.Primitives.FillPrimitive)((RadButton)control).GetChildAt(0).GetChildAt(0)).BackColor4 = System.Drawing.Color.FromArgb(((
int
)(((
byte
)(AppTheme.RadCommandBarBackcolor1)))), ((
int
)(((
byte
)(AppTheme.RadCommandBarBackcolor2)))), ((
int
)(((
byte
)(AppTheme.RadCommandBarBackcolor3)))));
control.Font =
new
Font(
"Verdata"
, 11f, FontStyle.Regular | FontStyle.Regular);
// control.Size = new System.Drawing.Size(98, 36);
((RadButton)control).MouseEnter +=
new
System.EventHandler(RadMessageBoxButton_MouseEnter);
((RadButton)control).MouseLeave +=
new
System.EventHandler(RadMessageBoxButton_MouseLeave);
}
else
if
(control
is
RadLabel)
{
string
name = control.Name;
control.Font =
new
Font(
"Verdata"
, 11f, FontStyle.Regular | FontStyle.Regular);
}
else
if
(control
is
PictureBox)
{
((PictureBox)control).MouseEnter +=
new
System.EventHandler(RadMessagepictureBox1_MouseEnter);
((PictureBox)control).MouseLeave +=
new
System.EventHandler(RadMessagepictureBox1_MouseLeave);
}
I am glad that you have found a solution that suits your requirement. However, I would like to note that accessing the child elements of a certain control will lower the code readability and it may be difficult to maintain it later. That is why I would highly recommend you to access the desired control from the Controls collection of the RadMessageBox.Instance. Then, use the publicly exposed properties for customizing the style.
I hope this information helps.
Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik