Skip to content

Commit

Permalink
Add CustomMessageBox
Browse files Browse the repository at this point in the history
  • Loading branch information
bparks13 committed Oct 29, 2024
1 parent cfb5532 commit aaa8e12
Show file tree
Hide file tree
Showing 3 changed files with 1,933 additions and 0 deletions.
127 changes: 127 additions & 0 deletions OpenEphys.Onix1.Design/CustomMessageBox.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions OpenEphys.Onix1.Design/CustomMessageBox.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System.Windows.Forms;

namespace OpenEphys.Onix1.Design
{
/// <summary>
/// Create a custom message box form that allows for custom button names
/// </summary>
public partial class CustomMessageBox : Form
{
/// <summary>
/// Initialize a new custom message box form
/// </summary>
public CustomMessageBox(string message, string title = "Message", string confirmText = "Confirm", string cancelText = "Cancel")
{
InitializeComponent();

label1.Text = message;

var size = TextRenderer.MeasureText(label1.Text, label1.Font, label1.Size, TextFormatFlags.WordBreak);

if (size.Height > label1.Height)
{
Height += size.Height - label1.Height;
}

Text = title;
buttonConfirm.Text = confirmText;
buttonCancel.Text = cancelText;
}
}
}
Loading

0 comments on commit aaa8e12

Please sign in to comment.