要在form窗体中实现这些功能,要怎么做
根据多选一按钮组的选择产生相应的一组随机字符,字符长度为30,以蓝色宋体半角模式显示,四号字

解决方案 »

  1.   

    你可以先  定义以个 数组存储你要 出现的 字符串 例如
    string[] strs = {"1","2","3","a","b","c",......};
    然后你在 string result=string.Empty;for(int i=0; i<30;i++)
    {
       Radom rnd = new Radom();   
       result += strs[rnd.next(0,strs.Length)]
    }字体 你可以用 font 来操作了, 
      

  2.   

    有种相当好的方法.利用guid:private void button1_Click(object sender, EventArgs e)
            {
                string[] strList = Guid.NewGuid().ToString().Split('-');
                string str = "";
                for (int i = 0; i < strList.Length; i++)
                {
                    str += strList[i];
                }
                textBox1.Text= str.Substring(0, 20);
            }
      

  3.   

    这样绝对随机,循环10次所得:
    0b5c837616284c3b800d
    fe2fbc1b8b28445992b8
    6ee7bfbaddd142b1b32d
    a4917694b5f541ccb3fa
    d36ede8f0836405ab4e2
    0e402d25c3bb4db593df
    84e9179c84fb4e45a501
    5c4ff2084f344e9ba96f
    d65c7e1891ae45aaaa0b
    e79c7cdf679045f9a6e9
      

  4.   

    可以实现了,但是我要是想说选一个按钮然后对应的出现字符,比如说选择的是字母出现的就是A-Z,a-z,要怎样改。
      

  5.   

    那就用1L的方法
    string[] strs = { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "v", "z" };        private void button1_Click(object sender, EventArgs e)
            {
                Random ran = new Random(DateTime.Now.Millisecond);
                textBox1.Text = strs[ran.Next(0, 26)];
            }
      

  6.   

    天呢,看看一楼的方法,你代码连看都没看懂就说不行
    你可以先  定义以个 数组存储你要 出现的 字符串 例如
    string[] strs = {"1","2","3","a","b","c",......};
    然后你在 string result=string.Empty;
    // 这里不是明显的有个30么
    for(int i=0; i<30;i++)
    {
       Radom rnd = new Radom();   //这里需要优化 改成 Random ran = new Random((int)DateTime.Now.Ticks);
       result += strs[rnd.next(0,strs.Length)]
    }