zoukankan      html  css  js  c++  java
  • Developer Express控件gridcontrol中gridView的某一个单元格是否可以自由输入

    场景:在Developer Express控件gridcontrol中的gridView中,当医生开的临时医嘱的医嘱类型为"中草药","计价总量"单元格不可以自由可输入,其余的医嘱类型,"计价总量"则可以自由输入。

    由于查询资料,只有设置列的属性,没有设置某一个单元格的属性。参考链接:http://www.docin.com/p-278065085.html

    解决办法:通过行焦点改变事件和列焦点改变事件进行控制单元格是否可用输入。

            private void gridView_Lsyz_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
            {
                if (this.CurrentOperationState == OperationState.emAddTempMedOrd || this.CurrentOperationState == OperationState.emEditTempMedOrd)
                {
                    if (gridView_Lsyz.FocusedRowHandle >= 0)
                    {
                        //case 16954
                        object objyzlx = gridView_Lsyz.GetRowCellValue(gridView_Lsyz.FocusedRowHandle, colYzlx);
                        if (objyzlx != null && objyzlx.ToString() != "")
                        {
                            if (objyzlx.ToString() == "自备药品")
                            {
                                if (ZBYIsFreeInput)
                                {
                                    this.GridViewReadOnly(gridView_Lsyz, "DOSEUNIT", false);
                                }
                            }
                            if (objyzlx.ToString() == "中草药")
                            {
                                //中草药计价总量不可输入Case#27998
                                this.GridViewReadOnly(gridView_Lsyz, "AMOUNT", true);
                            }
                            else
                            {
                                this.GridViewReadOnly(gridView_Lsyz, "DOSEUNIT", true);
                                //非中草药计价总量可输入Case#27998
                                this.GridViewReadOnly(gridView_Lsyz, "AMOUNT", false);
                            }
                        }
                    }
                }
            }
            private void gridView_Lsyz_FocusedColumnChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedColumnChangedEventArgs e)
            {
                if (gridView_Lsyz.FocusedRowHandle >= 0)
                {
                    DataRow currentRow = gridView_Lsyz.GetDataRow(gridView_Lsyz.FocusedRowHandle);
                    if (currentRow["MEDORDTYPE"].ToString() != "中草药")
                    {
                        gridView_Lsyz.Columns["DOSECOUNT"].OptionsColumn.AllowFocus = false;
                        this.GridViewReadOnly(gridView_Lsyz, "AMOUNT", false);//非中草药计价总量可输入Case#27998
                    }
                    else
                    {
                        gridView_Lsyz.Columns["DOSECOUNT"].OptionsColumn.AllowFocus = true;
                        this.GridViewReadOnly(gridView_Lsyz, "AMOUNT", true);//如果是中草药计价总量不可输入Case#27998
                    }
                }
            }
      public void GridViewReadOnly(DevExpress.XtraGrid.Views.Grid.GridView gridView, string columnsName, bool readOnly)
            {
                if (!readOnly)
                {
                    gridView.Columns[columnsName].OptionsColumn.ReadOnly = false;
                    gridView.Columns[columnsName].OptionsColumn.AllowFocus = true;
                    gridView.Columns[columnsName].OptionsColumn.AllowSize = true;
    
                }
                else
                {
                    gridView.Columns[columnsName].OptionsColumn.ReadOnly = true;
                    gridView.Columns[columnsName].OptionsColumn.AllowFocus = true;
                    gridView.Columns[columnsName].OptionsColumn.AllowSize = true;
                }
            }
  • 相关阅读:
    PHP文件下载
    win7的IE11降到IE8
    京东电话面试——PHP开发
    PHP异常处理
    php错误处理
    php练习7——类的运用(四则运算or面积计算[javascript小技巧——根据需求显示不同界面])
    php练习6——面向对象编程(打印乘法表)
    SICP阅读笔记(一)
    随笔(2015-18-19)
    MIT scheme入门使用
  • 原文地址:https://www.cnblogs.com/rwh871212/p/6755496.html
Copyright © 2011-2022 走看看