<Window x:Name="mainWindow1" x:Class="WpfApplication9.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Width="984" Height="747" LocationChanged="mainWindow1_LocationChanged" Loaded="mainWindow1_Loaded"
Background="Transparent" OpacityMask="White" AllowsTransparency="True" WindowStyle="None" Cursor="Arrow"
WindowStartupLocation="CenterScreen"
>
<Grid Margin="0,0,0,-121" Loaded="Grid_Loaded" >
<Image x:Name="image1" Stretch="Fill" Source="main-bg.png" StretchDirection="Both" Width="984" Height="747" MouseDown="image1_MouseDown" Margin="0,0,0,121" />
<Button x:Name="btn1" Content="X" HorizontalAlignment="Left" VerticalAlignment="Top" Width="58" Margin="693,333,0,0" Click="Button_Click" Height="28" RenderTransformOrigin="-0.698,0.511"/>
<Rectangle x:Name="rect1" Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="222" Margin="235,377,0,0" Stroke="Black" VerticalAlignment="Top" Width="516"/>
<Label x:Name="lbl1" Content="Label" HorizontalAlignment="Left" Margin="102,246,0,0" VerticalAlignment="Top" Width="196"/>
<Button Content="-" HorizontalAlignment="Left" Height="28" Margin="641,333,0,0" VerticalAlignment="Top" Width="47" Click="Button_Click_1"/>
</Grid>
</Window>
namespace WpfApplication9
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
Close();
}
Form1 frm1 = new Form1();
private void Grid_Loaded(object sender, RoutedEventArgs e)
{
MoveFuc();
}
private void MoveFuc()
{
frm1.Left = (int)mainWindow1.Left + (int)rect1.Margin.Left;
frm1.Top = (int)mainWindow1.Top + (int)rect1.Margin.Top;
frm1.Width = (int)rect1.Width;
frm1.Height = (int)rect1.Height;
}
private void mainWindow1_LocationChanged(object sender, EventArgs e)
{
MoveFuc();
}
private void mainWindow1_Loaded(object sender, RoutedEventArgs e)
{
frm1.Show();
}
private void image1_MouseDown(object sender, MouseButtonEventArgs e)
{
DragMove();
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
mainWindow1.WindowState = System.Windows.WindowState.Minimized;
frm1.WindowState = System.Windows.Forms.FormWindowState.Minimized;
}
}
}
附件列表