MessageBox.Show从右到左阅读不起作用 [英] MessageBox.Show right to left reading not working

查看:141
本文介绍了MessageBox.Show从右到左阅读不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,我将使其变得简单.我要创建一个字符串"abc"的MessageBox,它将从右到左读取.

Hey I'll make it simple. I want to make a MessageBox of this string "abc" and it will be read from right to left.

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

这是什么?

这是我得到的错误:

1:无法从'System.Windows.Forms.MessageBoxOptions'转换为'string"

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

2:"无法从字符串"转换为 'System.Windows.Forms.MessageBoxButtons'"

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

3:'System.Windows.Forms.MessageBox.Show(string, 字符串)'包含一些无效的参数"

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

推荐答案

如果未从左到右显示,请尝试以下操作:

If it's not displaying left to right, try this:

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

如果您想要这样的东西:

If you want something like this:


----------------------------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的类,其内容为...

There's also an ugly way to do this, but it means you don't have to add the extraparams. First, make a class called MessageBoxEx, and the contents of it are...

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);这样称呼它.

这篇关于MessageBox.Show从右到左阅读不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆