Ejemplo n.º 1
0
        /// <summary>
        /// Popup时设置选中项
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ctlTreeSelect_Popup(object sender, EventArgs e)
        {
            //在设置Value同时设置FocusedNode,可能存在TreeList因为没有显示所以Node数为0的控件问题
            TreeListNode node = ctlTreeList.FindNodeByFieldValue(this.ValueMember, this.value);

            if (ctlTreeList.FocusedNode != node)
            {
                ctlTreeList.FocusedNode = node;
            }
            if (ctlTreeList.FocusedNode == null && ctlTreeList.Nodes.Count > 0)
            {
                ctlTreeList.FocusedNode = ctlTreeList.FindNodeByID(0);
            }

            //value为空时录入第一个字符弹出浮动框时未过滤_不运行Application.DoEvents则this.Text此时不对
            Application.DoEvents();
            if (this.GetType().Name.ToLower() == ICD10_CONTROL)
            {
                if (this.IcdDataSource != null && string.IsNullOrEmpty(this.Text) == false)
                {
                    this.DoFilter();
                }
            }
            else
            {
                if (this.DataSource != null && this.value == null && string.IsNullOrEmpty(this.Text) == false)
                {
                    this.DoFilter();
                }
            }
        }