Here's the call I'm making. The ApplicationWindow property type is IWin32Window. It is coming from an application that inherits from CWinApp. The message is displayed in the upperleft corner of the screen.
RadMessageBox.Show(gtApp.ApplicationWindow, Resources.SpatialQueryNoRecords, app.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
A similar MessageBox call centers on my application just fine:
MessageBox.Show(gtApp.ApplicationWindow, Resources.SpatialQueryNoRecords, app.Name, MessageBoxButtons.OK, MessageBoxIcon.Information);
Follow the code:
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
RadControl.EnableRadAutoScale = true;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
string text = "Are you sure you want to exit?";
string caption = "Application";
RadMessageIcon icon = RadMessageIcon.Question;
RadMessageBox.Show(text, caption, MessageBoxButtons.YesNo, icon);
RadMessageBox.Show(text, caption, MessageBoxButtons.YesNoCancel, icon);
When the application is run on a main monitor with 125% DPI scaling, the following result is observed:
Workaround:
RadControl.EnableRadAutoScale = false;
If you use the following code snippet, once you click one of the buttons, immediately pressing the Spacebar will close the message as if the button was clicked:
private void radButton1_Click(object sender, EventArgs e)
{
RadMessageBox.Show("Test", "Caption", MessageBoxButtons.OK);
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("Test", "Caption", MessageBoxButtons.OK);
}
However, if you switch to the following approach, once you click one of the buttons, immediately pressing the Spacebar will close the standard MS MessageBox as if the button was clicked, but the RadMessageBox wouldn't be closed because the message doesn't have focus.
private void radButton1_Click(object sender, EventArgs e)
{
RadMessageBox.Show(this, "Test", "Deployment Result", MessageBoxButtons.OK, RadMessageIcon.Info);
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show(this, "Test", "Deployment Result", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
No matter how the RadMessageBox is shown, it is expected to have focus to the message button by default.
Workaround:
this.TopMost = true;
RadMessageBox.Show(this, "Test", "Deployment Result", MessageBoxButtons.OK, RadMessageIcon.Info);
when set RadMessageBox.UseCompatibleTextRendering = false;
at runtime is generated System.StackOverflowException.
To workaround:
private void RadForm1_Load(object sender, EventArgs e)
{
foreach (Control control in RadMessageBox.Instance.Controls)
{
RadControl radControl = control as RadControl;
if (radControl != null)
{
radControl.UseCompatibleTextRendering = false;
}
}
}
Hi Support,
I just upgrade my winform plugin version from 2018.1.220.40 to 2020.1.218.40. I notice the popup display for RadMessage has shifted from center of the open form to center of the mdiForm (main application).
Below is the code that I used:
RadMessageBox.Show(this, "No Record Found", "Information", System.Windows.Forms.MessageBoxButtons.OK, new System.Drawing.Bitmap(Properties.Resources.info), System.Windows.Forms.MessageBoxDefaultButton.Button1);
Please advice on how can I rectify this issue.
Thank you.
In the above image, the height of the control is not calculated correctly in the Windows 11 theme. In addition, the Details arrow button overlaps the text.