From 8b404bae187ed85b650c9aece6602532c586f5ea Mon Sep 17 00:00:00 2001
From: lu <99954486@qq.com>
Date: 星期三, 16 四月 2025 09:32:20 +0800
Subject: [PATCH] select from

---
 DevApp/Gs.DevApp/DevFrm/PDA/SelectCk.cs             |   29 +++--
 DevApp/Gs.DevApp/DevFrm/PDA/SelectPage.cs           |   78 +--------------
 DevApp/Gs.DevApp/DevFrm/PDA/SelectCk.Designer.cs    |   37 +++----
 DevApp/Gs.DevApp/App.config                         |    4 
 DevApp/Gs.DevApp/DevFrm/PDA/SelectPrint.Designer.cs |   25 +++-
 DevApp/Gs.DevApp/DevFrm/PDA/SelectPrint.cs          |   28 +++--
 DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs           |   73 ++++++++++++++
 7 files changed, 151 insertions(+), 123 deletions(-)

diff --git a/DevApp/Gs.DevApp/App.config b/DevApp/Gs.DevApp/App.config
index 09d6be2..2d4703e 100644
--- a/DevApp/Gs.DevApp/App.config
+++ b/DevApp/Gs.DevApp/App.config
@@ -28,8 +28,8 @@
 		</assemblyBinding>
 	</runtime>
     <appSettings>
-		 <!--<add key="WebApiUrl" value="http://localhost:5263/" />-->
-		<add key="WebApiUrl" value="http://192.168.1.145:81/" /> 
+		 <add key="WebApiUrl" value="http://localhost:5263/" />
+		<!--<add key="WebApiUrl" value="http://192.168.1.145:81/" />--> 
         <add key="LogPath" value="logs" />
         <add key="ProductName" value="骞挎繁绉戞妧 G-MES V2.0" />
         <add key="PageSize" value="50" />
diff --git a/DevApp/Gs.DevApp/DevFrm/PDA/SelectCk.Designer.cs b/DevApp/Gs.DevApp/DevFrm/PDA/SelectCk.Designer.cs
index 666df3d..7618878 100644
--- a/DevApp/Gs.DevApp/DevFrm/PDA/SelectCk.Designer.cs
+++ b/DevApp/Gs.DevApp/DevFrm/PDA/SelectCk.Designer.cs
@@ -31,10 +31,10 @@
             this.panelControl2 = new DevExpress.XtraEditors.PanelControl();
             this.gcMain = new DevExpress.XtraGrid.GridControl();
             this.gridView1 = new DevExpress.XtraGrid.Views.Grid.GridView();
+            this.gridColumn3 = new DevExpress.XtraGrid.Columns.GridColumn();
             this.gv_depotCode = new DevExpress.XtraGrid.Columns.GridColumn();
             this.gv_depotName = new DevExpress.XtraGrid.Columns.GridColumn();
             this.gv_depottype = new DevExpress.XtraGrid.Columns.GridColumn();
-            this.gv_createBy = new DevExpress.XtraGrid.Columns.GridColumn();
             this.gv_isNg = new DevExpress.XtraGrid.Columns.GridColumn();
             this.gridColumn2 = new DevExpress.XtraGrid.Columns.GridColumn();
             this.gridColumn1 = new DevExpress.XtraGrid.Columns.GridColumn();
@@ -76,10 +76,10 @@
             this.gridView1.Appearance.Row.Options.UseFont = true;
             this.gridView1.ColumnPanelRowHeight = 60;
             this.gridView1.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] {
+            this.gridColumn3,
             this.gv_depotCode,
             this.gv_depotName,
             this.gv_depottype,
-            this.gv_createBy,
             this.gv_isNg,
             this.gridColumn2,
             this.gridColumn1});
@@ -87,10 +87,18 @@
             this.gridView1.IndicatorWidth = 50;
             this.gridView1.Name = "gridView1";
             this.gridView1.OptionsFind.ShowSearchNavButtons = false;
-            this.gridView1.OptionsSelection.MultiSelect = true;
-            this.gridView1.OptionsSelection.MultiSelectMode = DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode.CheckBoxRowSelect;
-            this.gridView1.OptionsView.ShowAutoFilterRow = true;
             this.gridView1.OptionsView.ShowGroupPanel = false;
+            this.gridView1.OptionsView.ShowAutoFilterRow = true;
+            // 
+            // gridColumn3
+            // 
+            this.gridColumn3.Caption = ".";
+            this.gridColumn3.FieldName = "chkInt";
+            this.gridColumn3.MinWidth = 25;
+            this.gridColumn3.Name = "gridColumn3";
+            this.gridColumn3.Visible = true;
+            this.gridColumn3.VisibleIndex = 0;
+            this.gridColumn3.Width = 94;
             // 
             // gv_depotCode
             // 
@@ -131,19 +139,6 @@
             this.gv_depottype.VisibleIndex = 3;
             this.gv_depottype.Width = 80;
             // 
-            // gv_createBy
-            // 
-            this.gv_createBy.AppearanceCell.Options.UseFont = true;
-            this.gv_createBy.Caption = "浠撳簱璐熻矗浜�";
-            this.gv_createBy.FieldName = "createBy";
-            this.gv_createBy.MinWidth = 50;
-            this.gv_createBy.Name = "gv_createBy";
-            this.gv_createBy.OptionsColumn.AllowEdit = false;
-            this.gv_createBy.Tag = "query_a.create_by";
-            this.gv_createBy.Visible = true;
-            this.gv_createBy.VisibleIndex = 4;
-            this.gv_createBy.Width = 71;
-            // 
             // gv_isNg
             // 
             this.gv_isNg.AppearanceCell.Options.UseFont = true;
@@ -173,13 +168,13 @@
             // gridColumn1
             // 
             this.gridColumn1.Caption = "浣跨敤缁勭粐";
-            this.gridColumn1.FieldName = "fSubsidiary";
+            this.gridColumn1.FieldName = "fSubsidiary2";
             this.gridColumn1.MinWidth = 50;
             this.gridColumn1.Name = "gridColumn1";
             this.gridColumn1.OptionsColumn.AllowEdit = false;
             this.gridColumn1.Tag = "org.FNumber";
             this.gridColumn1.Visible = true;
-            this.gridColumn1.VisibleIndex = 7;
+            this.gridColumn1.VisibleIndex = 6;
             this.gridColumn1.Width = 250;
             // 
             // panelControl1
@@ -237,8 +232,8 @@
         private DevExpress.XtraGrid.Columns.GridColumn gv_depotCode;
         private DevExpress.XtraGrid.Columns.GridColumn gv_depotName;
         private DevExpress.XtraGrid.Columns.GridColumn gv_depottype;
-        private DevExpress.XtraGrid.Columns.GridColumn gv_createBy;
         private DevExpress.XtraGrid.Columns.GridColumn gv_isNg;
         private DevExpress.XtraGrid.Columns.GridColumn gridColumn2;
+        private DevExpress.XtraGrid.Columns.GridColumn gridColumn3;
     }
 }
\ No newline at end of file
diff --git a/DevApp/Gs.DevApp/DevFrm/PDA/SelectCk.cs b/DevApp/Gs.DevApp/DevFrm/PDA/SelectCk.cs
index 39032f8..0d4e9a4 100644
--- a/DevApp/Gs.DevApp/DevFrm/PDA/SelectCk.cs
+++ b/DevApp/Gs.DevApp/DevFrm/PDA/SelectCk.cs
@@ -21,20 +21,29 @@
         public SelectCk(string _userGuid)
         {
             InitializeComponent();
+            this.gridView1.CustomDrawColumnHeader += (s, e) => { Gs.DevApp.ToolBox.UtilityHelper.CustomDrawColumnHeader(s, e); };
+            this.gridView1.MouseUp += (s, e) => { Gs.DevApp.ToolBox.UtilityHelper.CustomMouseUp(s, e, gcMain, gridView1); };
             this.userGuid = _userGuid;
             Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, null, null, null, "", null, null, false);
             getPageList(1);
             btnIn.Click += (s, e) =>
             {
+                gridView1.PostEditor();
+                gridView1.UpdateCurrentRow();
                 System.Text.StringBuilder sbList = new System.Text.StringBuilder();
-                int[] rows = this.gridView1.GetSelectedRows();//鍏堣幏鍙栭�夋嫨琛岀殑琛屽彿
-                DataTable dt = this.gcMain.DataSource as DataTable;//寰楀埌GridControl鐨勬暟鎹簮
-                foreach (int idx in rows)
+                DataTable dt = this.gcMain.DataSource as DataTable;
                 {
-                    string _guid = dt.Rows[idx]["guid"].ToString();
-                    if (sbList.Length > 0)
-                        sbList.Append(",");
-                    sbList.Append(_guid);
+                    foreach (DataRow dr in dt.Rows)
+                    {
+                        string checkBox = dr["chkInt"].ToString();
+                        string _guid = dr["guid"].ToString();
+                        if (Gs.DevApp.ToolBox.UtilityHelper.ToCheck(checkBox))
+                        {
+                            if (sbList.Length > 0)
+                                sbList.Append(",");
+                            sbList.Append(_guid);
+                        }
+                    }
                 }
                 var _obj = new
                 {
@@ -42,6 +51,7 @@
                     bindGuidslist = sbList.ToString(),
                     fType = "浠撳簱",
                 };
+
                 try
                 {
                     var strJson = UtilityHelper.HttpPost("",
@@ -68,13 +78,12 @@
         private void getPageList(int curPage)
         {
             var _sbSqlWhere = "";
-            var pgq = new PageQueryModel(curPage, 999999, "org.FNumber asc ,a.depot_code", "asc",
-                "", _sbSqlWhere.ToString());
+            var pgq = new PageQueryModel(curPage, 999999, "org.FNumber asc ,a.depot_code", "asc", "", _sbSqlWhere.ToString(), userGuid);
             var json = JsonConvert.SerializeObject(pgq);
             try
             {
                 var strReturn = UtilityHelper.HttpPost("",
-                    _webServiceName + "GetListPage", json);
+                    _webServiceName + "GetListPage2", json);
                 var dd = UtilityHelper.ReturnToTablePage(strReturn);
                 if (dd.rtnCode > 0)
                 {
diff --git a/DevApp/Gs.DevApp/DevFrm/PDA/SelectPage.cs b/DevApp/Gs.DevApp/DevFrm/PDA/SelectPage.cs
index d5e23e9..72aeeb3 100644
--- a/DevApp/Gs.DevApp/DevFrm/PDA/SelectPage.cs
+++ b/DevApp/Gs.DevApp/DevFrm/PDA/SelectPage.cs
@@ -1,13 +1,11 @@
-锘縰sing DevExpress.XtraGrid.Columns;
-using DevExpress.XtraGrid.Views.Grid;
-using Gs.DevApp.Entity;
+锘縰sing Gs.DevApp.Entity;
 using Gs.DevApp.ToolBox;
 using Newtonsoft.Json;
 using System;
 using System.Data;
-using System.Drawing;
+
 using System.Windows.Forms;
-using System.Windows.Forms.VisualStyles;
+
 
 namespace Gs.DevApp.DevFrm.PDA
 {
@@ -24,13 +22,15 @@
         public SelectPage(string _userGuid)
         {
             InitializeComponent();
-            this.gridView1.CustomDrawColumnHeader += (s, e) => { gridViewLeftList_CustomDrawColumnHeader(s, e); };
-            this.gridView1.MouseUp += (s, e) => { gridViewLeftList_MouseUp(s, e); };
+            this.gridView1.CustomDrawColumnHeader += (s, e) => { Gs.DevApp.ToolBox.UtilityHelper.CustomDrawColumnHeader(s, e); };
+            this.gridView1.MouseUp += (s, e) => { Gs.DevApp.ToolBox.UtilityHelper.CustomMouseUp(s, e, gcMain, gridView1); };
             this.userGuid = _userGuid;
             Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, null, null, null, "", null, null, false);
             getPageList(1);
             btnIn.Click += (s, e) =>
             {
+                gridView1.PostEditor();
+                gridView1.UpdateCurrentRow();
                 System.Text.StringBuilder sbList = new System.Text.StringBuilder();
                 DataTable dt = this.gcMain.DataSource as DataTable;
                 {
@@ -110,69 +110,5 @@
             }
         }
 
-
-        #region 缁樺埗琛ㄥご鍏ㄩ�夊嬀閫夋
-        /// <summary>
-        /// 缁樺埗琛ㄥご鍏ㄩ�夊嬀閫夋
-        /// </summary>
-        private Rectangle checkBoxColumnHeaderRect = Rectangle.Empty;
-        private GridColumn checkBoxColumn = null;
-        private void gridViewLeftList_CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
-        {
-            if (e.Column != null && e.Column.AbsoluteIndex == 0)
-            {
-                e.Column.Caption = "";
-                checkBoxColumnHeaderRect = e.Bounds;
-                checkBoxColumn = e.Column;
-                //椤绘妸鍒楀ご鏍囬璁剧疆涓虹┖
-                e.Painter.DrawObject(e.Info);
-                //鍦ㄥ垪澶翠腑蹇冩樉绀哄閫夋
-                int x = e.Bounds.X + (int)((e.Bounds.Width - CheckBoxRenderer.GetGlyphSize(e.Graphics, CheckBoxState.UncheckedNormal).Width) * 0.5);
-                int y = e.Bounds.Y + (int)((e.Bounds.Height - CheckBoxRenderer.GetGlyphSize(e.Graphics, CheckBoxState.UncheckedNormal).Height) * 0.5);
-                Point location = new Point(x, y);
-                CheckBoxState checkBoxState;
-                if (e.Column.Tag != null && e.Column.Tag.ToString() == "1")
-                    checkBoxState = CheckBoxState.CheckedPressed;
-                else
-                    checkBoxState = CheckBoxState.UncheckedNormal;
-                CheckBoxRenderer.DrawCheckBox(e.Graphics, location, checkBoxState);
-                e.Handled = true;
-            }
-        }
-
-        private void gridViewLeftList_MouseUp(object sender, MouseEventArgs e)
-        {
-            if (checkBoxColumnHeaderRect != Rectangle.Empty)
-            {
-                if (e.X > checkBoxColumnHeaderRect.X && e.X < (checkBoxColumnHeaderRect.X + checkBoxColumnHeaderRect.Width) && e.Y > checkBoxColumnHeaderRect.Y && e.Y < (checkBoxColumnHeaderRect.Y + checkBoxColumnHeaderRect.Height))
-                {
-                    DataTable _Table = (DataTable)gcMain.DataSource;
-                    if (checkBoxColumn.Tag != null && checkBoxColumn.Tag.ToString() == "1")
-                    {
-                        checkBoxColumn.Tag = "0";
-                        foreach (DataRow row in _Table.Rows)
-                        {
-                            row["chkInt"] = false;
-                        }
-                    }
-                    else
-                    {
-                        checkBoxColumn.Tag = "1";
-                        foreach (DataRow row in _Table.Rows)
-                        {
-                            row["chkInt"] = true;
-                        }
-                    }
-                    gcMain.BindingContext = new BindingContext();
-                    gcMain.DataSource = _Table;
-                    gcMain.ForceInitialize();
-                    gridView1.CloseEditor();
-                    gridView1.PostEditor();
-                    gridView1.UpdateCurrentRow();
-                    gridView1.InvalidateColumnHeader(checkBoxColumn);
-                }
-            }
-        }
-        #endregion
     }
 }
\ No newline at end of file
diff --git a/DevApp/Gs.DevApp/DevFrm/PDA/SelectPrint.Designer.cs b/DevApp/Gs.DevApp/DevFrm/PDA/SelectPrint.Designer.cs
index 29d34da..6f58b75 100644
--- a/DevApp/Gs.DevApp/DevFrm/PDA/SelectPrint.Designer.cs
+++ b/DevApp/Gs.DevApp/DevFrm/PDA/SelectPrint.Designer.cs
@@ -31,6 +31,7 @@
             this.panelControl2 = new DevExpress.XtraEditors.PanelControl();
             this.gcMain = new DevExpress.XtraGrid.GridControl();
             this.gridView1 = new DevExpress.XtraGrid.Views.Grid.GridView();
+            this.gridColumn1 = new DevExpress.XtraGrid.Columns.GridColumn();
             this.gv_depotCode = new DevExpress.XtraGrid.Columns.GridColumn();
             this.gv_depottype = new DevExpress.XtraGrid.Columns.GridColumn();
             this.gv_createBy = new DevExpress.XtraGrid.Columns.GridColumn();
@@ -52,7 +53,7 @@
             this.panelControl2.Dock = System.Windows.Forms.DockStyle.Fill;
             this.panelControl2.Location = new System.Drawing.Point(0, 0);
             this.panelControl2.Name = "panelControl2";
-            this.panelControl2.Size = new System.Drawing.Size(645, 691);
+            this.panelControl2.Size = new System.Drawing.Size(595, 691);
             this.panelControl2.TabIndex = 4;
             // 
             // gcMain
@@ -61,7 +62,7 @@
             this.gcMain.Location = new System.Drawing.Point(2, 2);
             this.gcMain.MainView = this.gridView1;
             this.gcMain.Name = "gcMain";
-            this.gcMain.Size = new System.Drawing.Size(641, 644);
+            this.gcMain.Size = new System.Drawing.Size(591, 644);
             this.gcMain.TabIndex = 6;
             this.gcMain.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
             this.gridView1});
@@ -73,6 +74,7 @@
             this.gridView1.Appearance.Row.Options.UseFont = true;
             this.gridView1.ColumnPanelRowHeight = 60;
             this.gridView1.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] {
+            this.gridColumn1,
             this.gv_depotCode,
             this.gv_depottype,
             this.gv_createBy,
@@ -81,10 +83,18 @@
             this.gridView1.IndicatorWidth = 50;
             this.gridView1.Name = "gridView1";
             this.gridView1.OptionsFind.ShowSearchNavButtons = false;
-            this.gridView1.OptionsSelection.MultiSelect = true;
-            this.gridView1.OptionsSelection.MultiSelectMode = DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode.CheckBoxRowSelect;
             this.gridView1.OptionsView.ShowAutoFilterRow = true;
             this.gridView1.OptionsView.ShowGroupPanel = false;
+            // 
+            // gridColumn1
+            // 
+            this.gridColumn1.Caption = ".";
+            this.gridColumn1.FieldName = "chkInt";
+            this.gridColumn1.MinWidth = 25;
+            this.gridColumn1.Name = "gridColumn1";
+            this.gridColumn1.Visible = true;
+            this.gridColumn1.VisibleIndex = 0;
+            this.gridColumn1.Width = 94;
             // 
             // gv_depotCode
             // 
@@ -144,7 +154,7 @@
             this.panelControl1.Dock = System.Windows.Forms.DockStyle.Bottom;
             this.panelControl1.Location = new System.Drawing.Point(2, 646);
             this.panelControl1.Name = "panelControl1";
-            this.panelControl1.Size = new System.Drawing.Size(641, 43);
+            this.panelControl1.Size = new System.Drawing.Size(591, 43);
             this.panelControl1.TabIndex = 5;
             // 
             // btnIn
@@ -155,7 +165,7 @@
             this.btnIn.AppearancePressed.Options.UseBackColor = true;
             this.btnIn.Dock = System.Windows.Forms.DockStyle.Right;
             this.btnIn.ImageOptions.Image = global::Gs.DevApp.Properties.Resources.selectvaluespivottable_16x16;
-            this.btnIn.Location = new System.Drawing.Point(545, 2);
+            this.btnIn.Location = new System.Drawing.Point(495, 2);
             this.btnIn.Name = "btnIn";
             this.btnIn.Size = new System.Drawing.Size(94, 39);
             this.btnIn.TabIndex = 4;
@@ -165,7 +175,7 @@
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 18F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(645, 691);
+            this.ClientSize = new System.Drawing.Size(595, 691);
             this.Controls.Add(this.panelControl2);
             this.IconOptions.Image = global::Gs.DevApp.Properties.Resources.logo_png_black;
             this.MaximizeBox = false;
@@ -193,5 +203,6 @@
         private DevExpress.XtraGrid.Columns.GridColumn gv_depottype;
         private DevExpress.XtraGrid.Columns.GridColumn gv_createBy;
         private DevExpress.XtraGrid.Columns.GridColumn gv_isNg;
+        private DevExpress.XtraGrid.Columns.GridColumn gridColumn1;
     }
 }
\ No newline at end of file
diff --git a/DevApp/Gs.DevApp/DevFrm/PDA/SelectPrint.cs b/DevApp/Gs.DevApp/DevFrm/PDA/SelectPrint.cs
index acb56d1..0ef26c3 100644
--- a/DevApp/Gs.DevApp/DevFrm/PDA/SelectPrint.cs
+++ b/DevApp/Gs.DevApp/DevFrm/PDA/SelectPrint.cs
@@ -20,20 +20,29 @@
         public SelectPrint(string _userGuid)
         {
             InitializeComponent();
+            this.gridView1.CustomDrawColumnHeader += (s, e) => { Gs.DevApp.ToolBox.UtilityHelper.CustomDrawColumnHeader(s, e); };
+            this.gridView1.MouseUp += (s, e) => { Gs.DevApp.ToolBox.UtilityHelper.CustomMouseUp(s, e, gcMain, gridView1); };
             this.userGuid = _userGuid;
             Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, null, null, null, "", null, null, false);
             getPageList(1);
             btnIn.Click += (s, e) =>
             {
+                gridView1.PostEditor();
+                gridView1.UpdateCurrentRow();
                 System.Text.StringBuilder sbList = new System.Text.StringBuilder();
-                int[] rows = this.gridView1.GetSelectedRows();//鍏堣幏鍙栭�夋嫨琛岀殑琛屽彿
-                DataTable dt = this.gcMain.DataSource as DataTable;//寰楀埌GridControl鐨勬暟鎹簮
-                foreach (int idx in rows)
+                DataTable dt = this.gcMain.DataSource as DataTable;
                 {
-                    string _guid = dt.Rows[idx]["guid"].ToString();
-                    if (sbList.Length > 0)
-                        sbList.Append(",");
-                    sbList.Append(_guid);
+                    foreach (DataRow dr in dt.Rows)
+                    {
+                        string checkBox = dr["chkInt"].ToString();
+                        string _guid = dr["guid"].ToString();
+                        if (Gs.DevApp.ToolBox.UtilityHelper.ToCheck(checkBox))
+                        {
+                            if (sbList.Length > 0)
+                                sbList.Append(",");
+                            sbList.Append(_guid);
+                        }
+                    }
                 }
                 var _obj = new
                 {
@@ -67,12 +76,11 @@
         private void getPageList(int curPage)
         {
             var _sbSqlWhere = "";
-            var pgq = new PageQueryModel(curPage, 999999, "a.print_no", "asc",
-                "", _sbSqlWhere.ToString());
+            var pgq = new PageQueryModel(curPage, 999999, "a.print_no", "asc", "", _sbSqlWhere.ToString(), userGuid);
             var json = JsonConvert.SerializeObject(pgq);
             try
             {
-                var strReturn = UtilityHelper.HttpPost("", _webServiceName + "GetListPage", json);
+                var strReturn = UtilityHelper.HttpPost("", _webServiceName + "GetListPage2", json);
                 var dd = UtilityHelper.ReturnToTablePage(strReturn);
                 if (dd.rtnCode > 0)
                 {
diff --git a/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs b/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs
index 580873b..e74487a 100644
--- a/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs
+++ b/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs
@@ -28,6 +28,7 @@
 using System.Text.RegularExpressions;
 using System.Threading.Tasks;
 using System.Windows.Forms;
+using System.Windows.Forms.VisualStyles;
 using UserControls.Data;
 using static System.Windows.Forms.Control;
 
@@ -1721,7 +1722,7 @@
                 }
             };
             gridView1.OptionsView.ColumnAutoWidth = false;//鑷姩璋冩暣鍒楀
-
+          
             if (isPostSearch == true)
             {
                 gridView1.OptionsView.ShowGroupPanel = false;
@@ -2097,7 +2098,75 @@
                 return 0;
             return decimal.Parse(txt);
         }
-      
+
+
+        #region 缁樺埗琛ㄥご鍏ㄩ�夊嬀閫夋
+        /// <summary>
+        /// 缁樺埗琛ㄥご鍏ㄩ�夊嬀閫夋
+        /// </summary>
+        //  private Rectangle checkBoxColumnHeaderRect = Rectangle.Empty;
+        // private GridColumn checkBoxColumn = null;
+        public static void CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
+        {
+            Rectangle checkBoxColumnHeaderRect = new Rectangle(51, 1, 37, 57);
+            if (e.Column != null && e.Column.AbsoluteIndex == 0)
+            {
+                //X = 51 Y = 1 Width = 37 Height = 57
+                e.Column.Caption = ".";
+                checkBoxColumnHeaderRect = e.Bounds;
+                // checkBoxColumn = e.Column;
+                //椤绘妸鍒楀ご鏍囬璁剧疆涓虹┖
+                e.Painter.DrawObject(e.Info);
+                //鍦ㄥ垪澶翠腑蹇冩樉绀哄閫夋
+                int x = e.Bounds.X + (int)((e.Bounds.Width - CheckBoxRenderer.GetGlyphSize(e.Graphics, CheckBoxState.UncheckedNormal).Width) * 0.5);
+                int y = e.Bounds.Y + (int)((e.Bounds.Height - CheckBoxRenderer.GetGlyphSize(e.Graphics, CheckBoxState.UncheckedNormal).Height) * 0.5);
+                Point location = new Point(x, y);
+                CheckBoxState checkBoxState;
+                if (e.Column.Tag != null && e.Column.Tag.ToString() == "1")
+                    checkBoxState = CheckBoxState.CheckedPressed;
+                else
+                    checkBoxState = CheckBoxState.UncheckedNormal;
+                CheckBoxRenderer.DrawCheckBox(e.Graphics, location, checkBoxState);
+                e.Handled = true;
+            }
+        }
+
+        public static void CustomMouseUp(object sender, MouseEventArgs e, DevExpress.XtraGrid.GridControl gcMain, DevExpress.XtraGrid.Views.Grid.GridView gridView1)
+        {
+            GridColumn checkBoxColumn = gridView1.Columns[0];
+            Rectangle checkBoxColumnHeaderRect = new Rectangle(51, 1, 37, 57);
+            if (checkBoxColumnHeaderRect != Rectangle.Empty)
+            {
+                if (e.X > checkBoxColumnHeaderRect.X && e.X < (checkBoxColumnHeaderRect.X + checkBoxColumnHeaderRect.Width) && e.Y > checkBoxColumnHeaderRect.Y && e.Y < (checkBoxColumnHeaderRect.Y + checkBoxColumnHeaderRect.Height))
+                {
+                    DataTable _Table = (DataTable)gcMain.DataSource;
+                    if (checkBoxColumn.Tag != null && checkBoxColumn.Tag.ToString() == "1")
+                    {
+                        checkBoxColumn.Tag = "0";
+                        foreach (DataRow row in _Table.Rows)
+                        {
+                            row["chkInt"] = false;
+                        }
+                    }
+                    else
+                    {
+                        checkBoxColumn.Tag = "1";
+                        foreach (DataRow row in _Table.Rows)
+                        {
+                            row["chkInt"] = true;
+                        }
+                    }
+                    gcMain.BindingContext = new BindingContext();
+                    gcMain.DataSource = _Table;
+                    gcMain.ForceInitialize();
+                    gridView1.CloseEditor();
+                    gridView1.PostEditor();
+                    gridView1.UpdateCurrentRow();
+                    gridView1.InvalidateColumnHeader(checkBoxColumn);
+                }
+            }
+        }
+        #endregion
     }
 
     /// <summary>

--
Gitblit v1.9.3