Messagebox未显示完整内容

时间:2015-05-11 07:19:02

标签: c# string messagebox

我使用以下代码向MessageBox用户提问我的应用程序:

var site = Registry.GetValue("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Netlogon\\Parameters",
    "DynamicSiteName", "Unconnected") as string;
var selectedSite = (Options.GetUserSetting("Site", "SelectedSite"));

if () // Some checks go here
{
    DialogResult ret = MessageBox.Show(
        string.Format("The selected site is {0}. But you're in {1}...{2}Want to change it ?", selectedSite, site.Trim(), Environment.NewLine),
        "Stupid default selection...",
        MessageBoxButtons.YesNo,
        MessageBoxIcon.Question);
    // Some process goes here
}

MessageBox显示以下文字:

  

所选站点为[SelectedSiteNameGoesHere]。但你在[SiteGoesHere]

这有点令人不安,因为我不明白为什么字符串会被拆分。

如果我将site替换为硬编码字符串,则会正常显示该消息。

如何找回缺失的部分?

修改

这是我的输出:

enter image description here

这是我想要的输出:

enter image description here

0 个答案:

没有答案
相关问题