Exemplo n.º 1
0
        public FindForm1(BaseForm father, TreeView tree, DataTable MainTbl, string DisplayField, ArrayList arrExtraFindColumnField)
        {
            InitializeComponent();
            m_FatherForm = father;
            m_tree = tree;
            m_tbl = MainTbl;
            m_Radiobuttons[0] = radioButton1;
            m_Radiobuttons[1] = radioButton2;
            m_Radiobuttons[2] = radioButton3;
            m_Radiobuttons[3] = radioButton4;
            m_Radiobuttons[4] = radioButton5;
            m_Radiobuttons[5] = radioButton6;
            radioButton1.Checked = true;

            bool bKeysContainDisplayField = false;
            foreach (DataColumn col in m_tbl.PrimaryKey)
            {
                if (col.ColumnName.ToLower() == DisplayField.ToLower())
                {
                    bKeysContainDisplayField = true;
                    break;
                }
            }

            if (bKeysContainDisplayField)
            {
                m_FieldsToFind = new string[m_tbl.PrimaryKey.Length];
                for (int i = 0; i < m_tbl.PrimaryKey.Length; i++)
                {
                    m_FieldsToFind[i] = m_tbl.PrimaryKey[i].ColumnName;
                    m_Radiobuttons[i].Text = m_FieldsToFind[i];
                    m_Radiobuttons[i].Tag = m_FieldsToFind[i];
                    m_Radiobuttons[i].Visible = true;
                }
            }
            else
            {
                m_FieldsToFind = new string[m_tbl.PrimaryKey.Length + 1];
                for (int i = 0; i < m_tbl.PrimaryKey.Length; i++)
                {
                    m_FieldsToFind[i] = m_tbl.PrimaryKey[i].ColumnName;
                    m_Radiobuttons[i].Text = m_FieldsToFind[i];
                    m_Radiobuttons[i].Tag = m_FieldsToFind[i];
                    m_Radiobuttons[i].Visible = true;
                }
                m_FieldsToFind[m_FieldsToFind.Length - 1] = DisplayField;
                m_Radiobuttons[m_FieldsToFind.Length - 1].Text = DisplayField;
                m_Radiobuttons[m_FieldsToFind.Length - 1].Tag = DisplayField;
                m_Radiobuttons[m_FieldsToFind.Length - 1].Visible = true;
            }
            //添加额外的查找字段(来自lua脚本)
            AddExtraFindFields(arrExtraFindColumnField, m_FieldsToFind.Length);

            // 初始化当前模块的分类信息
            InitCatInfo();
        }
Exemplo n.º 2
0
 /// <summary>
 /// 初始化BaseForm子窗体
 /// </summary>
 private void InitBaseForm()
 {
     try
     {
         bForm = new BaseForm(modelName);
         bForm.MdiParent = this;
         bForm.WindowState = FormWindowState.Maximized;      
         bForm.Show();
         bForm.Update();     
     }
     catch (Exception ex)
     {
         if (bForm != null)
             bForm.Close();
         MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Stop);
     }
 }
Exemplo n.º 3
0
 public ArrayListEx(BaseForm baseform)
 {
     m_baseForm = baseform;
 }
Exemplo n.º 4
0
        public void OpenForm(string modelname, object locate/*打开后定位到某个结点的依据,通常是一个id.*/)
        {
            foreach (Form frm in this.MdiChildren)
            {
                if (frm is BaseForm && ((BaseForm)frm).ModelName == modelname)
                {
                    frm.Activate();
                    return;
                }
            }

            BaseForm doc = null;
            try
            {
                doc = new BaseForm(modelname);
                doc.MdiParent = this;
                doc.WindowState = FormWindowState.Maximized;
                doc.Show();
                doc.Update();
            }
            catch (Exception ex)
            {
                if (doc != null)
                    doc.Close();
                MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }

            m_CurBaseForm = doc;

            if (locate != null)
            {
                // 定位的代码.

            }
        }