根据多选一按钮组的选择产生相应的一组随机字符(3个选择) 要在form窗体中实现这些功能,要怎么做根据多选一按钮组的选择产生相应的一组随机字符,字符长度为30,以蓝色宋体半角模式显示,四号字 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你可以先 定义以个 数组存储你要 出现的 字符串 例如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 来操作了, 有种相当好的方法.利用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); } 这样绝对随机,循环10次所得:0b5c837616284c3b800dfe2fbc1b8b28445992b86ee7bfbaddd142b1b32da4917694b5f541ccb3fad36ede8f0836405ab4e20e402d25c3bb4db593df84e9179c84fb4e45a5015c4ff2084f344e9ba96fd65c7e1891ae45aaaa0be79c7cdf679045f9a6e9 可以实现了,但是我要是想说选一个按钮然后对应的出现字符,比如说选择的是字母出现的就是A-Z,a-z,要怎样改。 那就用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)]; } 天呢,看看一楼的方法,你代码连看都没看懂就说不行你可以先 定义以个 数组存储你要 出现的 字符串 例如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)]} GCHandle 用SqlDataAdapter更新DataGridView中的信息 winform中panel中添加panel 文件集中管理 winform打包时添加的问题夹,在卸载系统时会自动删掉,怎样在卸载时不删除这个文件夹? 求助。。。 600分解决一个问题,急!还请各位帮忙!!!顶者有分。 未处理的“System.Data.SqlClient.SqlException”类型的异常出现在 system.data.dll 中。 设计模式 c#定时器 winform,gridview中有一个单元格处于可以输入的编辑姿态,怎么取消这个单元格的编辑输入状态 C#模拟掌上百度登录贴吧
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 来操作了,
{
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);
}
0b5c837616284c3b800d
fe2fbc1b8b28445992b8
6ee7bfbaddd142b1b32d
a4917694b5f541ccb3fa
d36ede8f0836405ab4e2
0e402d25c3bb4db593df
84e9179c84fb4e45a501
5c4ff2084f344e9ba96f
d65c7e1891ae45aaaa0b
e79c7cdf679045f9a6e9
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)];
}
你可以先 定义以个 数组存储你要 出现的 字符串 例如
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)]
}