添加语言设置

This commit is contained in:
sc committed 2024-09-16 16:45:12 +08:00
commit a15058af34
11 files changed
+275 -70

No files matched your search

+5 -5
View File
@@ -18,19 +18,19 @@
<TextBlock x:Name="P1N" HorizontalAlignment="Left" Height="30" Margin="10,120,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20" Background="#FFEFEEEE"/>
<TextBox x:Name="P1" HorizontalAlignment="Right" Height="30" Margin="0,120,10,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
Text="0" PreviewTextInput="Tb_KeyPress" InputMethod.IsInputMethodEnabled="False" FontSize="20" HorizontalContentAlignment="Right" />
Text="0" PreviewTextInput="Tb_KeyP1" InputMethod.IsInputMethodEnabled="False" FontSize="20" HorizontalContentAlignment="Right" />
<TextBlock x:Name="P2N" HorizontalAlignment="Left" Height="30" Margin="10,155,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20" Background="#FFEFEEEE"/>
<TextBox x:Name="P2" HorizontalAlignment="Right" Height="30" Margin="0,155,10,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
Text="0" PreviewTextInput="Tb_KeyPress" InputMethod.IsInputMethodEnabled="False" FontSize="20" HorizontalContentAlignment="Right" />
Text="0" PreviewTextInput="Tb_KeyP2" InputMethod.IsInputMethodEnabled="False" FontSize="20" HorizontalContentAlignment="Right" />
<TextBlock x:Name="P3N" HorizontalAlignment="Left" Height="30" Margin="10,190,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20" Background="#FFEFEEEE"/>
<TextBox x:Name="P3" HorizontalAlignment="Right" Height="30" Margin="0,190,10,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
Text="0" PreviewTextInput="Tb_KeyPress" InputMethod.IsInputMethodEnabled="False" FontSize="20" HorizontalContentAlignment="Right" />
Text="0" PreviewTextInput="Tb_KeyP3" InputMethod.IsInputMethodEnabled="False" FontSize="20" HorizontalContentAlignment="Right" />
<TextBlock x:Name="P4N" HorizontalAlignment="Left" Height="30" Margin="10,225,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20" Background="#FFEFEEEE"/>
<TextBox x:Name="P4" HorizontalAlignment="Right" Height="30" Margin="0,225,10,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
Text="0" PreviewTextInput="Tb_KeyPress" InputMethod.IsInputMethodEnabled="False" FontSize="20" HorizontalContentAlignment="Right" />
Text="0" PreviewTextInput="Tb_KeyP4" InputMethod.IsInputMethodEnabled="False" FontSize="20" HorizontalContentAlignment="Right" />
<TextBlock x:Name="P5N" HorizontalAlignment="Left" Height="30" Margin="10,260,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20" Background="#FFEFEEEE"/>
<TextBox x:Name="P5" HorizontalAlignment="Right" Height="30" Margin="0,260,10,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
Text="0" PreviewTextInput="Tb_KeyPress" InputMethod.IsInputMethodEnabled="False" FontSize="20" HorizontalContentAlignment="Right" />
Text="0" PreviewTextInput="Tb_KeyP5" InputMethod.IsInputMethodEnabled="False" FontSize="20" HorizontalContentAlignment="Right" />
<Button Content="{x:Static lang:Resources.YES}" HorizontalAlignment="Left" Height="35" Margin="50,70,0,5" VerticalAlignment="Bottom" Width="80" Click="YES_Click"/>
<Button Content="{x:Static lang:Resources.NO}" HorizontalAlignment="Right" Height="35" Margin="0,70,50,5" VerticalAlignment="Bottom" Width="80" Click="NO_Click"/>
+47 -3
View File
@@ -53,11 +53,55 @@ namespace DyeingComputer.Windows
private void Tb_KeyPress(object sender, TextCompositionEventArgs e)//输入事件
{
//Regex re = new Regex("[^0-9.-]+");
Regex re = new Regex(@"^[0-9]+(.[0-9]{1,3})?$");// 非零的正整数
Regex re = new Regex(@"^[0-9.]+(.[0-9]{1,3})?$");// 非零的正整数
e.Handled = !re.IsMatch(e.Text);
}
private void Tb_KeyP1(object sender, TextCompositionEventArgs e)//输入事件P1
{
Regex numbeRegex = new Regex("^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");
e.Handled =
!numbeRegex.IsMatch(
P1.Text.Insert(
P1.SelectionStart, e.Text));
P1.Text = P1.Text.Trim();
}
private void Tb_KeyP2(object sender, TextCompositionEventArgs e)//输入事件P2
{
Regex numbeRegex = new Regex("^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");
e.Handled =
!numbeRegex.IsMatch(
P2.Text.Insert(
P2.SelectionStart, e.Text));
P2.Text = P2.Text.Trim();
}
private void Tb_KeyP3(object sender, TextCompositionEventArgs e)//输入事件P3
{
Regex numbeRegex = new Regex("^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");
e.Handled =
!numbeRegex.IsMatch(
P3.Text.Insert(
P3.SelectionStart, e.Text));
P3.Text = P3.Text.Trim();
}
private void Tb_KeyP4(object sender, TextCompositionEventArgs e)//输入事件P4
{
Regex numbeRegex = new Regex("^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");
e.Handled =
!numbeRegex.IsMatch(
P4.Text.Insert(
P4.SelectionStart, e.Text));
P4.Text = P4.Text.Trim();
}
private void Tb_KeyP5(object sender, TextCompositionEventArgs e)//输入事件P5
{
Regex numbeRegex = new Regex("^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");
e.Handled =
!numbeRegex.IsMatch(
P5.Text.Insert(
P5.SelectionStart, e.Text));
P5.Text = P5.Text.Trim();
}
private readonly string[] a = {"001","007","008","013","015" ,"017", "020", "022", "031", "035", "036", "039", "040", "041", "049", "050",
"051", "054", "055", "056","064","065","066","067","090","091","093","094" };