예제 #1
0
        protected override void OnLoaded()
        {
            base.OnLoaded();
            if (_IsDesign)
            {
                return;
            }
            if (base.ContextMenu == null)
            {
                XtraContextMenu xMenu = new XtraContextMenu(this, XtraContextMenuType.Copy | XtraContextMenuType.Export | XtraContextMenuType.ExportAsTemplet |
                                                            XtraContextMenuType.DataImport | XtraContextMenuType.SaveGridState | XtraContextMenuType.ColumnsAllowSort |
                                                            XtraContextMenuType.Chart | XtraContextMenuType.ChartDesign);
                base.ContextMenu = xMenu.GridContextMenu;
            }

            if (_HasInitilizeGridLoad || !_ShowOptionMenu)
            {
                return;
            }

            _HasInitilizeGridLoad = true;
            _ParentFrm            = MB.WinBase.ShareLib.Instance.GetControlParentForm(this);
            if (_ParentFrm == null)
            {
                return;
            }

            MB.WinBase.IFace.IForm viewFrm = _ParentFrm as MB.WinBase.IFace.IForm;
            if (viewFrm != null && viewFrm.ClientRuleObject != null)
            {
                _XmlCfgFileName = viewFrm.ClientRuleObject.ClientLayoutAttribute.UIXmlConfigFile;
                _OptionsCFGName = viewFrm.GetType().FullName + "~" + viewFrm.ClientRuleObject.GetType().FullName + "~" + this.Name + ".xml";
                var layOutXmlHelper = LayoutXmlConfigHelper.Instance;
                var colPros         = layOutXmlHelper.GetColumnPropertys(_XmlCfgFileName);
                var colEditPros     = layOutXmlHelper.GetColumnEdits(colPros, _XmlCfgFileName);
            }
            else
            {
                _OptionsCFGName = _ParentFrm.GetType().FullName + "~" + this.Name + ".xml";
            }

            _CurrentInfo = GridViewOptionsHelper.Instance.CreateFromXMLToInfo(_OptionsCFGName);

            _GridView = this.DefaultView as DevExpress.XtraGrid.Views.Grid.GridView;

            if (_GridView != null)
            {
                _GridView.OptionsView.EnableAppearanceEvenRow = true;

                _GridView.Appearance.EvenRow.BackColor = ODD_ROW_BACK_COLOR;
                // _GridView.OptionsView.EnableAppearanceEvenRow = true;
                //  _GridView.OptionsView.EnableAppearanceOddRow = true;
                _GridView.RowCellStyle       += new DevExpress.XtraGrid.Views.Grid.RowCellStyleEventHandler(_GridView_RowCellStyle);
                _GridView.CustomFilterDialog += new DevExpress.XtraGrid.Views.Grid.CustomFilterDialogEventHandler(_GridView_CustomFilterDialog);
            }

            setGridViewByOptions();
            createOptionsMenu(ContextMenu);
            createCopyCellMenu(ContextMenu);
        }
예제 #2
0
        /// <summary>
        /// 重新设置弹出窗口的菜单项。
        /// </summary>
        /// <param name="createMenus"></param>
        public virtual void ReSetContextMenu(XtraContextMenuType createMenus)
        {
            XtraContextMenu xMenu = new XtraContextMenu(this, createMenus);

            base.ContextMenu = xMenu.GridContextMenu;
            createOptionsMenu(ContextMenu);
            createCopyCellMenu(ContextMenu);
        }