登录页面基本功能完成
This commit is contained in:
commit
414366e706
2 files changed
+33
-5
No files matched your search
+3
-3
@@ -6,8 +6,8 @@
|
||||
xmlns:input="clr-namespace:System.Windows.Input;assembly=PresentationCore"
|
||||
xmlns:local="clr-namespace:formula_manage"
|
||||
mc:Ignorable="d"
|
||||
Title="Login" Height="360" Width="248">
|
||||
<Grid FocusManager.FocusedElement="{Binding ElementName=Name}">
|
||||
Title="Login" Height="360" Width="248" Loaded="Window_Loaded">
|
||||
<Grid>
|
||||
<Rectangle HorizontalAlignment="Center" Height="118" VerticalAlignment="Top" Width="248">
|
||||
<Rectangle.Fill>
|
||||
<ImageBrush ImageSource="/sunlight_logotext.jpg"/>
|
||||
@@ -19,7 +19,7 @@
|
||||
<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" Background="#FFDDDDDD" Foreground="Black" BorderBrush="White"/>
|
||||
<Button Content="退出" HorizontalAlignment="Left" Height="23" Margin="140,264,0,0" VerticalAlignment="Top" Width="44" Click="Button_Click" Background="#FFDDDDDD" Foreground="Black" BorderBrush="White"/>
|
||||
<TextBlock Height="30" Margin="20,115,20,0" TextWrapping="Wrap" Text="物料单据管理程序" VerticalAlignment="Top" FontSize="24"/>
|
||||
<TextBlock Height="30" Margin="15,115,15,0" TextWrapping="Wrap" Text="尚彩科技单据管理系统" VerticalAlignment="Top" FontSize="20"/>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
+30
-2
@@ -13,6 +13,7 @@ using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace formula_manage
|
||||
{
|
||||
@@ -21,7 +22,26 @@ namespace formula_manage
|
||||
/// </summary>
|
||||
public partial class Login : Window
|
||||
{
|
||||
|
||||
[DllImport("user32.dll", SetLastError = true)]
|
||||
static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, UIntPtr dwExtraInfo);
|
||||
public static void PressKey(Keys key, bool up)
|
||||
{
|
||||
const int KEYEVENTF_EXTENDEDKEY = 0x1;
|
||||
const int KEYEVENTF_KEYUP = 0x2;
|
||||
if (up)
|
||||
{
|
||||
|
||||
keybd_event((byte)key, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, (UIntPtr)0);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
keybd_event((byte)key, 0x45, KEYEVENTF_EXTENDEDKEY, (UIntPtr)0);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public Login()
|
||||
{
|
||||
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||
@@ -59,8 +79,16 @@ namespace formula_manage
|
||||
{
|
||||
if (e.Key == Key.Enter)
|
||||
{
|
||||
SendKeys.SendWait("{Tab}");
|
||||
//SendKeys.SendWait("{Tab}");
|
||||
PressKey(Keys.Tab, false);
|
||||
PressKey(Keys.Tab, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
PressKey(Keys.Tab, false);
|
||||
PressKey(Keys.Tab, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user