ユーザーが確認ボタンをクリックすると、respactive(key ,value) ペアがハッシュテーブルに保存され、ユーザーがレビューボタンをクリックすると、その特定のリスト項目の要素の色が赤になり、(key,value) ペアが追加された場合に必要になりますユーザーが確認ボタンをクリックした場合に値を変更したいよりもレビューボタンを使用します。要するに、この(キー、値)ペアに(質問、回答)を保存しているので、ユーザーがレビューをクリックするよりも回答がわからない場合、そして後で彼はその答えを変更して確認としてマークできるはずです。これにより、このリスト項目要素の色が緑に変わります。どうすればよいですか
private void AddtoHashTabl(string key, string value)
{
if (hashtable.ContainsKey(key))
{
}
else
{
hashtable.Add(key, value);
}
}
private void Confirm_Click(object sender, EventArgs e)
{
string Q = "";
string A = "";
listView1.Items[Convert.ToInt16(listView1.SelectedItems[0].SubItems[0].Text) - 1].BackColor = Color.Green;
var q = Convert.ToInt16(listView1.SelectedItems[0].Text);
var selectedQuestion = questions[q - 1];
Q = selectedQuestion.Id;
if (radioButton12.Checked == true)
A = "1";
else if (radioButton11.Checked == true)
A = "2";
if (radioButton10.Checked == true)
A = "3";
if (radioButton9.Checked == true)
A = "4";
AddtoHashTabl(Q, A);
}
private void Review_Click(object sender, EventArgs e)
{
string Q = "";
string A = "";
listView1.Items[Convert.ToInt16(listView1.SelectedItems[0].SubItems[0].Text) - 1].BackColor = Color.Red;
var q = Convert.ToInt16(listView1.SelectedItems[0].Text);
var selectedQuestion = questions[q - 1];
Q = selectedQuestion.Id;
if (radioButton12.Checked == true)
A = "1";
else if (radioButton11.Checked == true)
A = "2";
if (radioButton10.Checked == true)
A = "3";
if (radioButton9.Checked == true)
A = "4";
AddtoHashTabl(Q, A);
}
助けてくれてありがとう