티스토리 뷰

각 줄 바꿈에 \ n 문자를 사용해보십시오.

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.\n" + 
            "In order to bet 'Low' press the 'ALT' Key and the 'L' key at the same time.\n" + 
                "In order to reduce the bet's value in half  press the 'ALT' Key and the 'H' key at the same time.");
                }
                
-------------------

이 시도

 {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."); }
    
-------------------

이것도 할 수 있습니다.

        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));
                                                        


출처
https://stackoverflow.com/questions/39940068
댓글
공지사항
Total
Today
Yesterday
«   2025/07   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31