public partial class Form1 : Form
{
int ranNum;
Random ranNumGen;
string[] words;
const int post = 20;
public Form1()
{
words = new string[post];
ranNumGen = new Random();
words = File.ReadAllLines(@"C:\Users\User\Desktop\prog\c\c\text.txt");
}
//Start new game
private void button1_Click(object sender, EventArgs e)
{
/*here what i want is that when button1 is pressed the game would start */
}
private void label1_Click(object sender, EventArgs e)
{
/* here in label 1 what i want is random word from a text file to be displayed in a manner that it could be guessed*/
}
private void button2_Click_1(object sender, EventArgs e)
{
/* here this is a "submit" button, a word in a text box is submitted and compared to random word from the text file */
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
/* in this text box the user enters a word, and the word has to match the random word from the text file*/
}
}
我要的是創造一個「猜字遊戲」 用戶「提交按鈕」顯示在C#中的「標籤」密匙在文本框中鍵入一個單詞,按下提交按鈕時 提交的單詞將與文本文件中的隨機單詞進行比較,如果兩個單詞匹配遊戲獲勝。 tks
咦?你的意思是顯示星號而不是實際的單詞嗎? –