private void button_keyDown(object sender, KeyEventArgs e)
{
// Escape key kills the dialog if we allow it to be closed
if ((e.KeyCode == Keys.Escape) && ControlBox)
Close();
else
{
// Pressing Ctrl+C should copy message text into the clipboard
if ((e.Modifiers == Keys.Control) && (e.KeyCode == Keys.C))
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("---------------------------");
sb.AppendLine(_windowTitle);
sb.AppendLine("---------------------------");
sb.AppendLine(_mainInstruction);
sb.AppendLine("---------------------------");
sb.AppendLine(_content);
sb.AppendLine("---------------------------");
if (_buttonOK.Visible)
{
sb.Append(_buttonOK.Text);
sb.Append(" ");
}
if (_buttonYes.Visible)
{
sb.Append(_buttonYes.Text);
sb.Append(" ");
}
if (_buttonNo.Visible)
{
sb.Append(_buttonNo.Text);
sb.Append(" ");
}
if (_buttonCancel.Visible)
{
sb.Append(_buttonCancel.Text);
sb.Append(" ");
}
if (_buttonRetry.Visible)
{
sb.Append(_buttonRetry.Text);
sb.Append(" ");
}
if (_buttonClose.Visible)
{
sb.Append(_buttonClose.Text);
sb.Append(" ");
}
sb.AppendLine("");
sb.AppendLine("---------------------------");
Clipboard.SetText(sb.ToString(), TextDataFormat.Text);
}
}
}