我有一个程序,其中包含名称列表和一个在消息框中显示随机名称的按钮。有什么方法可以在消息框的“确定”旁边添加一个“复制”按钮,单击该按钮时复制名称然后关闭?
如果上述方法不可能,是否有办法在 MessageBox 中复制文本?
谢谢。
编辑:我的用户不会理解 Ctrl+C,突出显示并右键单击 > 复制是我正在寻找的(如果复制按钮不可用)
背景:
我正在处理一个非常旧的应用程序,它很少并且非常间歇性地生成异常。
目前的做法:
通常我们程序员使用全局异常处理程序处理罕见的未知数,连接如下:
[STAThread]
[SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.ControlAppDomain)]
private static void Main()
{
Application.ThreadException += new ThreadExceptionEventHandler(UIThreadException);
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
AppDomain.CurrentDomain.UnhandledException +=
new UnhandledExceptionEventHandler(UnhandledException);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new OldAppWithLotsOfWierdExceptionsThatUsersAlwaysIgnore());
}
private static void UIThreadException(object sender, ThreadExceptionEventArgs t)
{
//-------------------------------
ReportToDevelopers("All the steps & variables you need to repro the problem are: " +
ShowMeStepsToReproduceAndDiagnoseProblem(t));
//-------------------------------
MessageToUser.Show("It’s not you, it’s us. This is our fault.\r\n Detailed information about this error has automatically been recorded and we have been notified.Yes, we do look at …Run Code Online (Sandbox Code Playgroud)