单词考试软件
想起来小时候用小霸王英语词霸, 对我学习英语帮助挺大. 所以做了一个类似的. 就是一个简单的选择题. 每天不断反复的让孩子练习. 看看对大家有没有帮助. 单词表用的一个托福的单词表, 自己也可以按照格式添加小学, 初中, 高中以及四六级的, 不过我没找到什么现成的. 带了微软的语音, 所以可以配个影响, 让孩子跟着电脑读.using System.Data;
using System.Text;
using System.Transactions;
using System.Speech.Recognition;
using System.Speech.Synthesis;
namespace 单词考试
{
public partial class Form1 : Form
{
private DataTable dt;
private int FRightSubmit = 0;
private List<RadioButton> frbtns;
private bool FNoSubmit = true;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
frbtns = new List<RadioButton>();
frbtns.Add(rbtn1);
frbtns.Add(rbtn2);
frbtns.Add(rbtn3);
frbtns.Add(rbtn4);
FRightSubmit = 0;
dt = new DataTable();
System.IO.FileStream fs = new System.IO.FileStream(Environment.CurrentDirectory + "\\tuofu.csv", System.IO.FileMode.Open);
System.IO.StreamReader sr = new System.IO.StreamReader(fs, Encoding.GetEncoding("UTF-8"));
string temptext = "";
bool firstRow = true;
while ((temptext = sr.ReadLine()) != null)
{
string[] arr = temptext.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
DataRow dr = dt.NewRow();
if (firstRow)
{
firstRow = false;
for (int i = 0; i < arr.Length; i++)
{
dt.Columns.Add(i.ToString());
}
}
for (int i = 0; i < arr.Length; i++)
{
dr = arr;
}
dt.Rows.Add(dr);
}
sr.Close();
fs.Close();
btnnext.PerformClick();
}
private static void Shuffle(List<RadioButton> list)
{
int n = list.Count;
while (n > 1)
{
int randomIndex = new Random().Next(n);
if (n > 0 && n < list.Count && randomIndex >= 0 && randomIndex < list.Count && n != randomIndex)
{
var temp = list;
list = list;
list = temp;
}
n--;
}
}
private void btnnext_Click(object sender, EventArgs e)
{
bool nocheckedbtn = true;
foreach (RadioButton r in frbtns)
{
if (r.Checked)
{
nocheckedbtn = false;
break;
}
}
if (rbtn1.Text != "radioButton1" && FNoSubmit)
{
return;
}
if (rbtn1.Text != "radioButton1" && nocheckedbtn)
{
return;
}
FNoSubmit = true;
Shuffle(frbtns);
Random ranMaker = new Random();
HashSet<int> selectID = new HashSet<int>();
int firstid = -1;
while (selectID.Count < 4)
{
int i = ranMaker.Next(0, dt.Rows.Count);
if (firstid == -1)
{
firstid = i;
}
selectID.Add(i);
}
DataRow dr1 = dt.Rows;
lblword.Text = dr1.ToString();
lblsound.Text = dr1.ToString();
int ri = 0;
foreach (int id in selectID)
{
dr1 = dt.Rows;
frbtns.Text = (string)dr1["2"];
ri++;
}
foreach (RadioButton r in frbtns)
{
r.Checked = false;
}
}
public string ReadEmbeddedCsv(string filename)
{
string path = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, filename));
if (File.Exists(path))
return File.ReadAllText(path, Encoding.UTF8);
else
return null;
}
private void button1_Click(object sender, EventArgs e)
{
FNoSubmit = false;
var reader = new System.Speech.Synthesis.SpeechSynthesizer();
reader.SpeakAsync(lblword.Text);
if (FRightSubmit == 100)
{
MessageBox.Show("你已经完成了今天的任务, 恭喜你");
}
if (frbtns.Checked)
{
lblok.BackColor = Color.Green;
lblok.ForeColor = Color.White;
lblok.Text = "恭喜你, 答对了";
FRightSubmit++;
label2.Text = "答对题目数: " + FRightSubmit.ToString() + "/100";
}
else
{
lblok.ForeColor = Color.White;
lblok.BackColor = Color.Red;
lblok.Text = "不好意思, 答错了";
}
}
}
} markhoo911 发表于 2023-9-6 12:53
请问一下,你是用的WinForm还是WPF
用的winform jim19 发表于 2023-11-2 15:48
譬如你找个比较好用的那种我看看
https://worktile.com
这个里面有个目标管理,然后就是一个看板。那个目标挺好用,看书的时候,进度会显示百分比,填入总页数或者总章节,看到哪里我填一下就更新了。太好用了。效率神器。但是这个小功能就收费,太操蛋了 我来试试 为什么收藏不了 请问一下,你是用的WinForm还是WPF 我来试试 我來玩玩,正好最近在學英文 谢谢分享,但愿实用有效。 真有高人,收藏,赞! 试试效果怎样!