gpt4 book ai didi

c# - MessageBox.Show 从右到左阅读不起作用

转载 作者:太空狗 更新时间:2023-10-29 20:51:36 26 4
gpt4 key购买 nike

嘿,我会让它变得简单。我想用这个字符串“abc”制作一个 MessageBox,它将从右到左读取。

我试过这个 Messagebox.Show("abc",MessageBoxOptions.RtlReading);

这是怎么回事?

这是我得到的错误:

1:"cannot convert from 'System.Windows.Forms.MessageBoxOptions' to 'string"

2:"cannot convert from 'string' to 'System.Windows.Forms.MessageBoxButtons'"

3:"The best overloaded method match for 'System.Windows.Forms.MessageBox.Show(string, string)' has some invalid arguments"

最佳答案

如果不是从左到右显示,试试这个:

//note the capitalized B in Box
MessageBox.Show(new string("abc".Reverse()), "", MessageBoxButtons.OK, MessageBoxIcons.None, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign);

如果你想要这样的东西:

----------------------------X---------------------------------|                             ||                             ||                        cba  ||                             ||                        |OK| |-------------------------------

I think it doesn't have to do with that though, it's mainly you got the parameters wrong. wrong. Here, fixed:

//note the capitalized B in Box
MessageBox.Show("abc", "", MessageBoxButtons.OK, MessageBoxIcons.None, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading);

还有一种丑陋的方法可以做到这一点,但这意味着您不必添加额外的参数。首先,创建一个名为 MessageBoxEx 的类,它的内容是...

static class MessageBoxEx
{
public static void Show(string content, MessageBoxOptions options)
{
MessageBox.Show(content, "", MessageBoxButtons.OK, MessageBoxIcons.None, MessageBoxDefaultButton.Button1, options);
}
}

并将其命名为 MessageBoxEx.Show("abc", MessageBoxOptions.RtlReading);

关于c# - MessageBox.Show 从右到左阅读不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16993540/

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