gpt4 book ai didi

c# - 添加按钮以复制 MessageBox 中的文本

转载 作者:太空狗 更新时间:2023-10-30 01:21:20 25 4
gpt4 key购买 nike

我有一个包含名称列表的程序,以及一个在 MessageBox 中显示随机名称的按钮。有什么方法可以在 MessageBox 的确定旁边添加一个按钮“复制”,单击时复制名称然后关闭?

如果以上方法不可行,是否有办法在 MessageBox 中启用复制文本?

谢谢。

编辑:我的用户不会理解 Ctrl+C、突出显示和右键单击 > 复制是我要查找的内容(如果复制按钮不可用)

最佳答案

If a user presses Ctrl-C while the MessageBox has focus, the message, the MessageBox caption and the MessageBoxButtons labels are copied to the clipboard.

我用谷歌搜索了你的标题,找到了 this ..

或者,如果您真的需要一个按钮来表示复制,您可以使用新的窗口窗体创建您自己的 MessageBox,然后使用这些按钮执行您想要的操作。像这样打开它以保持 MessageBox 的感觉:

var myMessageBox = new CustomMessageBox();
myMessageBox.ShowDialog();

关于c# - 添加按钮以复制 MessageBox 中的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15980278/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com