繁体   English   中英

消息框未显示全部内容

[英]Messagebox not showing full content

我使用以下代码通过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替换为硬编码的字符串,则会正常显示该消息。

如何找回缺失的部分?

编辑

这是我的输出:

在此处输入图片说明

这是我想要的输出:

在此处输入图片说明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM