瀏覽代碼

Merge branch 'OTSRelease3_0' of http://36.129.163.148:30080/gogsadmin/OTS into OTSRelease3_0

gsp 4 月之前
父節點
當前提交
d10eac49b9

+ 28 - 13
OTSIncAReportApp/1-UI/OTSReportExport/Category.Designer.cs

@@ -30,16 +30,18 @@ namespace OTSIncAReportApp._1_UI.OTSReportExport
         private void InitializeComponent()
         {
             this.panel1 = new System.Windows.Forms.Panel();
-            this.checkedListBox1 = new System.Windows.Forms.CheckedListBox();
             this.button4 = new System.Windows.Forms.Button();
             this.button3 = new System.Windows.Forms.Button();
+            this.panel2 = new System.Windows.Forms.Panel();
+            this.checkBox_selall = new System.Windows.Forms.CheckBox();
             this.panel1.SuspendLayout();
             this.SuspendLayout();
             // 
             // panel1
             // 
             this.panel1.BackColor = System.Drawing.SystemColors.ControlLight;
-            this.panel1.Controls.Add(this.checkedListBox1);
+            this.panel1.Controls.Add(this.checkBox_selall);
+            this.panel1.Controls.Add(this.panel2);
             this.panel1.Controls.Add(this.button4);
             this.panel1.Controls.Add(this.button3);
             this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
@@ -48,17 +50,9 @@ namespace OTSIncAReportApp._1_UI.OTSReportExport
             this.panel1.Size = new System.Drawing.Size(244, 413);
             this.panel1.TabIndex = 13;
             // 
-            // checkedListBox1
-            // 
-            this.checkedListBox1.FormattingEnabled = true;
-            this.checkedListBox1.Location = new System.Drawing.Point(12, 12);
-            this.checkedListBox1.Name = "checkedListBox1";
-            this.checkedListBox1.Size = new System.Drawing.Size(217, 356);
-            this.checkedListBox1.TabIndex = 82;
-            // 
             // button4
             // 
-            this.button4.Location = new System.Drawing.Point(154, 374);
+            this.button4.Location = new System.Drawing.Point(166, 387);
             this.button4.Name = "button4";
             this.button4.Size = new System.Drawing.Size(75, 23);
             this.button4.TabIndex = 23;
@@ -68,7 +62,7 @@ namespace OTSIncAReportApp._1_UI.OTSReportExport
             // 
             // button3
             // 
-            this.button3.Location = new System.Drawing.Point(73, 374);
+            this.button3.Location = new System.Drawing.Point(85, 387);
             this.button3.Name = "button3";
             this.button3.Size = new System.Drawing.Size(75, 23);
             this.button3.TabIndex = 22;
@@ -76,6 +70,25 @@ namespace OTSIncAReportApp._1_UI.OTSReportExport
             this.button3.UseVisualStyleBackColor = true;
             this.button3.Click += new System.EventHandler(this.button3_Click);
             // 
+            // panel2
+            // 
+            this.panel2.BackColor = System.Drawing.Color.White;
+            this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+            this.panel2.Location = new System.Drawing.Point(3, 3);
+            this.panel2.Name = "panel2";
+            this.panel2.Size = new System.Drawing.Size(238, 378);
+            this.panel2.TabIndex = 24;
+            // 
+            // checkBox_selall
+            // 
+            this.checkBox_selall.AutoSize = true;
+            this.checkBox_selall.Location = new System.Drawing.Point(3, 391);
+            this.checkBox_selall.Name = "checkBox_selall";
+            this.checkBox_selall.Size = new System.Drawing.Size(48, 16);
+            this.checkBox_selall.TabIndex = 25;
+            this.checkBox_selall.Text = "全选";
+            this.checkBox_selall.UseVisualStyleBackColor = true;
+            // 
             // Category
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@@ -89,6 +102,7 @@ namespace OTSIncAReportApp._1_UI.OTSReportExport
             this.Text = "分类选择";
             this.Load += new System.EventHandler(this.Category_Load);
             this.panel1.ResumeLayout(false);
+            this.panel1.PerformLayout();
             this.ResumeLayout(false);
 
         }
@@ -97,6 +111,7 @@ namespace OTSIncAReportApp._1_UI.OTSReportExport
         private System.Windows.Forms.Panel panel1;
         private System.Windows.Forms.Button button4;
         private System.Windows.Forms.Button button3;
-        private System.Windows.Forms.CheckedListBox checkedListBox1;
+        private System.Windows.Forms.Panel panel2;
+        private System.Windows.Forms.CheckBox checkBox_selall;
     }
 }

+ 93 - 16
OTSIncAReportApp/1-UI/OTSReportExport/Category.cs

@@ -38,25 +38,80 @@ namespace OTSIncAReportApp._1_UI.OTSReportExport
 
         private void Category_Load(object sender, EventArgs e)
         {
-            for (int i = 0; i < ElementList.Rows.Count; i++)
+            if (ElementList != null)
             {
-                checkedListBox1.Items.Add(ElementList.Rows[i]["StrName"].ToString());
+                if (ElementList.Rows.Count > 0)
+                {
+                    FlowLayoutPanel flowLayoutPanel = new FlowLayoutPanel();
+                    flowLayoutPanel.FlowDirection = FlowDirection.LeftToRight;
+                    flowLayoutPanel.WrapContents = true;
+                    flowLayoutPanel.Dock = DockStyle.Fill;
+                    flowLayoutPanel.AutoScroll = true;
+                    flowLayoutPanel.Padding = new Padding(15);
+                    panel2.Controls.Add(flowLayoutPanel);
+                    for (int i = 0; i < ElementList.Rows.Count; i++)
+                    {
+                        // 添加控件到 FlowLayoutPanel 中
+                        CheckBox box1 = new CheckBox();
+                        box1.Text = ElementList.Rows[i]["StrName"].ToString();
+                        box1.Width = flowLayoutPanel.Width - 30;
+                        if (CheckTheOptions.Count == 0)
+                        {
+                            box1.Checked = true;
+                        }
+                        else
+                        {
+                            for (int a = 0; a < CheckTheOptions.Count; a++)
+                            {
+                                if (ElementList.Rows[i]["STDId"].ToString() == CheckTheOptions[a].ToString())
+                                    box1.Checked = true;
+                            }
+                        }
+                        flowLayoutPanel.Controls.Add(box1);
+                    }
+
+                    this.checkBox_selall.CheckedChanged -= new System.EventHandler(this.checkBox_selall_CheckedChanged);
+                    checkBox_selall.Checked = true;
+                    this.checkBox_selall.CheckedChanged += new System.EventHandler(this.checkBox_selall_CheckedChanged);
+                }
             }
-            for (int i = 0; i < checkedListBox1.Items.Count; i++)
+
+        }
+
+
+        private void checkBox_selall_CheckedChanged(object sender, EventArgs e)
+        {
+            if (checkBox_selall.Checked)
             {
-                if (CheckTheOptions.Count == 0)
+                foreach (Control control in panel2.Controls)
                 {
-                    checkedListBox1.SetItemChecked(i, true);
+                    if (control.GetType() == typeof(FlowLayoutPanel))
+                    {
+                        foreach (Control control1 in control.Controls)
+                        {
+                            if (control1.GetType() == typeof(System.Windows.Forms.CheckBox))
+                            {
+                                ((CheckBox)control1).Checked = true;
+                            }
+                        }
+                    }
                 }
-                else
+            }
+            else
+            {
+                foreach (Control control in panel2.Controls)
                 {
-                    for (int a = 0; a < CheckTheOptions.Count; a++)
+                    if (control.GetType() == typeof(FlowLayoutPanel))
                     {
-                        if (ElementList.Rows[i]["STDId"].ToString() == CheckTheOptions[a].ToString())
-                            checkedListBox1.SetItemChecked(i, true);
+                        foreach (Control control1 in control.Controls)
+                        {
+                            if (control1.GetType() == typeof(System.Windows.Forms.CheckBox))
+                            {
+                                ((CheckBox)control1).Checked = false;
+                            }
+                        }
                     }
                 }
-                
             }
         }
 
@@ -68,18 +123,40 @@ namespace OTSIncAReportApp._1_UI.OTSReportExport
         private void button3_Click(object sender, EventArgs e)
         {
             OutElementList.Clear();
-            for (int i=0;i< checkedListBox1.Items.Count;i++)
+            vs.Clear();
+
+            List<bool> blList = new List<bool>();
+            foreach (Control control in panel2.Controls)
+            {
+                if (control.GetType() == typeof(FlowLayoutPanel))
+                {
+                    foreach (Control control1 in control.Controls)
+                    {
+                        if (control1.GetType() == typeof(System.Windows.Forms.CheckBox))
+                        {
+                            if (((CheckBox)control1).Checked)
+                            {
+                                blList.Add(true);
+                                OutElementList.Add(control1.Text);
+                            }
+                            else
+                            {
+                                blList.Add(false);
+                            }
+                        }
+                    }
+                }
+            }
+
+            for (int i=0;i < ElementList.Rows.Count; i++)
             {
-                if (checkedListBox1.GetItemChecked(i))
+                if(blList[i])
                 {
-                    OutElementList.Add(checkedListBox1.Items[i].ToString());
                     vs.Add(ElementList.Rows[i]["STDId"].ToString());
                 }
-               
             }
-            IsModify = true;
-            
 
+            IsModify = true;
             this.Close();
         }
         /// <summary>