登录页面基本功能完成
This commit is contained in:
commit
414366e706
2 files changed
+32
-4
No files matched your search
+3
-3
@@ -6,8 +6,8 @@
|
|||||||
xmlns:input="clr-namespace:System.Windows.Input;assembly=PresentationCore"
|
xmlns:input="clr-namespace:System.Windows.Input;assembly=PresentationCore"
|
||||||
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" Loaded="Window_Loaded">
|
||||||
<Grid FocusManager.FocusedElement="{Binding ElementName=Name}">
|
<Grid>
|
||||||
<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"/>
|
||||||
@@ -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"/>
|
<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="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"/>
|
<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>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
+29
-1
@@ -13,6 +13,7 @@ using System.Windows.Input;
|
|||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace formula_manage
|
namespace formula_manage
|
||||||
{
|
{
|
||||||
@@ -21,6 +22,25 @@ namespace formula_manage
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class Login : Window
|
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()
|
public Login()
|
||||||
{
|
{
|
||||||
@@ -59,8 +79,16 @@ namespace formula_manage
|
|||||||
{
|
{
|
||||||
if (e.Key == Key.Enter)
|
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