tostring()后面有啥可以.出来的属性可以用的么?

解决方案 »

  1.   

    string str[]=new string [10];
    foreach (string s in str)
    {
        if(s.Length<=6)
       {
          listBox1.Items.Add(s);
       }
       else
       {
          listBox1.Item.Add(s.SubString(0,6)+"...");
        }
    }
      

  2.   

      你写到 SQL多好 case.... when....  then....  else  一个新的 字段出来比自己搞 方便多了-------------------------------希望有更好的方法,学习.. 一句搞定
      

  3.   

    楼主好有耐心啊..赞一个..写成一句可以不?listBox1.Items.Add((s.Length<=6)?s:(s.SubString(0,6)+"..."));
      

  4.   

    继续坚持,要相信CSDN上肯定有高手..总有一天你的问题会解决的..顶一个..
      

  5.   

    --如果是web就用css<DIV STYLE="width:77px;height:20px;border:0px solid red;overflow:hidden;text-overflow:ellipsis">
    <NOBR>
    testtesttesttesttesttesttest
    </NOBR>
    </DIV>
      

  6.   

    private void button1_Click(object sender, EventArgs ce)
    {
        Graphics vGraphics = Graphics.FromHwnd(Handle);
        StringFormat vStringFormat = new StringFormat();    vStringFormat.FormatFlags |= StringFormatFlags.LineLimit;
        vStringFormat.Trimming = StringTrimming.EllipsisWord;
        vGraphics.DrawString("Zswang 路过", Font, Brushes.Blue,
            new RectangleF(0, 0, 40, 20), vStringFormat);
    }
      

  7.   

    listBox1.Items.Add((s.Length<=6)?s:(s.SubString(0,6)+"..."));