c#练打字游戏(要求修改源代码,把随机出现的字母变成单词)
哪位高手知道怎么把随机出现的字母变成单词//产生随机字母赋值到labelstringstr;boolisHave=false;do{isHave=false;if(r.N...
哪位高手知道怎么把随机出现的字母变成单词
//产生随机字母赋值到label
string str;
bool isHave = false;
do
{
isHave = false;
if (r.Next(DateTime.Now.Millisecond + 100 * i) % 2 == 0)
{
str = ((Char)r.Next(97, 122)).ToString();
}
else
{
str = ((Char)r.Next(65, 90)).ToString();
}
for (int j = 0; j < LblsList.Count; j++)
{
Labels ls = (Labels)LblsList[j];
if (str == ls.Lbl.Text)
{
isHave = true;
break;
}
}
} while (isHave);
lbl[i].Text = str; 展开
//产生随机字母赋值到label
string str;
bool isHave = false;
do
{
isHave = false;
if (r.Next(DateTime.Now.Millisecond + 100 * i) % 2 == 0)
{
str = ((Char)r.Next(97, 122)).ToString();
}
else
{
str = ((Char)r.Next(65, 90)).ToString();
}
for (int j = 0; j < LblsList.Count; j++)
{
Labels ls = (Labels)LblsList[j];
if (str == ls.Lbl.Text)
{
isHave = true;
break;
}
}
} while (isHave);
lbl[i].Text = str; 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询