0
public partial class QuestionDragAndDropList : Form
{
private List<ListQuestions> Questions = new List<ListQuestions>();
private int i = 0;
public QuestionDragAndDropList()
{
InitializeComponent();
NextQuestion();
}
private void QuestionList()
{
Questions.Add(new ListQuestions("Question 1", new[] {//Answers}, 0));
Questions.Add(new ListQuestions("Question 2", new[] {//^}, 0));
Questions.Add(new ListQuestions("Question 3", new[] {//^}, 0));
Questions.Add(new ListQuestions("Question 4", new[] {//^}, 0));
}
private void NextQuestion()
{
if (i != 2)
{
lblQuestion.Text = Questions[i].GetQuestion();
string[] Ans = Questions[i].GetAns();
BtnA1.Text = Ans[0];
BtnA2.Text = Ans[1];
BtnA3.Text = Ans[2];
BtnA4.Text = Ans[3];
}
else
{
Questions[i].GetQuestion();
BitMap[] Ans = Questions[i].GetAnswers();
}
}
private void AnsCheck(int Answer)
{
if (Answer < Questions.Count)
{
WelcomeYear11.Userfiling.IncreaseS();
}
i++;
if (i != Questions.Count)
{
NextQuestion();
}
else
{
do something.
}
}
private void GrabLabel(object sender, MouseEventArgs e)
{
Label selectedLbl = (Label)sender;
selectedLbl.DoDragDrop(selectedLbl.Text, DragDropEffects.Copy);
}
private void AllowDragDrop(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.Copy;
}
private void PBox1DragDrop(object sender, DragEventArgs e)
{
string result = e.Data.GetData(DataFormats.Text).ToString();
if (result == "9")
{
lblA1.Visible = false;
PboxA1.Visible = false;
}
}
private void PBox2DragDrop(object sender, DragEventArgs e)
{
string result = e.Data.GetData(DataFormats.Text).ToString();
if (result == "30")
{
LblA2.Visible = false;
PBoxA2.Visible = false;
}
}
private void PBox3DragDrop(object sender, DragEventArgs e)
{
string result = e.Data.GetData(DataFormats.Text).ToString();
if (result == "5")
{
LblA3.Visible = false;
PBoxA3.Visible = false;
}
}
private void PBox4DragDrop(object sender, DragEventArgs e)
{
string result = e.Data.GetData(DataFormats.Text).ToString();
if (result == "18")
{
LblA3.Visible = false;
PBoxA3.Visible = false;
}
}
}
だから、このコードを使用して、どのようにそれだけがボタンの質問でフォームを生成するように設定してもしていないことが、私はできる午前を保存するリストを取得するにはどうすればよいまた、ドラッグ/ドロップ、チェックボックス付き、等...サンプルで使用 ListClassは次のとおりです。私は様々なスタイルIEボタン、ドラッグ&ドロップなど
class ListQuestions
{
private string Questions;
private Bitmap[] Answers; private string[] Ans; //First is for Picbox questions. Second is for button questions.
private int PosOfAns;
public ListQuestions(string questions, Bitmap[] answers, int posOfAns)
{
Questions = questions;
Answers = answers;
PosOfAns = posOfAns;
}
public ListQuestions(string questions, string[] ans, int posOfAns)
{
Questions = questions;
Ans = ans;
PosOfAns = posOfAns;
}
public string GetQuestion()
{
return Questions;
}
public string[] GetAns()
{
return Ans;
}
public Bitmap[] GetAnswers()
{
return Answers;
}
public int GetPosOfAns()
{
return PosOfAns;
}
}
すべてのヘルプははるかに高く評価される:)。