如何让这个消息框正确地用C#将每个句子放在自己的行上?

时间:2016-10-09 04:34:06

标签: c#

        private void button5_Click(object sender, EventArgs e)
    {
        MessageBox.Show("In order to bet 'High' press the 'ALT' Key and the 'H' key at the same time." + "In order to bet 'Low' press the 'ALT' Key and the 'L' key at the same time." + "In order to reduce the bet's value in half  press the 'ALT' Key and the 'H' key at the same time.");
    }

这就是现在的样子。

enter image description here

3 个答案:

答案 0 :(得分:3)

尝试为每个换行符使用\ n字符。

ggplot(pred, aes(x=X, y=Y, colour=tau, group=factor(tau))) +
  geom_point(data=data, aes(X,Y), inherit.aes=FALSE) +
  geom_line(show.legend=FALSE, alpha=0.7) +
  scale_colour_gradient2(low="red", mid="yellow", high="blue", midpoint=0.5) +
  theme_bw() 

答案 1 :(得分:1)

试试这个

 {MessageBox.Show("In order to bet 'High' press the 'ALT' Key and the 'H' key at the same time." + Environment.NewLine 
  + "In order to bet 'Low' press the 'ALT' Key and the 'L' key at the same time." + Environment.NewLine 
  + "In order to reduce the bet's value in half  press the 'ALT' Key and the 'H' key at the same time."); }

答案 2 :(得分:1)

你也可以这样做:

        List<string> ListMessage = new List<string>();
        ListMessage.Add("In order to bet 'High' press the 'ALT' Key and the 'H' key at the same time.");
        ListMessage.Add("In order to bet 'Low' press the 'ALT' Key and the 'L' key at the same time.");
        ListMessage.Add("In order to reduce the bet's value in half  press the 'ALT' Key and the 'H' key at the same time.");

        //Solution 1
        MessageBox.Show(string.Join(Environment.NewLine, ListMessage));

        //Solution 2 => Add using System.Linq
        MessageBox.Show(ListMessage.Aggregate((x, y) => x + Environment.NewLine + y));