How to fix Metro Message Box Bug, it doesn't read the form owner's size and location

406 Views Asked by At

MetroMessageBox doesn't read form owner's size and location which is My Parent Form. MetroMessageBox is declared inside child form. How can I set My MetroMessageBox owner to be the Parent Form?

I've tried using this code:

using MetroFramework;

private void TileUpdate_Click(object sender, EventArgs e)
{
    //This is my Parent Form
    frmMain fm = new frmMain();
    //This my MetroMessageBox
    MetroMessageBox.Show(fm,"1075","458",MessageBoxButtons.OK,MessageBoxIcon.Question);
}

Still it doesn't read the Parent Form, but when I use Breakpoint My MetroMessageBox reads the Parent Form and fits on the Parent Form.

This is My MetroMessageBox when I execute the without Breakpoint This is My MetroMessageBox when I execute the without Breakpoint This is My MetroMessageBox when use Breakpoint This is My MetroMessageBox when use Breakpoint

1

There are 1 best solutions below

6
Alexey M On

Try to use:

public async Task ShowInfoDialogAsync(string text)
{
    var metroWindow = App.Current.MainWindow as MetroWindow;
    await metroWindow.ShowMessageAsync("Info", text);
}