Unplanned
Last Updated: 06 Apr 2020 04:37 by ADMIN
BPAM IT
Created on: 26 Mar 2020 08:36
Category: MessageBox
Type: Bug Report
0
RadMessageBox: message box is not centered when shown from a MDI child form

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.

3 comments
ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 06 Apr 2020 04:37

Hi,

I can't give you an exact time frame when the issue will be addressed. Please make sure that you cast your vote for the item. The more votes an item gathers, the higher its priority becomes. 

If you click the Follow button, you will get notified once the item's status changes.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
BPAM IT
Posted on: 06 Apr 2020 03:41

Hi Dess,

Thanks for the workaround, I hope this is just a temporary solution.

You guys will fix this issue in the coming release?

ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 26 Mar 2020 11:40
Hello, 

Following the provided information, I have setup a project with MDI child form and a message box. Indeed, it is shown in the center of the main form, not the center of the MDI child form which the message box was triggered. After looping through the different versions between 2018.1.220.40 and  2020.1.218.40, I noticed that the behavior was changed in R2 2019 SP

I have logged it in our feedback portal by making this thread public. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.

I have also updated your Telerik points.

Currently, the possible solution that I can suggest is to manage the location of the message box as follows:

  public partial class ChildForm : Telerik.WinControls.UI.RadForm
    {
        public ChildForm()
        {
            InitializeComponent();
        }

        private void radButton1_Click(object sender, EventArgs e)
        {
            RadMessageBox.Instance.LocationChanged -= Instance_LocationChanged;
            RadMessageBox.Instance.LocationChanged += Instance_LocationChanged;

            RadMessageBox.Instance.FormClosing -= Instance_FormClosing;
            RadMessageBox.Instance.FormClosing += Instance_FormClosing;
            RadMessageBox.Show(this, "Child Form message", "Information", System.Windows.Forms.MessageBoxButtons.OK,
                new System.Drawing.Bitmap(Properties.Resources.info), System.Windows.Forms.MessageBoxDefaultButton.Button1);
        }

        private void Instance_FormClosing(object sender, FormClosingEventArgs e)
        {
            RadMessageBox.Instance.LocationChanged -= Instance_LocationChanged;
        }
         
        private void Instance_LocationChanged(object sender, EventArgs e)
        {
            RadMessageBox.Instance.LocationChanged -= Instance_LocationChanged;

            var box = sender as RadMessageBoxForm;
            Point pt = new Point(this.MdiParent.Location.X + this.Location.X, this.MdiParent.Location.Y + this.Location.Y);
            box.Location = new Point((pt.X + this.Width / 2) - (box.Width / 2), (pt.Y + this.Height / 2));
            RadMessageBox.Instance.LocationChanged += Instance_LocationChanged; 
        }
    }

The achieved result is illustrated in the attached WorkaroundBehavior.gif file. I have also attached my sample project for your reference.

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

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.