public static DialogResult Show(string txtMessage, string txtTitle) { newMessageBox = new MyMessageBox(); buttons = MessageBoxButtons.OK; defaultButton = MessageBoxDefaultButton.Button1; newMessageBox.lblTitle.Text = txtTitle; newMessageBox.lblMessage.Text = txtMessage; Graphics graphics = newMessageBox.lblMessage.CreateGraphics(); Size size = graphics.MeasureString(txtMessage, newMessageBox.lblMessage.Font, 0x14f).ToSize(); graphics.Dispose(); int num = size.Height + 3; if (num < 50) { num = 50; } newMessageBox.lblMessage.Size = new Size(0x14f, num + 20); newMessageBox.panel1.Size = newMessageBox.lblMessage.Size; newMessageBox.Size = new Size(newMessageBox.Size.Width, (num + 0x8e) - 0x3a); bool flag = false; Form activeForm = Form.ActiveForm; if (forcedForm != null) { activeForm = forcedForm; flag = true; newMessageBox.StartPosition = FormStartPosition.CenterParent; } else if (((activeForm != null) && (activeForm.ProductName == newMessageBox.ProductName)) && (activeForm.WindowState == FormWindowState.Normal)) { flag = true; } if (flag) { newMessageBox.StartPosition = FormStartPosition.CenterParent; newMessageBox.ShowDialog(activeForm); } else { newMessageBox.ShowDialog(); } newMessageBox.Dispose(); forcedForm = null; if ((activeForm != null) && flag) { bool topMost = activeForm.TopMost; activeForm.TopMost = false; activeForm.TopMost = true; activeForm.Focus(); activeForm.BringToFront(); activeForm.Focus(); activeForm.TopMost = topMost; } return(result); }
public static DialogResult Show(string txtMessage, string txtTitle, MessageBoxButtons buts, MessageBoxIcon x1, MessageBoxDefaultButton defaultBut, int x2) { newMessageBox = new MyMessageBox(); buttons = buts; defaultButton = defaultBut; newMessageBox.lblTitle.Text = txtTitle; newMessageBox.lblMessage.Text = txtMessage; Graphics graphics = newMessageBox.lblMessage.CreateGraphics(); Size size = graphics.MeasureString(txtMessage, newMessageBox.lblMessage.Font, 0x14f).ToSize(); graphics.Dispose(); int height = size.Height; if (height < 50) { height = 50; } newMessageBox.lblMessage.Size = new Size(0x14f, height + 20); newMessageBox.panel1.Size = newMessageBox.lblMessage.Size; newMessageBox.Size = new Size(newMessageBox.Size.Width, (height + 0x8e) - 0x3a); bool flag = false; Form activeForm = Form.ActiveForm; if (((activeForm != null) && (activeForm.ProductName == newMessageBox.ProductName)) && (activeForm.WindowState == FormWindowState.Normal)) { flag = true; } if (flag) { newMessageBox.ShowDialog(activeForm); } else { newMessageBox.ShowDialog(); } newMessageBox.Dispose(); if ((activeForm != null) && flag) { bool topMost = activeForm.TopMost; activeForm.TopMost = false; activeForm.TopMost = true; activeForm.Focus(); activeForm.BringToFront(); activeForm.Focus(); activeForm.TopMost = topMost; } return(result); }
public static DialogResult Show(string txtMessage) { newMessageBox = new MyMessageBox(); buttons = MessageBoxButtons.OK; defaultButton = MessageBoxDefaultButton.Button1; newMessageBox.lblMessage.Text = txtMessage; Graphics graphics = newMessageBox.lblMessage.CreateGraphics(); Size size = graphics.MeasureString(txtMessage, newMessageBox.lblMessage.Font, 0x14f).ToSize(); graphics.Dispose(); int height = size.Height; if (height < 50) { height = 50; } newMessageBox.lblMessage.Size = new Size(0x14f, height); newMessageBox.panel1.Size = newMessageBox.lblMessage.Size; newMessageBox.Size = new Size(newMessageBox.Size.Width, (height + 0x8e) - 0x3a); bool flag = false; Form activeForm = Form.ActiveForm; if (forcedForm != null) { activeForm = forcedForm; flag = true; newMessageBox.StartPosition = FormStartPosition.CenterParent; } else if (((activeForm != null) && (activeForm.ProductName == newMessageBox.ProductName)) && (activeForm.WindowState == FormWindowState.Normal)) { flag = true; } if (flag) { newMessageBox.ShowDialog(activeForm); } else { newMessageBox.ShowDialog(); } newMessageBox.Dispose(); forcedForm = null; if ((activeForm != null) && flag) { bool topMost = activeForm.TopMost; activeForm.TopMost = false; activeForm.TopMost = true; activeForm.Focus(); activeForm.BringToFront(); activeForm.Focus(); activeForm.TopMost = topMost; } return result; }
public static DialogResult Show(string txtMessage, string txtTitle, MessageBoxButtons buts, MessageBoxIcon x1, MessageBoxDefaultButton defaultBut, int x2) { newMessageBox = new MyMessageBox(); buttons = buts; defaultButton = defaultBut; newMessageBox.lblTitle.Text = txtTitle; newMessageBox.lblMessage.Text = txtMessage; Graphics graphics = newMessageBox.lblMessage.CreateGraphics(); Size size = graphics.MeasureString(txtMessage, newMessageBox.lblMessage.Font, 0x14f).ToSize(); graphics.Dispose(); int height = size.Height; if (height < 50) { height = 50; } newMessageBox.lblMessage.Size = new Size(0x14f, height + 20); newMessageBox.panel1.Size = newMessageBox.lblMessage.Size; newMessageBox.Size = new Size(newMessageBox.Size.Width, (height + 0x8e) - 0x3a); bool flag = false; Form activeForm = Form.ActiveForm; if (((activeForm != null) && (activeForm.ProductName == newMessageBox.ProductName)) && (activeForm.WindowState == FormWindowState.Normal)) { flag = true; } if (flag) { newMessageBox.ShowDialog(activeForm); } else { newMessageBox.ShowDialog(); } newMessageBox.Dispose(); if ((activeForm != null) && flag) { bool topMost = activeForm.TopMost; activeForm.TopMost = false; activeForm.TopMost = true; activeForm.Focus(); activeForm.BringToFront(); activeForm.Focus(); activeForm.TopMost = topMost; } return result; }