Example #1
0
        private void SelectBabys()
        {
            lst           = new ListBox();
            lst.Dock      = System.Windows.Forms.DockStyle.Fill;
            this.listform = new Form();
            listform.Size = new Size(200, 100);
            for (int i = 0; i < this.alBabyInfo.Count; i++)
            {
                neusoft.neuFC.Object.neuObject obj;
                obj = (neusoft.neuFC.Object.neuObject) this.alBabyInfo[i];
                lst.Items.Add(obj.ID + "  " + obj.Name);
            }

            lst.Visible = true;
            lst.Show();
            lst.KeyDown      += new KeyEventHandler(lst_KeyDown);
            lst.DoubleClick  += new EventHandler(lst_DoubleClick);
            listform.Closing += new CancelEventHandler(listform_Closing);
            listform.Controls.Add(lst);
            listform.Text            = "请选择婴儿信息";
            listform.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
            listform.TopMost         = true;

            listform.Show();
            listform.Location = this.chkIsBaby.PointToScreen(new Point(this.chkIsBaby.Width / 2 + this.chkIsBaby.Left, this.chkIsBaby.Height + this.chkIsBaby.Top));
            try
            {
                lst.SelectedIndex = 0;
                lst.Focus();
                lst.LostFocus += new EventHandler(lst_LostFocus);
            }
            catch {}
            return;
        }
Example #2
0
 private void rb_CheckedChanged(object sender, System.EventArgs e)
 {
     ClearIncrementalText();
     if (rbCriar.Checked)
     {
         gbEscolher.Enabled = false;
         gbCriar.Enabled    = true;
         txtCriar.Focus();
         if (lstEscolher.SelectedItem != null)
         {
             txtCriar.Text = lstEscolher.SelectedItem.ToString();
             txtCriar.SelectAll();
         }
     }
     else if (rbEscolher.Checked)
     {
         txtCriar.Clear();
         gbCriar.Enabled    = false;
         gbEscolher.Enabled = true;
         lstEscolher.Focus();
     }
     if (TermoChanged != null)
     {
         TermoChanged();
     }
 }
Example #3
0
        public GAtomicNewGameForm()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //

            String[] files         = Directory.GetFiles(Directory.GetCurrentDirectory() + "\\formulas", "*.gaf");
            String[] formula_names = new String [files.GetLength(0)];
            int      index         = 0;

            foreach (String file in files)
            {
                formula_names[index] = file.Substring(file.LastIndexOf("\\") + 1);
                formula_names[index] = formula_names[index].Substring(0, formula_names[index].LastIndexOf("."));
                index++;
            }

            foreach (String formula_name in formula_names)
            {
                listBoxFormulas.Items.Add(formula_name);
            }

            selected_formula = "";

            listBoxFormulas.Focus();

            game_area_rows = 0;
            game_area_cols = 0;
        }
Example #4
0
 private void txtStep_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         btnAdd_Click(sender, e);
         lstValList.Focus();
         e.Handled = true;
     }
 }
Example #5
0
        private void DlgToolManager_Load(object sender, System.EventArgs e)
        {
            refreshToolsListBox(null);

            Project.setDlgIcon(this);

            helpLabel.Text = "in the Arguments or URL field the %lat% and %lon% tokens will be substituted for actual coordinates in the center of the map or at the right-click point.\n\"%file%\" stands for latest recent .GPX or .LOC file.";

            toolsListBox.Focus();
        }
 public bool IsSelected(ListBox listbox)
 {
     if (Convert.ToInt32(listbox.SelectedIndex) == -1)
     {
         MessageBox.Show("Du måste välja en låt i listan!");
         listbox.Focus();
         return false;
     }
     return true;
 }
Example #7
0
 private void textFilter_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Down)
     {
         if (!checkMulti.Checked && listMain.Items.Count != 0)
         {
             listMain.Focus();
             if (listMain.SelectedIndex < listMain.Items.Count - 1)
             {
                 listMain.SelectedIndex++;
             }
         }
     }
 }
Example #8
0
 public void LoadSavedFilters(string filterType, System.Windows.Forms.ListBox lb)
 {
     try
     {
         lb.DataSource = AddUserFilters("BongoFilter");
     }
     catch (Exception ex) {
         var response = MessageBox.Show(ex.Message, ex.Message, MessageBoxButtons.YesNoCancel);
         if (response.ToString() == "yes")
         {
             System.Diagnostics.Debug.Write(response.ToString() + "\n");
             lb.Focus();
         }
     }
     System.Diagnostics.Debug.Write("success\n");
 }
Example #9
0
		private void LeaveEditMode()
		{
			lstValores.Enabled = true;
			btnAdicionar.Enabled = true;
			btnEditar.Enabled = true;
			btnRemover.Enabled = true;
			UpdateButtonState();

			txtDesignacao.Enabled = false;
			btnAplicar.Enabled = false;
			this.AcceptButton = btnAdicionar;
			btnCancelar.Enabled = false;

			txtDesignacao.Text = "";
			lstValores.Focus();
		}
Example #10
0
        private void InternalExecute()
        {
            if (_listBox.Items.Count == 1)
            {
                ExecuteItem(_listBox.Items[0] as Item);
                Done();
            }
            else
            {
                _listBox.Show();
                _listBox.Focus();

                if (_listBox.Items.Count > 0)
                {
                    _listBox.SelectedIndex = 0;
                }
            }
        }
Example #11
0
        public void server()
        {
            try
            {
                UdpClient sock = new UdpClient(9050);
                sock.JoinMulticastGroup(IPAddress.Parse(txt_host.Text), 50);
                IPEndPoint iep = new IPEndPoint(IPAddress.Any, 0);

                byte[] data       = sock.Receive(ref iep);
                string stringData = Encoding.ASCII.GetString(data, 0, data.Length);
                listBox1.Items.Add(iep.Address.ToString() + " :_  " + stringData);
                sock.Close();
                listBox1.Focus();
                msg.Focus();
                myth.Abort();
            }
            catch (Exception) {}
        }
Example #12
0
        private void SelectPatient()
        {
            lst      = new ListBox();
            lst.Dock = System.Windows.Forms.DockStyle.Fill;

            this.listform = new Form();
            //用窗口显示
            try
            {
                this.listform.Close();
            }
            catch {}
            listform.Size            = new Size(200, 100);
            listform.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;

            for (int i = 0; i < this.alInpatientNos.Count; i++)
            {
                neusoft.neuFC.Object.neuObject obj;
                obj = (neusoft.neuFC.Object.neuObject) this.alInpatientNos[i];
                lst.Items.Add(obj.ID + "  " + obj.Name + "  " + obj.Memo);
            }

            lst.Visible      = true;
            lst.DoubleClick += new EventHandler(lst_DoubleClick);
            lst.KeyDown     += new KeyEventHandler(lst_KeyDown);
            lst.Show();

            listform.Controls.Add(lst);

            listform.TopMost = true;

            listform.Show();
            listform.Location = this.txtInputCode.PointToScreen(new Point(this.txtInputCode.Width / 2 + this.txtInputCode.Left, this.txtInputCode.Height + this.txtInputCode.Top));
            try
            {
                lst.SelectedIndex = 0;
                lst.Focus();
                lst.LostFocus += new EventHandler(lst_LostFocus);
            }
            catch {}
            return;
        }
Example #13
0
        void enableButtons(bool editing)
        {
            _editing          = editing;
            lstClips.Enabled  = !editing && _clips != null;
            btnAdd.Enabled    = !editing;
            btnRemove.Enabled = !editing && lstClips.SelectedItem != null;

            btnUpdate.Enabled  = editing;
            btnDiscard.Enabled = editing;

            itmSaveAs.Enabled = _clips != null && !_editing;
            itmSave.Enabled   = !_editing && _clips != null && _filename != "" && _filename != null;

            if (editing == true)
            {
                txtClipText.Focus();
            }
            else
            {
                lstClips.Focus();
            }
        }
Example #14
0
        public GAtomicChoiceForm(String current_game)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            selected_game = "";

            String[] files      = Directory.GetFiles(Directory.GetCurrentDirectory() + "\\games", "*.gagh");
            String[] game_names = new String [files.GetLength(0)];
            int      index      = 0;

            foreach (String file in files)
            {
                game_names[index] = file.Substring(file.LastIndexOf("\\") + 1);
                game_names[index] = game_names[index].Substring(0, game_names[index].LastIndexOf("."));
                index++;
            }

            foreach (String game_name in game_names)
            {
                listBoxGames.Items.Add(game_name);
            }

            listBoxGames.Focus();

            for (int k = 0; k < listBoxGames.Items.Count; k++)
            {
                if ((String)listBoxGames.Items[k] == current_game)
                {
                    listBoxGames.SelectedIndex = k;
                    break;
                }
            }
        }
Example #15
0
        private void OnKeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == '.')
            {

                int position = _tbCode.SelectionStart;
                string parameter = GetActiveParameter(_tbCode.Text.Substring(0, position));

                var cb = new ListBox { Cursor = Cursors.Arrow };

                var methods = new List<string>();

                if (AutoCompletion.GetProperties(_scriptScope, parameter, methods))
                {
                    methods.ForEach(m => cb.Items.Add(m));

                    var f = new Font("Microsoft Sans Serif", 9F);
                    cb.Width = 300;
                    _tbCode.Controls.Add(cb);

                    cb.Location = GetListBoxLocation();
                    cb.Focus();
                    cb.SelectedIndex = 0;
                    cb.Sorted = true;
                    cb.Height = 200;
                    cb.Font = f;

                    cb.DoubleClick += (o, i) =>
                    {
                        var s = cb.SelectedItem.ToString();
                        _tbCode.Text = _tbCode.Text.Insert(position + 1, s);
                        _tbCode.Controls.Remove(cb);
                        _tbCode.SelectionStart = position + 1 + s.Length;
                        _tbCode.SelectionLength = 0;
                        _tbCode.ScrollToCaret();
                    };

                    cb.KeyPress += (o, ev) =>
                    {
                        if (ev.KeyChar == (int)Keys.Enter)
                        {
                            var s = cb.SelectedItem.ToString();
                            _tbCode.Text = _tbCode.Text.Insert(position + 1, s);
                            _tbCode.Controls.Remove(cb);
                            _tbCode.SelectionStart = position + 1 + s.Length;
                            _tbCode.SelectionLength = 0;
                            _tbCode.ScrollToCaret();
                        }
                    };
                }
            }
        }
        private void SelectPatient()
        {
            lst      = new ListBox();
            lst.Dock = System.Windows.Forms.DockStyle.Fill;

            this.listform = new System.Windows.Forms.Form();
            //用窗口显示
            try
            {
                //this.listform.Close();
            }
            catch { }
            listform.Size            = new Size(200, 100);
            listform.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
            Neusoft.HISFC.Models.Base.Employee        user        = new Neusoft.HISFC.Models.Base.Employee();
            Neusoft.HISFC.BizLogic.Manager.Department managerDept = new Neusoft.HISFC.BizLogic.Manager.Department();
            for (int i = 0; i < this.alInpatientNos.Count; i++)
            {
                Neusoft.FrameWork.Models.NeuObject obj;
                obj = (Neusoft.FrameWork.Models.NeuObject) this.alInpatientNos[i];
                Neusoft.HISFC.Models.RADT.InStateEnumService VisitStatus = new Neusoft.HISFC.Models.RADT.InStateEnumService();
                VisitStatus.ID = obj.Memo;
                bool b = false;
                switch (this.myShowState)//过滤患者状态
                {
                case enuShowState.InHos:
                    if (obj.Memo == "I")
                    {
                        b = true;
                    }
                    break;

                case enuShowState.OutHos:
                    if (obj.Memo == "B" || obj.Memo == "O" || obj.Memo == "P" || obj.Memo == "N")
                    {
                        b = true;
                    }
                    break;

                case enuShowState.BeforeArrived:
                    if (obj.Memo == "R")
                    {
                        b = true;
                    }
                    break;

                case enuShowState.AfterArrived:
                    if (obj.Memo != "R")
                    {
                        b = true;
                    }
                    break;

                case enuShowState.InhosBeforBalanced:
                    if (obj.Memo == "B" || obj.Memo == "I" || obj.Memo == "P" || obj.Memo == "R")
                    {
                        b = true;
                    }
                    break;

                case enuShowState.InhosAfterBalanced:
                    if (obj.Memo == "O")
                    {
                        b = true;
                    }
                    break;

                case enuShowState.InBalanced:
                    if (obj.Memo == "B")
                    {
                        b = true;
                    }
                    break;

                default:
                    b = true;
                    break;
                }
                if (b && this.isRestrictOwnDept)//过滤病区-科室
                {
                    b = false;
                    if (user.EmployeeType.ID.ToString() == "N")//护士站
                    {
                        Neusoft.FrameWork.Models.NeuObject dept = new Neusoft.FrameWork.Models.NeuObject();
                        ArrayList alDept = managerDept.GetDeptFromNurseStation(user.Nurse);
                        if (alDept == null)
                        {
                        }
                        else
                        {
                            for (int k = 0; k < alDept.Count; i++)
                            {
                                dept = alDept[k] as Neusoft.FrameWork.Models.NeuObject;
                                if (dept.ID == obj.User01)
                                {
                                    b = true;
                                    break;
                                }
                            }
                        }
                    }
                    else
                    {
                        if (user.Dept.ID == obj.User01)//科室对应上
                        {
                            b = true;
                        }
                    }
                }
                if (b)
                {
                    //显示住院流水号,姓名,在院状态
                    try
                    {
                        lst.Items.Add(obj.ID + "  " + obj.Name + "  " + VisitStatus.Name);
                    }
                    catch
                    {
                        lst.Items.Add(obj.ID + "  " + obj.Name + "  " + obj.Memo);
                    }
                    this.strInpatientNo = obj.ID;
                }
            }
            if (lst.Items.Count == 1)
            {
                try
                {
                    this.listform.Close();
                }
                catch { }
                try
                {
                    this.Text = this.strInpatientNo.Substring(4, 10);
                    this.myEvent();
                }
                catch { }
                return;
            }

            //			if(lst.Items.Count <=0) return;
            if (lst.Items.Count <= 0)
            {
                this.strInpatientNo = "";
                this.myEvent();
                return;
            }

            lst.Visible      = true;
            lst.DoubleClick += new EventHandler(lst_DoubleClick);
            lst.KeyDown     += new KeyEventHandler(lst_KeyDown);
            lst.Show();

            listform.Controls.Add(lst);

            listform.TopMost = true;

            listform.Show();
            listform.Location = this.txtInputCode.PointToScreen(new Point(this.txtInputCode.Width / 2 + this.txtInputCode.Left, this.txtInputCode.Height + this.txtInputCode.Top));
            try
            {
                lst.SelectedIndex = 0;
                lst.Focus();
                lst.LostFocus += new EventHandler(lst_LostFocus);
            }
            catch { }
            return;
        }
        private void SelectPatient()
        {
            lst      = new ListBox();
            lst.Dock = System.Windows.Forms.DockStyle.Fill;
            lst.Items.Clear();
            this.listform = new System.Windows.Forms.Form();
            //用窗口显示
            try
            {
                //this.listform.Close();
            }
            catch { }
            listform.Size            = new Size(300, 200);
            listform.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
            Neusoft.HISFC.Models.Base.Employee        user        = this.orderManagement.Operator as Neusoft.HISFC.Models.Base.Employee;
            Neusoft.HISFC.BizLogic.Manager.Department managerDept = new Neusoft.HISFC.BizLogic.Manager.Department();
            for (int i = 0; i < this.alSeeNo.Count; i++)
            {
                Neusoft.FrameWork.Models.NeuObject obj;
                obj = (Neusoft.FrameWork.Models.NeuObject) this.alSeeNo[i];
                bool b = false;
                if (this.isRestrictOwnDept)//过滤病区-科室
                {
                    b = false;
                    if (user.EmployeeType.ID.ToString() == "N")//护士站
                    {
                        Neusoft.FrameWork.Models.NeuObject dept = new Neusoft.FrameWork.Models.NeuObject();
                        ArrayList alDept = managerDept.GetDeptFromNurseStation(user.Nurse);
                        if (alDept == null)
                        {
                        }
                        else
                        {
                            for (int k = 0; k < alDept.Count; i++)
                            {
                                dept = alDept[k] as Neusoft.FrameWork.Models.NeuObject;
                                if (dept.ID == obj.User01)
                                {
                                    b = true;
                                    break;
                                }
                            }
                        }
                    }
                    else
                    {
                        if (user.Dept.ID == obj.User01)//科室对应上
                        {
                            b = true;
                        }
                    }
                }
                else
                {
                    b = true;
                }
                if (b)
                {
                    //显示看诊序号,姓名,看诊日期(去掉时间),看诊科室
                    try
                    {
                        lst.Items.Add(obj.ID + "  " + obj.Name + "  " + obj.User02 + "  " + obj.Memo.Substring(0, obj.Memo.IndexOf(" ")) + "  " + obj.User03);//+"  " + managerDept.GetDeptmentById(obj.User01).Name);
                    }
                    catch
                    {
                        lst.Items.Add(obj.ID + "  " + obj.Name + "  " + obj.User02 + "  " + obj.Memo + "  " + obj.User03);
                    }
                    this.strSeeNo = obj.ID;
                }
            }
            if (lst.Items.Count == 1)
            {
                try
                {
                    this.listform.Close();
                }
                catch { }
                try
                {
                    this.Text = this.strSeeNo.Substring(4, 10);
                    this.myEvents();
                }
                catch { }
                return;
            }

            if (lst.Items.Count <= 0)
            {
                this.strSeeNo = "";
                this.myEvents();
                return;
            }

            lst.Visible      = true;
            lst.DoubleClick += new EventHandler(lst_DoubleClick);
            lst.KeyDown     += new KeyEventHandler(lst_KeyDown);
            lst.Show();

            listform.Controls.Add(lst);

            listform.TopMost = true;

            listform.Show();
            listform.Location = this.txtInputCode.PointToScreen(new Point(this.txtInputCode.Width / 2 + this.txtInputCode.Left, this.txtInputCode.Height + this.txtInputCode.Top));
            try
            {
                lst.SelectedIndex = 0;
                lst.Focus();
                lst.LostFocus += new EventHandler(lst_LostFocus);
            }
            catch { }
            return;
        }
Example #18
0
 private void MoveBoxItem(ListBox src, ListBox dest)
 {
     if (src.SelectedItem == null) {
         return;
     }
     if (((TableMapping)src.SelectedItem).Mode == MappingMode.Frozen) {
         return;
     }
     var selIndex = src.SelectedIndex - 1;
     var seletedItems = new List<object>();
     foreach (var item in src.SelectedItems) {
         seletedItems.Add(item);
     }
     dest.Items.AddRange(seletedItems.ToArray());
     foreach (var item in seletedItems) {
         src.Items.Remove(item);
     }
     if (src.Items.Count > 0) {
         src.SelectedIndex = selIndex < 0 ? 0 : selIndex;
     }
     src.Focus();
 }
Example #19
0
        /// <summary>
        /// 选择病人
        /// </summary>
        private void SelectPatient()
        {
            lst      = new System.Windows.Forms.ListBox();
            lst.Dock = System.Windows.Forms.DockStyle.Fill;
            lst.Items.Clear();
            this.listform = new System.Windows.Forms.Form();
            //用窗口显示

            listform.Size            = new Size(300, 200);
            listform.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
            Neusoft.HISFC.Models.Base.Employee        user        = this.orderManagement.Operator as Neusoft.HISFC.Models.Base.Employee;
            Neusoft.HISFC.BizLogic.Manager.Department managerDept = new Neusoft.HISFC.BizLogic.Manager.Department();
            for (int i = 0; i < this.alInfo.Count; i++)
            {
                Neusoft.FrameWork.Models.NeuObject obj;
                obj = (Neusoft.FrameWork.Models.NeuObject) this.alInfo[i];
                bool b = false;
                if (this.isShowOwnDept)//过滤病区-科室
                {
                    b = false;
                    if (user.EmployeeType.ID.ToString() == "N")//护士站
                    {
                        Neusoft.FrameWork.Models.NeuObject dept = new Neusoft.FrameWork.Models.NeuObject();
                        ArrayList alDept = managerDept.GetDeptFromNurseStation(user.Nurse);
                        if (alDept == null)
                        {
                        }
                        else
                        {
                            for (int k = 0; k < alDept.Count; i++)
                            {
                                dept = alDept[k] as Neusoft.FrameWork.Models.NeuObject;
                                if (dept.ID == obj.User01)
                                {
                                    b = true;
                                    break;
                                }
                            }
                        }
                    }
                    else
                    {
                        if (user.Dept.ID == obj.User01)//科室对应上
                        {
                            b = true;
                        }
                    }
                }
                else
                {
                    b = true;
                }
                if (b)
                {
                    try
                    {
                        lst.Items.Add(obj);
                    }
                    catch { }
                }
            }
            if (lst.Items.Count == 1)
            {
                try
                {
                    this.listform.Close();
                }
                catch { }
                try
                {
                    this.selectedEvents();
                }
                catch { }
                return;
            }

            if (lst.Items.Count <= 0)
            {
                this.NoInfo();
                this.selectedEvents();
                return;
            }

            lst.Visible      = true;
            lst.DoubleClick += new EventHandler(lst_DoubleClick);
            lst.KeyDown     += new KeyEventHandler(lst_KeyDown);
            lst.Show();

            listform.Controls.Add(lst);
            listform.TopMost = true;
            listform.Owner   = this.FindForm();
            listform.Show();

            #region 设置显示位置
            Point    tp      = new Point(0, this.Height);
            Point    p       = this.PointToScreen(tp);
            Screen[] screens = Screen.AllScreens;
            int      width   = screens[0].Bounds.Width;
            int      height  = screens[0].Bounds.Height;

            if (width - p.X < listform.Width)
            {
                tp = new Point(tp.X - listform.Width + this.Width, tp.Y);
            }
            if (height - p.Y < listform.Height)
            {
                tp = new Point(tp.X, tp.Y - this.Height - listform.Height - 4);
            }
            listform.Location = this.PointToScreen(tp);
            #endregion

            try
            {
                lst.SelectedIndex = 0;
                lst.Focus();
                lst.LostFocus += new EventHandler(lst_LostFocus);
            }
            catch { }
            return;
        }
Example #20
0
        public static void AutoCompleteTextBox(TextBox txtControl, ListBox lstControl, 
            List<string> lstAutoCompleteList, KeyEventArgs txtControlKEA)
        {
            Point cp;
            GetCaretPos(out cp);
            List<string> lstTemp = new List<string>();
            //Positioning the Listbox on TextBox by Type Insertion Cursor position
            lstControl.SetBounds(cp.X + txtControl.Location.X, cp.Y + txtControl.Location.Y + 20, 150, 50);

            var TempFilteredList = lstAutoCompleteList.Where
                (n => n.StartsWith(GetLastString(txtControl.Text))).Select(r => r);

            lstTemp = TempFilteredList.ToList<string>();
            if (lstTemp.Count != 0 && GetLastString(txtControl.Text) != "")
            {
                lstControl.DataSource = lstTemp;
                lstControl.Show();
                lstControl.BringToFront();
            }
            else
            {
                lstControl.Hide();
            }

            //Code for focusing ListBox Items While Pressing Down and UP Key.
            if (txtControlKEA.KeyCode == Keys.Down)
            {
                lstControl.SelectedIndex = 0;
                lstControl.Focus();
                txtControlKEA.Handled = true;
            }
            else if (txtControlKEA.KeyCode == Keys.Up)
            {
                lstControl.SelectedIndex = lstControl.Items.Count - 1;
                lstControl.Focus();
                txtControlKEA.Handled = true;
            }

            //text box key press event
            txtControl.KeyPress += (s, kpeArgs) =>
            {

                if (kpeArgs.KeyChar == (char)Keys.Enter)
                {
                    if (lstControl.Visible)
                    {
                        lstControl.Focus();
                    }
                    kpeArgs.Handled = true;
                }
                else if (kpeArgs.KeyChar == (char)Keys.Escape)
                {
                    lstControl.Visible = false;
                    kpeArgs.Handled = true;
                }
                else if (kpeArgs.KeyChar == (char)Keys.Tab)
                {
                    txtControl.Text = ((ListBox)s).SelectedItem.ToString();
                    txtControl.Select(txtControl.Text.Length, 0);
                    txtControl.Focus();
                    lstControl.Hide();
                }
            };

            txtControl.LostFocus += (s, eventArgs) =>
                {
                    if (!lstControl.Focused)
                        lstControl.Hide();
                };

            //listbox keyup event
            lstControl.KeyUp += (s, kueArgs) =>
            {
                if (kueArgs.KeyCode == Keys.Tab)
                {
                    //string StrLS = GetLastString(txtControl.Text);
                    //int LIOLS = txtControl.Text.LastIndexOf(StrLS);
                    //string TempStr = txtControl.Text.Remove(LIOLS);
                    //txtControl.Text = TempStr + ((ListBox)s).SelectedItem.ToString();
                    txtControl.Text = ((ListBox)s).SelectedItem.ToString();
                    txtControl.Select(txtControl.Text.Length, 0);
                    txtControl.Focus();
                    lstControl.Hide();
                }
                else if (kueArgs.KeyCode == Keys.Escape)
                {
                    lstControl.Hide();
                    txtControl.Focus();
                }
            };
        }
Example #21
0
 /// <summary>
 /// Called when the step is activated.
 /// </summary>
 /// <param name="steps">The step list.</param>
 public void OnStepIn(WizardStepList steps)
 {
     this.Show();
     databaseList.Focus();
 }
Example #22
0
 private void chooseType(int selectedIndex, ListBox sender)
 {
     changeCurrentTypeAndRefreshLists((TypeVisualUnit)sender.Items[selectedIndex]);
     sender.Focus();
 }
Example #23
0
        private void AddProdBtn_Click(object sender, EventArgs e)
        {
            this.SuspendLayout();
            this.ProductsPanel.Height += 21;
            this.Height += 21;
            int i = Convert.ToInt16(ProdItemsTxt.Text);

            if (i == 1)
            {
                this.RemoveProdBtn1.Visible = true;
            }
            i++;
            ProdItemsTxt.Text            = i.ToString();
            proditems                    = i;
            this.AddProdBtn1.Location    = new Point(AddProdBtn1.Location.X, AddProdBtn1.Location.Y + 21);
            this.RemoveProdBtn1.Location = new Point(RemoveProdBtn1.Location.X, RemoveProdBtn1.Location.Y + 21);
            this.ProdPanel.Height       += 21;
            System.Windows.Forms.Label   AaTxt             = new System.Windows.Forms.Label();
            System.Windows.Forms.TextBox IdProdTxt         = new System.Windows.Forms.TextBox();
            System.Windows.Forms.TextBox DescrProdTxt      = new System.Windows.Forms.TextBox();
            System.Windows.Forms.TextBox QuantProdTxt      = new System.Windows.Forms.TextBox();
            System.Windows.Forms.ListBox SearchNameListBox = new System.Windows.Forms.ListBox();
            AaTxt.Text         = i.ToString();
            AaTxt.BackColor    = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
            AaTxt.Font         = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            AaTxt.TextAlign    = System.Drawing.ContentAlignment.TopCenter;
            AaTxt.Name         = "AaTxt" + i;
            AaTxt.Location     = new Point(AaTxt1.Location.X, AaTxt1.Location.Y + 21 * (i - 1));
            AaTxt.Size         = AaTxt1.Size;
            AaTxt.Font         = AaTxt1.Font;
            IdProdTxt.Name     = "IdProdTxt" + i;
            IdProdTxt.Location = new Point(IdProdTxt1.Location.X, IdProdTxt1.Location.Y + 21 * (i - 1));
            IdProdTxt.Size     = IdProdTxt1.Size;
            IdProdTxt.AutoCompleteCustomSource = IdProdTxt1.AutoCompleteCustomSource;
            IdProdTxt.AutoCompleteMode         = IdProdTxt1.AutoCompleteMode;
            IdProdTxt.AutoCompleteSource       = IdProdTxt1.AutoCompleteSource;
            IdProdTxt.Font             = IdProdTxt1.Font;
            SearchNameListBox.Name     = "SearchNameListBox" + i;
            SearchNameListBox.Location = new Point(SearchNameListBox1.Location.X, SearchNameListBox1.Location.Y + 21 * (i - 1));
            SearchNameListBox.Size     = SearchNameListBox1.Size;
            SearchNameListBox.Visible  = false;
            SearchNameListBox.Font     = SearchNameListBox1.Font;
            DescrProdTxt.Name          = "DescrProdTxt" + i;
            DescrProdTxt.Location      = new Point(DescrProdTxt1.Location.X, DescrProdTxt1.Location.Y + 21 * (i - 1));
            DescrProdTxt.Size          = DescrProdTxt1.Size;
            DescrProdTxt.Font          = DescrProdTxt1.Font;
            QuantProdTxt.Name          = "QuantProdTxt" + i;
            QuantProdTxt.Location      = new Point(QuantProdTxt1.Location.X, QuantProdTxt1.Location.Y + 21 * (i - 1));
            QuantProdTxt.Size          = QuantProdTxt1.Size;
            QuantProdTxt.Font          = QuantProdTxt1.Font;
            ToolTip Tool = new ToolTip();

            this.ProductsPanel.Controls.Add(AaTxt);
            this.ProductsPanel.Controls.Add(IdProdTxt);
            this.ProductsPanel.Controls.Add(SearchNameListBox);
            this.ProductsPanel.Controls.Add(DescrProdTxt);
            this.ProductsPanel.Controls.Add(QuantProdTxt);
            this.ProdPanel.SendToBack();
            {
                SearchNameListBox.KeyPress += (object sender11, KeyPressEventArgs e11) =>
                {
                    if (e11.KeyChar == (char)13)
                    {
                        if (SearchNameListBox.SelectedItem != null)
                        {
                            this.SuspendLayout();
                            DescrProdTxt.Focus();
                            DescrProdTxt.Text         = SearchNameListBox.SelectedItem.ToString();
                            SearchNameListBox.Visible = false;
                            this.ResumeLayout(false);
                        }
                    }
                };

                DescrProdTxt.KeyDown += (object sender12, KeyEventArgs e12) =>
                {
                    if (e12.KeyData == Keys.Down)
                    {
                        if (SearchNameListBox.Visible == true && SearchNameListBox.Items.Count >= 1)
                        {
                            SearchNameListBox.Focus();
                            SearchNameListBox.SelectedIndex = 0;
                        }
                    }
                };
                QuantProdTxt.TextChanged += (object sender1, EventArgs e1) =>
                {
                    QuantProdTxt.Text           = QuantProdTxt.Text.Replace(',', '.');
                    QuantProdTxt.SelectionStart = QuantProdTxt.Text.Length;
                };
                IdProdTxt.TextChanged += (object sender2, EventArgs e2) =>
                {
                    if (IdProdTxt.Focused)
                    {
                        if (dc.ContainsKey(IdProdTxt.Text))
                        {
                            string outcome;
                            string outcome2;
                            dc.TryGetValue(IdProdTxt.Text, out outcome);
                            dscr.TryGetValue(IdProdTxt.Text, out outcome2);
                            DescrProdTxt.Text = outcome;
                            Tool.Active       = true;
                            Tool.InitialDelay = 100;
                            Tool.ReshowDelay  = 100;
                            Tool.IsBalloon    = false;
                            Tool.ToolTipIcon  = ToolTipIcon.Info;
                            Tool.ToolTipTitle = "Αναλυτική Περιγραφή";
                            Tool.SetToolTip(DescrProdTxt, outcome2);
                            Tool.SetToolTip(IdProdTxt, outcome2);
                        }
                        else
                        {
                            DescrProdTxt.Text = "";
                            Tool.SetToolTip(DescrProdTxt, null);
                            Tool.SetToolTip(IdProdTxt, null);
                            Tool.Active = false;
                        }
                    }
                };
                DescrProdTxt.TextChanged += (object sender3, EventArgs e3) =>
                {
                    this.SuspendLayout();
                    if (DescrProdTxt.Focused)
                    {
                        SearchNameListBox.Height = 21;
                        SearchNameListBox.Items.Clear();
                        if (DescrProdTxt.TextLength > 0)
                        {
                            SearchNameListBox.Height = 21;
                            string[] s2 = DescrProdTxt.Text.Split(' ');
                            foreach (var item in ls)
                            {
                                int Contain = 0;
                                foreach (var item2 in s2)
                                {
                                    if (Checks.RemoveDiacritics(item.ToUpper()).Contains(Checks.RemoveDiacritics(item2.ToUpper())) && item2 != "")
                                    {
                                        Contain++;
                                    }
                                }
                                if (Contain == s2.Count())
                                {
                                    SearchNameListBox.Visible = true;
                                    SearchNameListBox.Items.Add(item);
                                }
                            }
                            if (SearchNameListBox.Items.Count == 1)
                            {
                                SearchNameListBox.Height = 42;
                            }
                            else if (SearchNameListBox.Items.Count == 2)
                            {
                                SearchNameListBox.Height = 63;
                            }
                            else if (SearchNameListBox.Items.Count >= 3)
                            {
                                SearchNameListBox.Height = 84;
                            }
                        }
                        else
                        {
                            SearchNameListBox.Height  = 21;
                            SearchNameListBox.Visible = false;
                        }
                        if (dc.ContainsValue(DescrProdTxt.Text))
                        {
                            foreach (var item in dc)
                            {
                                if (item.Value == DescrProdTxt.Text)
                                {
                                    IdProdTxt.Text = item.Key;
                                    string outcome;
                                    dscr.TryGetValue(item.Key, out outcome);
                                    Tool.Active       = true;
                                    Tool.InitialDelay = 100;
                                    Tool.ReshowDelay  = 100;
                                    Tool.IsBalloon    = true;
                                    Tool.ToolTipIcon  = ToolTipIcon.Info;
                                    Tool.ToolTipTitle = "Αναλυτική Περιγραφή";
                                    Tool.SetToolTip(DescrProdTxt, outcome);
                                    Tool.SetToolTip(IdProdTxt, outcome);
                                }
                            }
                        }
                        else
                        {
                            IdProdTxt.Text = "";
                            Tool.SetToolTip(DescrProdTxt, null);
                            Tool.SetToolTip(IdProdTxt, null);
                            Tool.Active = false;
                        }
                    }
                    this.ResumeLayout(false);
                };

                DescrProdTxt.Leave += (object sender4, EventArgs e5) =>
                {
                    this.SuspendLayout();
                    if (SearchNameListBox.Focused != true)
                    {
                        SearchNameListBox.Visible = false;
                    }
                    this.ResumeLayout(false);
                };

                SearchNameListBox.Click += (object sender5, EventArgs e5) =>
                {
                    if (SearchNameListBox.SelectedItem != null)
                    {
                        this.SuspendLayout();
                        DescrProdTxt.Focus();
                        DescrProdTxt.Text         = SearchNameListBox.SelectedItem.ToString();
                        SearchNameListBox.Visible = false;
                        this.ResumeLayout(false);
                    }
                };

                SearchNameListBox.Leave += (object sender6, EventArgs e6) =>
                {
                    SearchNameListBox.Visible = false;
                };
            }
            this.ResumeLayout(false);
        }
Example #24
0
 private void frmManageDocAndNur_Load(object sender, System.EventArgs e)
 {
     lstAllEmployee.Focus();
 }