有一个单选按钮radiobutton1,我给它赋值,但是值太长,会被窗体截掉后面的一部分,怎么让他到一定字数的时候,让radiobutton1.text里面的内容换行显示

解决方案 »

  1.   


    试试。。加个radiobutton1.text = "113123\n123123";
      

  2.   

    把AutoSize设置为false,调整好控件大小即可
      

  3.   


    设为false的话,显示的内容更少了,截掉一大半了
      

  4.   


    这个是什么意思?。前面是什么?后面又是什么?因为我的内容显示是这样的,放在数组里面的,怎么加啊?
    radio.Text = answerArray[j];
      

  5.   

    radioButton1.Text = "aaaaa\r\nbbbb";//可用在属性面板里:
    点击”text“右面的箭头
    在上面输入你要输入的文字
    在需要回车的地方直接回车即可
      

  6.   


    我不是拖得控件,是自己循环NEW 出来的,这个怎么回车换行
      

  7.   

    我的方法没问题,new的时候,把控件高度设置大一些就可以了
      

  8.   

     int height = 25;
                int x_aris = 15;
                int y_aris = 15;
    radio = new RadioButton();
                        radio.Name = j.ToString();
                       // if (radio.Text.Length > 10)
                       // {
                       //     radio.Text = strCharacter + answerArray[j]+'\r\n';
                       // }
                       // else 
                       // {
                       //     radio.Text = strCharacter + answerArray[j];
                       // }
                        
                        radio.Text = strCharacter + answerArray[j];
                        
                        if (radio.Text == userAnswer_Array[index - 1])
                        {
                            radio.Checked = true;
                        } 
                        radio.AutoSize = true  ;
                        
                        this.flowLayoutPanel2.Controls.Add(radio); 
                        radio.Location = new Point(x_aris, y_aris + height);
                        height += radio.Height;
                        radio.Click += new System.EventHandler(radio_Click);
    这样么?试了。设置height没用啊
      

  9.   

    radio.AutoSize = false ;
      

  10.   

    false的话显示的内容就只有几个字了,后面一半都没有了
      

  11.   


    label1.Text = "12312312312\n123123123";试过可以的,即使循环拼接下就OK了
      

  12.   


     string Message = "xxxx:\n";
                foreach (ListViewItem lvi in lvDenom.Items)
                {
                    if (lvi.SubItems[1].Text != "0")
                    {
                        int Number = int.Parse(lvi.SubItems[1].Text);
                        string Denom = lvi.SubItems[0].Text.ToString();
                        Message += "         " + Denom + ":" + Number + "\n";
                    }
                }这个是我项目里的,\n是换行符 
    12312312312\n123123123 显示的就是第一行是12312312312 后面的到第二行去了
      

  13.   

    这是通过了的代码:            int height = 25;
                int x_aris = 15;
                int y_aris = 15;
                RadioButton radio = new RadioButton();
                radio.Name = "123";
     
                radio.Text = "jsokfjowierufjkweojisjdfk;klasd";            radio.AutoSize = false;            this.panel1.Controls.Add(radio);
                radio.Location = new Point(x_aris, y_aris + height);
                radio.Height += height;
      

  14.   

    其中的代码写反了:radio.Height += height;
      

  15.   

    winform的都是自由定位的  自己调下布局呗
      

  16.   


    radio.Text=System.Text.RegularExpressions.Regex.Replace(answerArray[j], "(.{1,5})", "$1" + Environment.NewLine);
    试试这个,其中{1,5}可以改为{1,k},k为你想要的每行的字符个数
      

  17.   

    我是用数组装的,,请教怎么拼接啊,我试了下,拼接不行
    radio.Text = answerArray[j] +"\n";
      

  18.   


    radio.Text += answerArray[j] +"\n";
    这样就行了,等效于radio.Text =radio.Text+ answerArray[j] +"\n";