This repository has been archived by the owner on Sep 11, 2023. It is now read-only.
/
Form1.cs
45 lines (40 loc) · 1.83 KB
/
Form1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace CustomCulture {
public partial class Form1 : Form {
[STAThread]
static void Main() {
// set the modified culture globally
//System.Globalization.CultureInfo culture;
//culture = System.Threading.Thread.CurrentThread.CurrentCulture.Clone() as System.Globalization.CultureInfo;
//culture.NumberFormat.NumberDecimalSeparator = ",";
//culture.NumberFormat.NumberGroupSeparator = " ";
//System.Threading.Thread.CurrentThread.CurrentCulture = culture;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
public Form1() {
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e) {
textEdit1.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;
textEdit1.Properties.Mask.UseMaskAsDisplayFormat = true;
textEdit1.EditValue = 1234.56789m;
textEdit2.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;
textEdit2.Properties.Mask.UseMaskAsDisplayFormat = true;
textEdit2.EditValue = 1234.56789m;
//assign the modified culture only to a given editor
System.Globalization.CultureInfo culture;
culture = System.Threading.Thread.CurrentThread.CurrentCulture.Clone() as System.Globalization.CultureInfo;
culture.NumberFormat.NumberDecimalSeparator = ",";
culture.NumberFormat.NumberGroupSeparator = " ";
textEdit1.Properties.Mask.Culture = culture;
}
}
}