コード例 #1
0
        public virtual void BtnCancel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (FGridStatu != GridStatu.gsBrowse)
            {
                FGridStatu = GridStatu.gsBrowse;
                GV_Main.CancelUpdateCurrentRow();
                GV_Main.RefreshData();

                for (int i = 0; i < MainControls.Count; i++)
                {
                    if (MainControls[i].Name.EndsWith("C"))
                    {
                        MainControls[i].Text = "";
                    }
                }

                if (GV_Main.RowCount > 0)
                {
                    BtnNew.Enabled       = true;
                    BtnQuery.Enabled     = true;
                    BtnEdit.Enabled      = true;
                    BtnDel.Enabled       = true;
                    BtnFirst.Enabled     = true;
                    BtnPrior.Enabled     = true;
                    BtnNext.Enabled      = true;
                    BtnLast.Enabled      = true;
                    BtnSave.Enabled      = false;
                    BtnCancel.Enabled    = false;
                    btnAutoWidth.Enabled = true;
                }
                else
                {
                    BtnNew.Enabled       = true;
                    BtnQuery.Enabled     = true;
                    BtnEdit.Enabled      = false;
                    BtnDel.Enabled       = false;
                    BtnFirst.Enabled     = false;
                    BtnPrior.Enabled     = false;
                    BtnNext.Enabled      = false;
                    BtnLast.Enabled      = false;
                    BtnSave.Enabled      = false;
                    BtnCancel.Enabled    = false;
                    btnAutoWidth.Enabled = true;
                }

                for (int i = 0; i < MainControls.Count; i++)
                {
                    MainControls[i].Enabled             = true;
                    MainControls[i].Properties.ReadOnly = true;
                }
            }
        }