Beispiel #1
0
 private void createWorkCtrl()
 {
     // 工作控件
     if (_baseControl == null)
     {
         _baseControl = new BaseListCtrl();
         this.Controls.Add(_baseControl);
     }
     _baseControl.Location = new Point(245, 0);
     _baseControl.Width    = this.Width - _srvTree.Width - 5;
     _baseControl.Height   = this.Height;
 }
        private void lstSources_SelectedIndexChanged(object sender, EventArgs e)
        {
            DataResources aSource = (DataResources)Enum.Parse(typeof(DataResources), lstSources.SelectedItem.ToString().Replace(" ", "_"));

            if (lastCtrl != null)
            {
                this.mainPanel.Controls.Remove((UserControl)lastCtrl);
            }
            switch (aSource)
            {
            case DataResources.Occupations:
            case DataResources.US_Companies:
            case DataResources.LastNames:
            case DataResources.List_Of_Streets:
            case DataResources.List_Of_Countires:
            case DataResources.Male_Names:
            case DataResources.Female_Names:
            case DataResources.European_Companies:
                lastCtrl = new SingleColumnListCtrl();
                break;

            case DataResources.US_Cities:
            case DataResources.Industry_Sectors:
                lastCtrl = new TreeListCtrl();
                break;

            case DataResources.List_Of_US_States:
            case DataResources.US_PostalCodes:
                lastCtrl = new MultiColumnListCrl();
                break;
            }

            lastCtrl.SourceType = aSource;
            this.mainPanel.Controls.Add(lastCtrl, 1, 0);
            this.mainPanel.SetRowSpan(lastCtrl, 2);
            lastCtrl.Dock = DockStyle.Fill;
            lastCtrl.LoadFile(aSource);
            if (editMode)
            {
                lastCtrl.EditRule(Result);
                editMode = false;
            }
        }