tjx
2025-10-24 cd6496f2fadb885056c35a67fb3caf1a1a765ab1
DevApp/Gs.DevApp/DevFrm/Rk/Frm_MesInvItemArn.cs
@@ -43,6 +43,8 @@
           }, tips);
            // 添加gridView1的RowStyle事件,当退货标识th=1时整行标红
            gridView1.RowStyle += GridView1_RowStyle;
            // 添加gvMx1的RowStyle事件,当处理意见clyj为"退货"时整行标红
            gvMx1.RowStyle += GvMx1_RowStyle;
            Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) =>
            {
                getModel(value);
@@ -141,6 +143,8 @@
                        gvMx1.BestFitColumns();
                        Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx1);
                        ConfigureOaColumns();
                        // 刷新视图样式,使RowStyle事件生效
                        gvMx1.RefreshData();
                    }
                    catch (Exception ex)
                    {
@@ -176,6 +180,37 @@
                    {
                        e.Appearance.BackColor = System.Drawing.Color.Red;
                        e.Appearance.ForeColor = System.Drawing.Color.White;
                    }
                }
            }
        }
        /// <summary>
        /// gvMx1的RowStyle事件,当处理意见clyj为"退货"时整行标红
        /// </summary>
        private void GvMx1_RowStyle(object sender, RowStyleEventArgs e)
        {
            if (e.RowHandle >= 0)
            {
                var view = sender as GridView;
                if (view != null)
                {
                    try
                    {
                        var clyjValue = view.GetRowCellValue(e.RowHandle, "clyj");
                        if (clyjValue != null && !string.IsNullOrEmpty(clyjValue.ToString()))
                        {
                            string clyj = clyjValue.ToString().Trim();
                            if (clyj == "退货")
                            {
                                e.Appearance.BackColor = System.Drawing.Color.Red;
                                e.Appearance.ForeColor = System.Drawing.Color.White;
                            }
                        }
                    }
                    catch
                    {
                        // 如果列不存在,忽略错误
                    }
                }
            }
@@ -583,6 +618,8 @@
                        gvMx1.BestFitColumns();
                        Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx1);
                        ConfigureOaColumns();
                        // 刷新视图样式,使RowStyle事件生效
                        gvMx1.RefreshData();
                    }
                    else
                    {