You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
680 lines
29 KiB
680 lines
29 KiB
using System; |
|
using System.Linq; |
|
using System.Data; |
|
using System.Drawing; |
|
using System.Windows.Forms; |
|
using DevExpress.Utils; |
|
using DevExpress.Utils.Localization; |
|
using DevExpress.XtraBars; |
|
using DevExpress.XtraCharts.Localization; |
|
using DevExpress.XtraEditors; |
|
using DevExpress.XtraEditors.Controls; |
|
using DevExpress.XtraEditors.Mask; |
|
using DevExpress.XtraEditors.Repository; |
|
using DevExpress.XtraGrid.Localization; |
|
using DevExpress.XtraGrid.Views.Grid; |
|
using DevExpress.XtraLayout.Localization; |
|
using DevExpress.XtraNavBar; |
|
using DevExpress.XtraPrinting.Localization; |
|
using DevExpress.XtraScheduler.Localization; |
|
using DevExpress.XtraTreeList; |
|
using DevExpress.XtraTreeList.Columns; |
|
using DevExpress.XtraTreeList.Localization; |
|
using DevExpress.XtraVerticalGrid; |
|
using DevExpress.XtraVerticalGrid.Localization; |
|
using KGIS.Plugin.LayerProperty.Utils; |
|
using DevExpress.XtraBars.Localization; |
|
|
|
namespace KGIS.Plugin.LayerProperty.View.UC_Controls |
|
{ |
|
public class DevExpressControlCommand |
|
{ |
|
private const string WARNING_NOQUOTE = "不能拥有单引号"; |
|
private const string WARNING_MAXLENGTH = "长度超出范围"; |
|
private static string NumberChars = "1234567890.-"; |
|
public static void SetEditorInteger(ref TextEdit txtEditor, bool allowNegative, bool allowZero, int maxDigit) |
|
{ |
|
MaskProperties mask = txtEditor.Properties.Mask; |
|
mask.MaskType = MaskType.Numeric; |
|
if (allowNegative) |
|
{ |
|
txtEditor.EditValue = 0; |
|
mask.EditMask = new string('#', maxDigit - 1) + "0"; |
|
txtEditor.Properties.DisplayFormat.FormatType = FormatType.Numeric; |
|
txtEditor.Properties.DisplayFormat.FormatString = new string('#', maxDigit - 1) + "0"; |
|
} |
|
else |
|
{ |
|
if (!allowNegative && allowZero) |
|
{ |
|
txtEditor.EditValue = 0; |
|
mask.EditMask = new string('#', maxDigit - 1) + "0;"; |
|
txtEditor.Properties.DisplayFormat.FormatType = FormatType.Numeric; |
|
txtEditor.Properties.DisplayFormat.FormatString = new string('#', maxDigit - 1) + "0"; |
|
} |
|
else |
|
{ |
|
txtEditor.EditValue = 1; |
|
mask.EditMask = new string('#', maxDigit) + ";"; |
|
txtEditor.EditValueChanged += new System.EventHandler(DevExpressControlCommand.txtEditor_EditValueChanged_4Numeric); |
|
} |
|
} |
|
txtEditor.ImeMode = ImeMode.Disable; |
|
txtEditor.Properties.KeyUp += new KeyEventHandler(DevExpressControlCommand.txtEditor_Properties_KeyUp); |
|
} |
|
public static void SetAllEditorInteger(ref BaseEdit txtEditor, bool allowNegative, bool allowZero, int maxDigit) |
|
{ |
|
if (allowNegative) |
|
{ |
|
txtEditor.EditValue = 0; |
|
txtEditor.Properties.DisplayFormat.FormatType = FormatType.Numeric; |
|
txtEditor.Properties.DisplayFormat.FormatString = new string('#', maxDigit - 1) + "0"; |
|
} |
|
else |
|
{ |
|
if (!allowNegative && allowZero) |
|
{ |
|
txtEditor.EditValue = 0; |
|
txtEditor.Properties.DisplayFormat.FormatType = FormatType.Numeric; |
|
txtEditor.Properties.DisplayFormat.FormatString = new string('#', maxDigit - 1) + "0"; |
|
} |
|
else |
|
{ |
|
txtEditor.EditValue = 1; |
|
txtEditor.EditValueChanged += new System.EventHandler(DevExpressControlCommand.txtEditor_EditValueChanged_4Numeric); |
|
} |
|
} |
|
txtEditor.ImeMode = ImeMode.Disable; |
|
txtEditor.Properties.KeyUp += new KeyEventHandler(DevExpressControlCommand.txtEditor_Properties_KeyUp); |
|
} |
|
public static void SetAllEditorInteger2(ref PopupBaseAutoSearchEdit txtEditor, bool allowNegative, bool allowZero, int maxDigit) |
|
{ |
|
if (allowNegative) |
|
{ |
|
txtEditor.EditValue = 0; |
|
txtEditor.Properties.DisplayFormat.FormatType = FormatType.Numeric; |
|
txtEditor.Properties.DisplayFormat.FormatString = new string('#', maxDigit - 1) + "0"; |
|
} |
|
else |
|
{ |
|
if (!allowNegative && allowZero) |
|
{ |
|
txtEditor.EditValue = 0; |
|
txtEditor.Properties.DisplayFormat.FormatType = FormatType.Numeric; |
|
txtEditor.Properties.DisplayFormat.FormatString = new string('#', maxDigit - 1) + "0"; |
|
} |
|
else |
|
{ |
|
txtEditor.EditValue = 1; |
|
txtEditor.EditValueChanging += new ChangingEventHandler(DevExpressControlCommand.txtEditor_EditValueChanging); |
|
} |
|
} |
|
txtEditor.ImeMode = ImeMode.Disable; |
|
txtEditor.Properties.KeyUp += new KeyEventHandler(DevExpressControlCommand.txtEditor_Properties_KeyUp); |
|
} |
|
private static void txtEditor_EditValueChanging(object sender, ChangingEventArgs e) |
|
{ |
|
try |
|
{ |
|
TextEdit textEdit = (TextEdit)sender; |
|
if (e.NewValue != null) |
|
{ |
|
string text = e.NewValue.ToString(); |
|
try |
|
{ |
|
if (textEdit.Text == null) |
|
{ |
|
text = ""; |
|
} |
|
else |
|
{ |
|
text = textEdit.Text.Trim(); |
|
} |
|
if (text.Length == 0) |
|
{ |
|
textEdit.EditValue = 1; |
|
} |
|
else |
|
{ |
|
if (text == ".") |
|
{ |
|
textEdit.EditValue = double.Parse("1.0"); |
|
} |
|
else |
|
{ |
|
if (double.Parse(text) == 0.0) |
|
{ |
|
textEdit.EditValue = double.Parse("1.0"); |
|
} |
|
} |
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
textEdit.ErrorText = ex.Message; |
|
e.Cancel = true; |
|
} |
|
} |
|
} |
|
catch (Exception) |
|
{ |
|
e.Cancel = true; |
|
} |
|
} |
|
public static void SetEditorDouble(ref TextEdit txtEditor, bool allowNegative, bool allowZero, int maxDigit, int maxFraction) |
|
{ |
|
MaskProperties mask = txtEditor.Properties.Mask; |
|
mask.MaskType = MaskType.Numeric; |
|
mask.SaveLiteral = false; |
|
if (allowNegative) |
|
{ |
|
txtEditor.EditValue = null; |
|
mask.EditMask = new string('#', maxDigit - 1) + "0." + new string('#', maxFraction); |
|
txtEditor.Properties.DisplayFormat.FormatType = FormatType.Numeric; |
|
txtEditor.Properties.DisplayFormat.FormatString = new string('#', maxDigit - 1) + "0." + new string('0', maxFraction); |
|
} |
|
else |
|
{ |
|
if (!allowNegative && allowZero) |
|
{ |
|
txtEditor.EditValue = null; |
|
mask.EditMask = new string('#', maxDigit - 1) + "0." + new string('#', maxFraction) + ";"; |
|
txtEditor.Properties.DisplayFormat.FormatType = FormatType.Numeric; |
|
txtEditor.Properties.DisplayFormat.FormatString = new string('#', maxDigit - 1) + "0." + new string('0', maxFraction); |
|
} |
|
else |
|
{ |
|
txtEditor.EditValue = null; |
|
mask.EditMask = new string('#', maxDigit - 1) + "0." + new string('#', maxFraction) + ";"; |
|
txtEditor.Properties.DisplayFormat.FormatType = FormatType.Numeric; |
|
txtEditor.Properties.DisplayFormat.FormatString = new string('#', maxDigit - 1) + "0." + new string('0', maxFraction); |
|
txtEditor.EditValueChanged += new System.EventHandler(DevExpressControlCommand.txtEditor_EditValueChanged_4Numeric); |
|
} |
|
} |
|
txtEditor.ImeMode = ImeMode.Disable; |
|
txtEditor.Properties.KeyUp += new KeyEventHandler(DevExpressControlCommand.txtEditor_Properties_KeyUp); |
|
} |
|
public static void SetEditorStringNoSingleQuote(ref TextEdit txtEditor, int maxLength) |
|
{ |
|
txtEditor.EditValue = ""; |
|
txtEditor.Properties.MaxLength = maxLength; |
|
txtEditor.EditValueChanging += new ChangingEventHandler(DevExpressControlCommand.txtEditor_EditValueChanging_4StringNoSingleQoute); |
|
} |
|
public static void SetEditorStringNoSingleQuote(ref MemoEdit txtEditor, int maxLength) |
|
{ |
|
txtEditor.EditValue = ""; |
|
txtEditor.Properties.MaxLength = maxLength; |
|
txtEditor.EditValueChanging += new ChangingEventHandler(DevExpressControlCommand.txtEditor_EditValueChanging_4StringNoSingleQoute); |
|
} |
|
public static void SetEditorStringNoSingleQuote(ref ComboBoxEdit cmbEditor, int maxLength) |
|
{ |
|
cmbEditor.EditValue = ""; |
|
cmbEditor.Properties.MaxLength = maxLength; |
|
cmbEditor.EditValueChanging += new ChangingEventHandler(DevExpressControlCommand.txtEditor_EditValueChanging_4StringNoSingleQoute); |
|
} |
|
public static void SetEditorString(ref TextEdit txtEditor, int maxLength) |
|
{ |
|
txtEditor.EditValue = ""; |
|
txtEditor.Properties.MaxLength = maxLength; |
|
txtEditor.EditValueChanging += new ChangingEventHandler(DevExpressControlCommand.txtEditor_EditValueChanging_4String); |
|
} |
|
private static void txtEditor_EditValueChanged_4Numeric(object sender, System.EventArgs e) |
|
{ |
|
try |
|
{ |
|
if (sender is TextEdit) |
|
{ |
|
TextEdit textEdit = (TextEdit)sender; |
|
try |
|
{ |
|
string text; |
|
if (textEdit.Text == null) |
|
{ |
|
text = ""; |
|
} |
|
else |
|
{ |
|
text = textEdit.Text.Trim(); |
|
} |
|
if (text.Length == 0) |
|
{ |
|
textEdit.EditValue = 1; |
|
} |
|
else |
|
{ |
|
if (text == ".") |
|
{ |
|
textEdit.EditValue = double.Parse("1.0"); |
|
} |
|
else |
|
{ |
|
if (double.Parse(text) == 0.0) |
|
{ |
|
textEdit.EditValue = double.Parse("1.0"); |
|
} |
|
} |
|
} |
|
goto IL_E7; |
|
} |
|
catch (Exception ex) |
|
{ |
|
textEdit.ErrorText = ex.Message; |
|
goto IL_E7; |
|
} |
|
} |
|
if (sender is BarEditItem) |
|
{ |
|
BarEditItem barEditItem = (BarEditItem)sender; |
|
if (barEditItem.EditValue == null) |
|
{ |
|
barEditItem.EditValue = 1; |
|
} |
|
else |
|
{ |
|
if (barEditItem.EditValue.ToString() == "0") |
|
{ |
|
barEditItem.EditValue = 1; |
|
} |
|
} |
|
} |
|
IL_E7:; |
|
} |
|
catch (Exception) |
|
{ |
|
} |
|
} |
|
private static void txtEditor_EditValueChanging_4StringNoSingleQoute(object sender, ChangingEventArgs e) |
|
{ |
|
TextEdit textEdit = (TextEdit)sender; |
|
if (e.NewValue == null) |
|
{ |
|
return; |
|
} |
|
string text = e.NewValue.ToString(); |
|
int maxLength = textEdit.Properties.MaxLength; |
|
int selectionStart = textEdit.SelectionStart; |
|
textEdit.ErrorText = ""; |
|
if (text.IndexOf("'") >= 0 || text.IndexOf("’") >= 0 || text.IndexOf("‘") >= 0) |
|
{ |
|
e.Cancel = true; |
|
textEdit.ErrorText = "不能拥有单引号"; |
|
} |
|
if (ConvertUtil.GetStringDBLength(text) > maxLength) |
|
{ |
|
e.Cancel = true; |
|
textEdit.ErrorText = "长度超出范围" + maxLength.ToString(); |
|
} |
|
if (selectionStart >= 0) |
|
{ |
|
textEdit.SelectionStart = selectionStart; |
|
} |
|
} |
|
private static void txtEditor_EditValueChanging_4String(object sender, ChangingEventArgs e) |
|
{ |
|
TextEdit textEdit = (TextEdit)sender; |
|
string s = (string)e.NewValue; |
|
int maxLength = textEdit.Properties.MaxLength; |
|
int selectionStart = textEdit.SelectionStart; |
|
textEdit.ErrorText = ""; |
|
if (ConvertUtil.GetStringDBLength(s) > maxLength) |
|
{ |
|
e.Cancel = true; |
|
textEdit.ErrorText = "长度超出范围" + maxLength.ToString(); |
|
} |
|
if (selectionStart >= 0) |
|
{ |
|
textEdit.SelectionStart = selectionStart; |
|
} |
|
} |
|
private static void txtEditor_Properties_KeyUp(object sender, KeyEventArgs e) |
|
{ |
|
if (DevExpressControlCommand.NumberChars.IndexOf((char)e.KeyValue) < 0) |
|
{ |
|
TextEdit textEdit = (TextEdit)sender; |
|
textEdit.ImeMode = ImeMode.Disable; |
|
} |
|
} |
|
public static void SetEditorInteger(ref BarEditItem txtEditor, bool allowNegative, bool allowZero, int maxDigit) |
|
{ |
|
RepositoryItemTextEdit repositoryItemTextEdit = (RepositoryItemTextEdit)txtEditor.Edit; |
|
MaskProperties mask = repositoryItemTextEdit.Mask; |
|
mask.MaskType = MaskType.Numeric; |
|
if (allowNegative) |
|
{ |
|
txtEditor.EditValue = 0; |
|
mask.EditMask = "\\d" + maxDigit.ToString(); |
|
} |
|
else |
|
{ |
|
if (!allowNegative && allowZero) |
|
{ |
|
txtEditor.EditValue = 0; |
|
mask.EditMask = new string('#', maxDigit - 1) + "0;"; |
|
} |
|
else |
|
{ |
|
txtEditor.EditValue = 1; |
|
mask.EditMask = new string('#', maxDigit) + ";"; |
|
txtEditor.EditValueChanged += new System.EventHandler(DevExpressControlCommand.txtEditor_EditValueChanged_4Numeric); |
|
} |
|
} |
|
repositoryItemTextEdit.KeyUp += new KeyEventHandler(DevExpressControlCommand.txtEditor_Properties_KeyUp); |
|
} |
|
public static void SetEditorDouble(ref BarEditItem txtEditor, bool allowNegative, bool allowZero, int maxDigit, int maxFraction) |
|
{ |
|
RepositoryItemTextEdit repositoryItemTextEdit = (RepositoryItemTextEdit)txtEditor.Edit; |
|
MaskProperties mask = repositoryItemTextEdit.Mask; |
|
mask.MaskType = MaskType.Numeric; |
|
mask.SaveLiteral = false; |
|
if (allowNegative) |
|
{ |
|
txtEditor.EditValue = null; |
|
mask.EditMask = new string('#', maxDigit) + "." + new string('#', maxFraction); |
|
repositoryItemTextEdit.DisplayFormat.FormatType = FormatType.Numeric; |
|
repositoryItemTextEdit.DisplayFormat.FormatString = new string('#', maxDigit - 1) + "0." + new string('0', maxFraction); |
|
} |
|
else |
|
{ |
|
if (!allowNegative && allowZero) |
|
{ |
|
txtEditor.EditValue = null; |
|
mask.EditMask = new string('#', maxDigit - 1) + "0." + new string('#', maxFraction) + ";"; |
|
repositoryItemTextEdit.DisplayFormat.FormatType = FormatType.Numeric; |
|
repositoryItemTextEdit.DisplayFormat.FormatString = new string('#', maxDigit - 1) + "0." + new string('0', maxFraction); |
|
} |
|
else |
|
{ |
|
txtEditor.EditValue = null; |
|
mask.EditMask = new string('#', maxDigit - 1) + "0." + new string('#', maxFraction) + ";"; |
|
repositoryItemTextEdit.DisplayFormat.FormatType = FormatType.Numeric; |
|
repositoryItemTextEdit.DisplayFormat.FormatString = new string('#', maxDigit - 1) + "0." + new string('0', maxFraction); |
|
repositoryItemTextEdit.EditValueChanged += new System.EventHandler(DevExpressControlCommand.txtEditor_EditValueChanged_4Numeric); |
|
} |
|
} |
|
repositoryItemTextEdit.KeyUp += new KeyEventHandler(DevExpressControlCommand.txtEditor_Properties_KeyUp); |
|
} |
|
public static void SetEditorStringNoSingleQuote(ref BarEditItem txtEditor, int maxLength) |
|
{ |
|
RepositoryItemTextEdit repositoryItemTextEdit = (RepositoryItemTextEdit)txtEditor.Edit; |
|
txtEditor.EditValue = ""; |
|
repositoryItemTextEdit.MaxLength = maxLength; |
|
repositoryItemTextEdit.EditValueChanging += new ChangingEventHandler(DevExpressControlCommand.txtEditor_EditValueChanging_4StringNoSingleQoute); |
|
} |
|
public static void SetEditorStringNoSingleQuote(ref RepositoryItemTextEdit txtEditor, int maxLength) |
|
{ |
|
txtEditor.NullText = ""; |
|
txtEditor.MaxLength = maxLength; |
|
txtEditor.EditValueChanging += new ChangingEventHandler(DevExpressControlCommand.txtEditor_EditValueChanging_4StringNoSingleQoute); |
|
} |
|
public static void SetEditorString(ref BarEditItem txtEditor, int maxLength) |
|
{ |
|
RepositoryItemTextEdit repositoryItemTextEdit = (RepositoryItemTextEdit)txtEditor.Edit; |
|
txtEditor.EditValue = ""; |
|
repositoryItemTextEdit.MaxLength = maxLength; |
|
repositoryItemTextEdit.EditValueChanging += new ChangingEventHandler(DevExpressControlCommand.txtEditor_EditValueChanging_4String); |
|
} |
|
public static bool MoveTop(ref ListBoxControl lst) |
|
{ |
|
int selectedIndex = lst.SelectedIndex; |
|
if (selectedIndex != -1) |
|
{ |
|
object item = lst.Items[selectedIndex]; |
|
lst.Items.RemoveAt(selectedIndex); |
|
lst.Items.Insert(0, item); |
|
lst.SelectedIndex = 0; |
|
return true; |
|
} |
|
return false; |
|
} |
|
public static bool MoveDown(ref ListBoxControl lst) |
|
{ |
|
int selectedIndex = lst.SelectedIndex; |
|
int count = lst.Items.Count; |
|
if (selectedIndex != -1 && selectedIndex != count - 1) |
|
{ |
|
object item = lst.Items[selectedIndex]; |
|
lst.Items.Insert(selectedIndex + 2, item); |
|
lst.Items.RemoveAt(selectedIndex); |
|
lst.SelectedIndex = selectedIndex + 1; |
|
return true; |
|
} |
|
return false; |
|
} |
|
public static bool MoveUp(ref ListBoxControl lst) |
|
{ |
|
int selectedIndex = lst.SelectedIndex; |
|
if (selectedIndex != -1 && selectedIndex != 0) |
|
{ |
|
object item = lst.Items[selectedIndex]; |
|
lst.Items.Insert(selectedIndex - 1, item); |
|
lst.Items.RemoveAt(selectedIndex + 1); |
|
lst.SelectedIndex = selectedIndex - 1; |
|
return true; |
|
} |
|
return false; |
|
} |
|
public static bool MoveBottom(ref ListBoxControl lst) |
|
{ |
|
int selectedIndex = lst.SelectedIndex; |
|
int count = lst.Items.Count; |
|
if (selectedIndex != -1) |
|
{ |
|
object item = lst.Items[selectedIndex]; |
|
lst.Items.Insert(count, item); |
|
lst.Items.RemoveAt(selectedIndex); |
|
lst.SelectedIndex = count - 1; |
|
return true; |
|
} |
|
return false; |
|
} |
|
public static bool MoveToOther(ref ListBoxControl lstdest, ref ListBoxControl lstsrc) |
|
{ |
|
int selectedIndex = lstsrc.SelectedIndex; |
|
int count = lstsrc.Items.Count; |
|
int count2 = lstdest.Items.Count; |
|
if (selectedIndex != -1) |
|
{ |
|
lstdest.Items.Add(lstsrc.SelectedItem); |
|
lstsrc.Items.RemoveAt(selectedIndex); |
|
if (selectedIndex != count - 1) |
|
{ |
|
lstsrc.SelectedIndex = selectedIndex; |
|
} |
|
else |
|
{ |
|
if (count != 1) |
|
{ |
|
lstsrc.SelectedIndex = selectedIndex - 1; |
|
} |
|
} |
|
lstdest.SelectedIndex = count2; |
|
return true; |
|
} |
|
return false; |
|
} |
|
public static bool MoveAllToOther(ref ListBoxControl lstdest, ref ListBoxControl lstsrc) |
|
{ |
|
int count = lstsrc.Items.Count; |
|
if (count == 0) |
|
{ |
|
return false; |
|
} |
|
for (int i = 0; i < count; i++) |
|
{ |
|
lstdest.Items.Add(lstsrc.Items[i]); |
|
} |
|
lstsrc.Items.Clear(); |
|
lstdest.SelectedIndex = lstdest.Items.Count - 1; |
|
return true; |
|
} |
|
public static int MoveTop(ref DataTable tbl, int index) |
|
{ |
|
if (index != -1) |
|
{ |
|
DataRow dataRow = tbl.Rows[index]; |
|
DataRow dataRow2 = tbl.NewRow(); |
|
dataRow2.ItemArray = dataRow.ItemArray; |
|
tbl.Rows.Remove(dataRow); |
|
tbl.Rows.InsertAt(dataRow2, 0); |
|
return 0; |
|
} |
|
return -1; |
|
} |
|
public static int MoveDown(ref DataTable tbl, int index) |
|
{ |
|
int count = tbl.Rows.Count; |
|
if (index != -1 && index != count - 1) |
|
{ |
|
DataRow dataRow = tbl.Rows[index]; |
|
DataRow dataRow2 = tbl.NewRow(); |
|
dataRow2.ItemArray = dataRow.ItemArray; |
|
tbl.Rows.Remove(dataRow); |
|
tbl.Rows.InsertAt(dataRow2, index + 1); |
|
return index + 1; |
|
} |
|
return -1; |
|
} |
|
public static int MoveUp(ref DataTable tbl, int index) |
|
{ |
|
int arg_0C_0 = tbl.Rows.Count; |
|
if (index != -1 && index != 0) |
|
{ |
|
DataRow dataRow = tbl.Rows[index]; |
|
DataRow dataRow2 = tbl.NewRow(); |
|
dataRow2.ItemArray = dataRow.ItemArray; |
|
tbl.Rows.Remove(dataRow); |
|
tbl.Rows.InsertAt(dataRow2, index - 1); |
|
return index - 1; |
|
} |
|
return -1; |
|
} |
|
public static int MoveBottom(ref DataTable tbl, int index) |
|
{ |
|
int count = tbl.Rows.Count; |
|
if (index != -1) |
|
{ |
|
DataRow dataRow = tbl.Rows[index]; |
|
DataRow dataRow2 = tbl.NewRow(); |
|
dataRow2.ItemArray = dataRow.ItemArray; |
|
tbl.Rows.Remove(dataRow); |
|
tbl.Rows.InsertAt(dataRow2, count - 1); |
|
return count - 1; |
|
} |
|
return -1; |
|
} |
|
[Obsolete("自定义本地化方法", true)] |
|
public static void LocalizeSystem() |
|
{ |
|
GridLocalizer.Active = new DxperienceXtraGridLocalizationCHS(); |
|
BarLocalizer.Active = new DxperienceXtraBarsLocalizationCHS(); |
|
XtraLocalizer<ChartStringId>.Active = new DxperienceXtraChartsLocalizationCHS(); |
|
Localizer.Active = new DxperienceXtraEditorsLocalizationCHS(); |
|
LayoutLocalizer.Active = new DxperienceXtraLayoutLocalizationCHS(); |
|
NavBarLocalizer.Active = new DxperienceXtraNavBarLocalizationCHS(); |
|
//PivotGridLocalizer.Active = new DxperienceXtraPivotGridLocalizationCHS(); |
|
PreviewLocalizer.Active = new DxperienceXtraPrintingLocalizationCHS(); |
|
//ReportLocalizer.Active = new DxperienceXtraReportsLocalizationCHS(); |
|
XtraLocalizer<SchedulerStringId>.Active = new DxperienceXtraSchedulerLocalizationCHS(); |
|
TreeListLocalizer.Active = new DxperienceXtraTreeListLocalizationCHS(); |
|
VGridLocalizer.Active = new DxperienceXtraVerticalGridLocalizationCHS(); |
|
} |
|
public static void InitFormModel(ref XtraForm form) |
|
{ |
|
form.FormBorderStyle = FormBorderStyle.FixedDialog; |
|
form.StartPosition = FormStartPosition.CenterScreen; |
|
form.ShowInTaskbar = false; |
|
form.MaximizeBox = false; |
|
form.MinimizeBox = false; |
|
} |
|
public static void InitGridControl(ref GridView gridView) |
|
{ |
|
gridView.ActiveFilterEnabled = false; |
|
gridView.OptionsBehavior.Editable = false; |
|
gridView.OptionsBehavior.ImmediateUpdateRowPosition = false; |
|
gridView.OptionsCustomization.AllowFilter = false; |
|
gridView.OptionsMenu.EnableColumnMenu = false; |
|
gridView.OptionsMenu.EnableFooterMenu = false; |
|
gridView.OptionsMenu.EnableGroupPanelMenu = false; |
|
gridView.OptionsView.ColumnAutoWidth = false; |
|
gridView.OptionsView.ShowIndicator = false; |
|
gridView.DragObjectOver += new DevExpress.XtraGrid.Views.Base.DragObjectOverEventHandler(DevExpressControlCommand.GridView_DragObjectOver); |
|
} |
|
private static void GridView_DragObjectOver(object sender, DevExpress.XtraGrid.Views.Base.DragObjectOverEventArgs e) |
|
{ |
|
if (e.DropInfo.Index < 0) |
|
{ |
|
e.DropInfo.Valid = false; |
|
} |
|
} |
|
public static void BoundDataTableToGrid(ref GridView gridView, DataTable table) |
|
{ |
|
gridView.GridControl.DataSource = table; |
|
gridView.Columns.Clear(); |
|
gridView.PopulateColumns(table); |
|
for (int i = 0; i < table.Columns.Count; i++) |
|
{ |
|
gridView.Columns[i].Caption = table.Columns[i].Caption; |
|
gridView.Columns[i].BestFit(); |
|
} |
|
gridView.LayoutChanged(); |
|
} |
|
public static void InitBarManager(ref BarManager barMng) |
|
{ |
|
barMng.AllowCustomization = false; |
|
barMng.AllowMoveBarOnToolbar = false; |
|
barMng.AllowQuickCustomization = false; |
|
barMng.AllowShowToolbarsPopup = false; |
|
foreach (Bar bar in barMng.Bars) |
|
{ |
|
bar.OptionsBar.AllowQuickCustomization = false; |
|
bar.OptionsBar.DisableClose = true; |
|
bar.OptionsBar.DisableCustomization = true; |
|
} |
|
} |
|
public static void InitTreeList(ref TreeList tlst) |
|
{ |
|
tlst.OptionsMenu.EnableColumnMenu = false; |
|
tlst.OptionsMenu.EnableFooterMenu = false; |
|
tlst.OptionsView.AutoWidth = true; |
|
tlst.OptionsView.ShowIndicator = false; |
|
tlst.OptionsBehavior.KeepSelectedOnClick = false; |
|
tlst.OptionsSelection.EnableAppearanceFocusedCell = false; |
|
tlst.Appearance.FocusedCell.BackColor = Color.Navy; |
|
tlst.Appearance.FocusedCell.ForeColor = Color.White; |
|
tlst.Appearance.SelectedRow.BackColor = Color.Navy; |
|
tlst.Appearance.SelectedRow.ForeColor = Color.White; |
|
foreach (TreeListColumn treeListColumn in tlst.Columns) |
|
{ |
|
treeListColumn.OptionsColumn.AllowMoveToCustomizationForm = false; |
|
} |
|
} |
|
public static void InitVGridControl(ref VGridControl vgrid) |
|
{ |
|
vgrid.LayoutStyle = LayoutViewStyle.SingleRecordView; |
|
vgrid.BorderStyle = BorderStyles.NoBorder; |
|
vgrid.TreeButtonStyle = TreeButtonStyle.TreeView; |
|
vgrid.ShowButtonMode = DevExpress.XtraVerticalGrid.ShowButtonModeEnum.ShowForFocusedRow; |
|
vgrid.Appearance.BandBorder.BackColor = Color.FromArgb(213, 213, 213); |
|
vgrid.Appearance.BandBorder.Options.UseBackColor = true; |
|
vgrid.Appearance.Category.Options.UseBorderColor = true; |
|
vgrid.Appearance.HideSelectionRow.BackColor = Color.Blue; |
|
vgrid.Appearance.HideSelectionRow.Options.UseBackColor = true; |
|
vgrid.Appearance.HorzLine.Options.UseBackColor = true; |
|
vgrid.Appearance.RowHeaderPanel.BackColor = Color.FromArgb(240, 240, 240); |
|
vgrid.Appearance.RowHeaderPanel.Options.UseBackColor = true; |
|
vgrid.Appearance.VertLine.Options.UseBackColor = true; |
|
} |
|
public static Form GetParentForm(System.Windows.Forms.Control target) |
|
{ |
|
if (target == null) |
|
{ |
|
return null; |
|
} |
|
if (target is Form) |
|
{ |
|
return (Form)target; |
|
} |
|
return DevExpressControlCommand.GetParentForm(target.Parent); |
|
} |
|
} |
|
}
|
|
|