Ejemplo n.º 1
0
 private void button1_Click(object sender, EventArgs e) //検索ボタンが押された
 {
     if (textBox1.TextLength == 0)                      //単語名(必須)が入力されてない
     {
         MessageBox.Show("単語名を入力してください!");
         return;
     }
     ken.Set(textBox1.Text);//セット
     if (textBox2.TextLength != 0)
     {
         ken.Set(textBox2.Text);                          //分類名が入力されてる
     }
     if (ken.Run() == -1)
     {
         MessageBox.Show("エラー発生!");
         return;
     }
     if (ken.GetStats() == 1)  //単語が一つヒット
     {
         mobj.kiban = ken;     //メインウィンドウに単語情報を渡す
         mobj.Picture_Paint(); //メインウィンドウの画面の更新
     }
     else//複数ヒット
     {
         kensaku2 kensaku2 = new kensaku2(mobj, ken);//検索候補選択ダイアログ生成
         kensaku2.Show();
     }
     this.Close();
 }
Ejemplo n.º 2
0
 private void button2_Click(object sender, EventArgs e)//次へボタンが押された
 {
     if ((now + 1) * 5 >= ken.GetStats())
     {
         MessageBox.Show("これ以上ありません!");
         return;
     }
     label1.Text = "次の中から選択してください" + ken.GetStats() + "件中 " + ((now + 1) * 5 + 1) + "~" + (ken.GetStats() >= (now + 2) * 5 ? (now + 2) * 5 : ken.GetStats()) + "件目"; //表示する文字列作成
     for (int i = 0, j = (now + 1) * 5; i < 5; i++, j++)                                                                                                             //チェックボックスにセットする
     {
         if (j >= ken.GetStats())                                                                                                                                    //存在しない
         {
             boxes[i].Text = "";
             continue;
         }
         boxes[i].Text = ken.word + ":" + ken.Cjunl[j];
     }
     ++now;
 }
Ejemplo n.º 3
0
        private CheckBox[] boxes;                      //チェックボックスの実体をまとめるための配列

        public kensaku2(Form1 obj, KIBAN_KENSAKU Kobj) //コンストラクタ(引数1:メインウィンドウの実体のポインタ 引数2:引き継ぐ単語の検索をするためのクラスの実体
        {
            InitializeComponent();
            form1       = obj;
            ken         = Kobj; //引継ぎ
            now         = 0;    //初期値
            boxes       = new CheckBox[5];
            boxes[0]    = checkBox1;
            boxes[1]    = checkBox2;
            boxes[2]    = checkBox3;
            boxes[3]    = checkBox4;
            boxes[4]    = checkBox5;
            label1.Text = "次の中から選択してください" + ken.GetStats() + "件中 " + "1~" + (ken.GetStats() >= 5 ? 5 : ken.GetStats()) + "件目"; //表示する文字列作成
            for (int i = 0; i < 5; i++)                                                                                        //チェックボックスにセットする
            {
                if (i >= ken.GetStats())                                                                                       //存在しない
                {
                    boxes[i].Text = "";
                    continue;
                }
                boxes[i].Text = ken.word + ":" + ken.Cjunl[i];
            }
        }