Пример #1
0
        public EventSelector()
        {
            InitializeComponent();

            customListView1 = new HelperEditor.CustomListView();
            this.Controls.Add(customListView1);

            //
            // customListView1
            //
            customListView1.CheckBoxes    = true;
            customListView1.Dock          = System.Windows.Forms.DockStyle.Top;
            customListView1.FullRowSelect = true;
            customListView1.GridLines     = true;
            customListView1.Location      = new System.Drawing.Point(0, 0);
            customListView1.MultiSelect   = false;
            customListView1.Name          = "customListView1";
            customListView1.Size          = new System.Drawing.Size(784, 523);
            customListView1.TabIndex      = 5;
            customListView1.UseCompatibleStateImageBehavior = false;
            customListView1.View         = System.Windows.Forms.View.Details;
            customListView1.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.customListView1_ItemChecked);
            customListView1.MouseClick  += new System.Windows.Forms.MouseEventHandler(this.customListView1_MouseClick);

            // 先录入内容
            string[,] tTabContent = TabFile.EventData.GetTabContent();
            for (int i = 1; i < TabFile.EventData.RecordLengthMax; i++)
            {
                int nMainKeyValue = TabFile.EventData.GetColIndexByFieldName(TabFile.EventData.MainKeyName);
                if (tTabContent[i, nMainKeyValue] != "")
                {
                    ListViewItem listViewItem = new ListViewItem();
                    for (int j = 1; j < TabFile.EventData.FieldLength; j++)
                    {
                        listViewItem.SubItems.Add(tTabContent[i, j]);
                    }

                    listViewItem.Text = tTabContent[i, nMainKeyValue];
                    listViewItem.Name = tTabContent[i, nMainKeyValue];
                    customListView1.Items.Add((listViewItem));
                }
            }

            // 再录入表头以及调整宽度(自适应)
            foreach (string szFieldName in TabFile.EventData.GetTabHeader())
            {
                ColumnHeader headerItem = customListView1.Columns.Add(szFieldName, szFieldName);
                headerItem.Width = -1;
            }
        }
Пример #2
0
        public EventSelector()
        {
            InitializeComponent();

            customListView1 = new HelperEditor.CustomListView();
            this.Controls.Add(customListView1);

            // 
            // customListView1
            // 
            customListView1.CheckBoxes = true;
            customListView1.Dock = System.Windows.Forms.DockStyle.Top;
            customListView1.FullRowSelect = true;
            customListView1.GridLines = true;
            customListView1.Location = new System.Drawing.Point(0, 0);
            customListView1.MultiSelect = false;
            customListView1.Name = "customListView1";
            customListView1.Size = new System.Drawing.Size(784, 523);
            customListView1.TabIndex = 5;
            customListView1.UseCompatibleStateImageBehavior = false;
            customListView1.View = System.Windows.Forms.View.Details;
            customListView1.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.customListView1_ItemChecked);
            customListView1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.customListView1_MouseClick);

            // 先录入内容
            string[,] tTabContent = TabFile.EventData.GetTabContent();
            for (int i = 1; i < TabFile.EventData.RecordLengthMax; i++)
            {
                int nMainKeyValue = TabFile.EventData.GetColIndexByFieldName(TabFile.EventData.MainKeyName);
                if (tTabContent[i, nMainKeyValue] != "")
                {
                    ListViewItem listViewItem = new ListViewItem();
                    for (int j = 1; j < TabFile.EventData.FieldLength; j++)
                    {
                        listViewItem.SubItems.Add(tTabContent[i, j]);
                    }

                    listViewItem.Text = tTabContent[i, nMainKeyValue];
                    listViewItem.Name = tTabContent[i, nMainKeyValue];
                    customListView1.Items.Add((listViewItem));
                }
            }

            // 再录入表头以及调整宽度(自适应)
            foreach (string szFieldName in TabFile.EventData.GetTabHeader())
            {
                ColumnHeader headerItem = customListView1.Columns.Add(szFieldName, szFieldName);
                headerItem.Width = -1;
            }
        }