sc 2 years ago
parent
commit
d120e8b178
  1. 6
      Login.xaml
  2. 12
      Login.xaml.cs
  3. 4
      MainWindow.xaml

6
Login.xaml

@ -7,14 +7,14 @@
xmlns:local="clr-namespace:formula_manage" xmlns:local="clr-namespace:formula_manage"
mc:Ignorable="d" mc:Ignorable="d"
Title="Login" Height="360" Width="248"> Title="Login" Height="360" Width="248">
<Grid> <Grid FocusManager.FocusedElement="{Binding ElementName=Name}">
<Rectangle HorizontalAlignment="Center" Height="118" VerticalAlignment="Top" Width="248"> <Rectangle HorizontalAlignment="Center" Height="118" VerticalAlignment="Top" Width="248">
<Rectangle.Fill> <Rectangle.Fill>
<ImageBrush ImageSource="/sunlight_logotext.jpg"/> <ImageBrush ImageSource="/sunlight_logotext.jpg"/>
</Rectangle.Fill> </Rectangle.Fill>
</Rectangle> </Rectangle>
<ComboBox Name="Name" Height="24" Margin="60,164,10,0" VerticalAlignment="Top" FontSize="14" IsEditable="True"/> <ComboBox Name="Name" Height="24" Margin="60,164,10,0" VerticalAlignment="Top" FontSize="14" IsEditable="True" KeyUp="SearchBox_OnKeyDownd"/>
<PasswordBox Name="Pasword" Height="24" Margin="60,210,10,0" VerticalAlignment="Top" FontSize="14" input:InputMethod.IsInputMethodEnabled="False"/> <PasswordBox Name="Pasword" Height="24" Margin="60,210,10,0" VerticalAlignment="Top" FontSize="14" input:InputMethod.IsInputMethodEnabled="False" KeyUp="SearchBox_OnKeyDownd"/>
<TextBlock HorizontalAlignment="Left" Height="26" Margin="10,166,0,0" TextWrapping="Wrap" Text="账号" VerticalAlignment="Top" Width="41" FontSize="20" RenderTransformOrigin="0.833,0.478"/> <TextBlock HorizontalAlignment="Left" Height="26" Margin="10,166,0,0" TextWrapping="Wrap" Text="账号" VerticalAlignment="Top" Width="41" FontSize="20" RenderTransformOrigin="0.833,0.478"/>
<TextBlock HorizontalAlignment="Left" Height="26" Margin="10,210,0,0" TextWrapping="Wrap" Text="密码" VerticalAlignment="Top" Width="41" FontSize="20" RenderTransformOrigin="0.833,0.478"/> <TextBlock HorizontalAlignment="Left" Height="26" Margin="10,210,0,0" TextWrapping="Wrap" Text="密码" VerticalAlignment="Top" Width="41" FontSize="20" RenderTransformOrigin="0.833,0.478"/>
<Button Content="登录" HorizontalAlignment="Left" Height="23" Margin="60,264,0,0" VerticalAlignment="Top" Width="44" Click="Button_Click_1"/> <Button Content="登录" HorizontalAlignment="Left" Height="23" Margin="60,264,0,0" VerticalAlignment="Top" Width="44" Click="Button_Click_1"/>

12
Login.xaml.cs

@ -44,14 +44,24 @@ namespace formula_manage
{ {
if ((Name.Text == "engineer" || Name.Text == "ENGINEER") && (Pasword.Password == "engineer" || Pasword.Password == "ENGINEER")) if ((Name.Text == "engineer" || Name.Text == "ENGINEER") && (Pasword.Password == "engineer" || Pasword.Password == "ENGINEER"))
{ {
Window window = Window.GetWindow(this);
MainWindow Main = new MainWindow(); MainWindow Main = new MainWindow();
window.Close();
Main.ShowDialog();//实例化并置顶打开信息窗口 Main.ShowDialog();//实例化并置顶打开信息窗口
this.Close();
} }
else else
{ {
System.Windows.MessageBox.Show("账号或密码错误"); System.Windows.MessageBox.Show("账号或密码错误");
} }
} }
private void SearchBox_OnKeyDownd(object sender, System.Windows.Input.KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
SendKeys.SendWait("{tab}");
}
}
} }
} }

4
MainWindow.xaml

@ -74,9 +74,9 @@
<DataGridTextColumn Header="备注" Width="400" FontSize="15" MinWidth="100" CanUserReorder="False"/> <DataGridTextColumn Header="备注" Width="400" FontSize="15" MinWidth="100" CanUserReorder="False"/>
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
<Button Content="确认" HorizontalAlignment="Right" Height="40" Width="80" Margin="0,0,140,20" VerticalAlignment="Bottom" FontSize="20" Background="#FFEFEFEF" BorderBrush="White" Click="confirm"/>
<Button Content="打印" HorizontalAlignment="Right" Height="40" Width="80" Margin="0,0,55,20" VerticalAlignment="Bottom" FontSize="20" Background="#FFEFEFEF" BorderBrush="White" Click="print"/>
<Button Content="保存" HorizontalAlignment="Left" Height="40" Width="80" Margin="15,0,0,20" VerticalAlignment="Bottom" FontSize="20" Background="#FFEFEFEF" BorderBrush="White" Click="save"/> <Button Content="保存" HorizontalAlignment="Left" Height="40" Width="80" Margin="15,0,0,20" VerticalAlignment="Bottom" FontSize="20" Background="#FFEFEFEF" BorderBrush="White" Click="save"/>
<Button Content="删除" HorizontalAlignment="Left" Height="40" Width="80" Margin="100,0,0,20" VerticalAlignment="Bottom" FontSize="20" Background="#FFEFEFEF" BorderBrush="White" Click="delete"/> <Button Content="删除" HorizontalAlignment="Left" Height="40" Width="80" Margin="100,0,0,20" VerticalAlignment="Bottom" FontSize="20" Background="#FFEFEFEF" BorderBrush="White" Click="delete"/>
<Button Content="打印" HorizontalAlignment="Right" Height="40" Width="80" Margin="0,0,55,20" VerticalAlignment="Bottom" FontSize="20" Background="#FFEFEFEF" BorderBrush="White" Click="print"/>
<Button Content="确认" HorizontalAlignment="Right" Height="40" Width="80" Margin="0,0,140,20" VerticalAlignment="Bottom" FontSize="20" Background="#FFEFEFEF" BorderBrush="White" Click="confirm"/>
</Grid> </Grid>
</Window> </Window>

Loading…
Cancel
Save