Пример #1
0
        private void GoPage(int index)
        {
            Container.Clear();

            int startLocationY = 0;

            int start = (index - 1) * UctPage.PrePageCount;
            int end   = Math.Min(dt.Rows.Count, index * UctPage.PrePageCount);

            UctWordEn card = null;

            for (int i = start; i < end; i++)
            {
                card            = new UctWordEn(dt.Rows[i]);
                card.Location   = new Point(0, startLocationY);
                card.Anchor     = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
                startLocationY += card.Height;
                Container.Add(card);
            }
            //PALWords.Select();
            if (Para.AUTO_PLAY && UctPage.PrePageCount == 1 && card != null)
            {
                card.PlayAutio();
            }
        }
Пример #2
0
        /// <summary>
        /// 将单词显示一个新的dialog窗口里
        /// </summary>
        /// <param name="words"></param>
        public static void ShowWordDialog(Word[] words)
        {
            DataRow[] dr             = words.ToDataRow();
            Dialog    dialog         = new Dialog();//在新的线程里创建的窗口,线程结束后,窗口使用的资源就会被释放
            int       startLocationY = 0;
            UctWordEn card           = null;

            for (int i = 0; i < dr.Length; i++)
            {
                card            = new UctWordEn(dr[i]);
                card.Location   = new Point(0, startLocationY);
                card.Anchor     = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
                startLocationY += card.Height;
                dialog.UctPal.Controls.Add(card);
                dialog.Text = words[0].Value;
            }
            dialog.Show();//showdialog 必须先关掉才能操作其他画面,show可以随便操作其他画面
        }
Пример #3
0
        /// <summary>
        /// 查词 按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnSearch_Click(object sender, EventArgs e)
        {
            Container.Clear();
            DataRow[] dr = dt.Select(string.Format("Value like '%{0}%'", TexSearch.Text.Trim()));

            int       startLocationY = 0;
            UctWordEn card           = null;

            if (dr.Length == 0)
            {
                Word[] words = Engine.DealWord(TexSearch.Text.Trim());
                dr = words.ToDataRow();
            }

            for (int i = 0; i < dr.Length; i++)
            {
                card            = new UctWordEn(dr[i]);
                card.Location   = new Point(0, startLocationY);
                card.Anchor     = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
                startLocationY += card.Height;
                Container.Add(card);
            }
        }