private void ButtonRecoverLayout_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (UIPublic.ShowYesNoDialog("您是否要恢复表格的默认格式?") == DialogReturn.Yes) { RecoverLayout(); } }
private void ButtonRecoverLayout_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (UIPublic.ShowYesNoDialog("您确定要清除当前的布局并恢复默认布局吗?") == DialogReturn.Yes) { this.DockManager.SetLayoutData(DefaultLayoutData); } }
private void ButtonRecoverFormat_ItemClick(object sender, ItemClickEventArgs e) { if (DefaultLayoutData.IsNotNullOrEmpty()) { if (UIPublic.ShowYesNoDialog("您是否需要默认格式?") == DialogReturn.Yes) { EditorPublic.RemoveEditControllerFromStorage(EditValue.GetType(), Controller.GetType()); this.PropertyGridControl.SetLayoutData(DefaultLayoutData); } } }
private void Edit_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { if (e.Button.Kind == ButtonPredefines.Plus) { if (UIPublic.ShowYesNoDialog("您是否要创建一个新的Guid?") == DialogReturn.Yes) { var edit = sender as ButtonEdit; edit.EditValue = Guid.NewGuid().ToString(); } } }
private void ButtonClearDataFields_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (UIPublic.ShowYesNoDialog("您确定要清空所有表的列并重建吗?") == DialogReturn.Yes) { var controller = Controller as ReportController; foreach (var reportTable in controller.Tables) { reportTable.DataColumns = null; RebuildTableColumns(); } } }
private void PropertyGridControl_PopupMenuShowing(object sender, DevExpress.XtraVerticalGrid.Events.PopupMenuShowingEventArgs e) { if (e.Row != null) { var controller = Controller as ObjectPropertyEditController; if (controller == null) { return; } var propDesc = PropertyGridControl.GetPropertyDescriptor(e.Row); if (propDesc != null) { // 修改字段标题 var menuChangeCaption = new DXEditMenuItem("标题(&C)" , new TextEditController().CreateRepositoryItem(typeof(string))); menuChangeCaption.Width = 100; menuChangeCaption.EditValue = e.Row.Properties.Caption; menuChangeCaption.BeginGroup = true; menuChangeCaption.EditValueChanged += (s, a) => { if (menuChangeCaption.EditValue.IsNull()) { e.Row.Properties.Caption = propDesc.Name; } else { e.Row.Properties.Caption = (string)menuChangeCaption.EditValue; } }; e.Menu.Items.Add(menuChangeCaption); // 增加删除行菜单 var menuHideRow = new DXMenuItem("隐藏行(&D)" , (s, a) => { e.Row.Visible = false; }); e.Menu.Items.Add(menuHideRow); // 增加更改编辑器菜单 var menuChangeEditor = new DXMenuItem("更改编辑器(&E)..." , (s, a) => { Type editControllerType; if (EditorPublic.SelectEditControllerType(propDesc.PropertyType, out editControllerType) == DialogReturn.OK) { if (editControllerType != null) { var editController = editControllerType.CreateInstance() as BaseEditController; if (controller != null) { controller.SetPredfinedEditController(propDesc.Name, editController.GetType()); } } } } , Properties.Resources.renamedatasource_16x16); menuChangeEditor.BeginGroup = true; e.Menu.Items.Add(menuChangeEditor); // 增加恢复编辑器菜单 var menuRecoverEditor = new DXMenuItem("恢复编辑器(&R)" , (s, a) => { if (UIPublic.ShowYesNoDialog("您确定要恢复默认的编辑器吗?") == DialogReturn.Yes) { controller.RemovePredefinedEditController(propDesc.Name); } } , Properties.Resources.clearformatting_16x16); e.Menu.Items.Add(menuRecoverEditor); } // 恢复所有编辑器 var menuClearEditors = new DXMenuItem("恢复所有编辑器(&C)" , (s, a) => { if (UIPublic.ShowYesNoDialog("您确定要恢复所有默认的编辑器吗?") == DialogReturn.Yes) { controller.ClearPredefinedEditControllers(); } } , Properties.Resources.clear_16x16); menuClearEditors.BeginGroup = true; e.Menu.Items.Add(menuClearEditors); } }
private void DataLayoutControl_PopupMenuShowing(object sender, PopupMenuShowingEventArgs e) { if (e.HitInfo.Item != null) { var controller = Controller as ObjectLayoutEditController; if (controller == null) { return; } var layoutItem = e.HitInfo.Item as LayoutControlItem; if (layoutItem == null) { return; } var editControl = layoutItem.Control; var propDesc = editControl.Tag as PropertyDescriptor; if (propDesc != null) { // 修改字段标题 var menuChangeCaption = new DXEditMenuItem("标题(&C)" , new TextEditController().CreateRepositoryItem(typeof(string))); menuChangeCaption.Width = 100; menuChangeCaption.EditValue = layoutItem.Text; menuChangeCaption.BeginGroup = true; menuChangeCaption.EditValueChanged += (s, a) => { if (menuChangeCaption.EditValue.IsNull()) { layoutItem.Text = propDesc.Name; } else { layoutItem.Text = (string)menuChangeCaption.EditValue; } }; e.Menu.Items.Add(menuChangeCaption); // 增加更改编辑器菜单 var menuChangeEditor = new DXMenuItem("更改编辑器(&E)..." , (s, a) => { Type editControllerType; if (EditorPublic.SelectEditControllerType(propDesc.PropertyType, out editControllerType) == DialogReturn.OK) { if (editControllerType != null) { var editController = editControllerType.CreateInstance() as BaseEditController; // 清除前保存配置 controller.LayoutData = this.DataLayoutControl.GetLayoutData(); controller.SetPredfinedEditController(propDesc.Name, editController.GetType()); EditValue = EditValue; } } } , Properties.Resources.renamedatasource_16x16); menuChangeEditor.BeginGroup = true; e.Menu.Items.Add(menuChangeEditor); // 增加恢复编辑器菜单 var menuRecoverEditor = new DXMenuItem("恢复编辑器(&R)" , (s, a) => { if (UIPublic.ShowYesNoDialog("您确定要恢复默认的编辑器吗?") == DialogReturn.Yes) { // 清除前保存配置 controller.LayoutData = this.DataLayoutControl.GetLayoutData(); controller.RemovePredefinedEditController(propDesc.Name); EditValue = EditValue; } } , Properties.Resources.clearformatting_16x16); e.Menu.Items.Add(menuRecoverEditor); } // 恢复所有编辑器 var menuClearEditors = new DXMenuItem("恢复所有编辑器(&C)" , (s, a) => { if (UIPublic.ShowYesNoDialog("您确定要恢复所有默认的编辑器吗?") == DialogReturn.Yes) { // 清除前保存配置 controller.LayoutData = this.DataLayoutControl.GetLayoutData(); controller.ClearPredefinedEditControllers(); EditValue = EditValue; } } , Properties.Resources.clear_16x16); menuClearEditors.BeginGroup = true; e.Menu.Items.Add(menuClearEditors); } }