long212866235
摇摆不定的龙
采纳率50%
2020-06-16 17:45

C# WPF VS2015 如何实现窗口多开?

已采纳

代码如下,

<Window x:Class="WPF4.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WPF4"
        mc:Ignorable="d"
        Title="MainWindow" Height="300" Width="350" AllowsTransparency="True" WindowStyle="None" Background="Transparent" ShowInTaskbar="False">
    <Viewbox Stretch="Fill">
        <Canvas Height="299" Width="350">
            <Image x:Name="image" Height="300" Width="350" Source="Resources/02.png"/>
            <TextBox x:Name="textBox2" Height="205" TextWrapping="Wrap" Text="TextBox" Width="221" Canvas.Left="73" Canvas.Top="67" Background="Transparent" BorderThickness="0" AcceptsReturn="True" AcceptsTab="True" LostKeyboardFocus="textBox_LostKeyboardFocus"/>
            <Grid Height="29" Width="272" Name="titleMove" Canvas.Top="38" Canvas.Left="44"/>
            <Grid Height="210" Canvas.Left="294" Width="22" Name="titleMove2" Canvas.Top="67"/>
            <Label x:Name="label2" Content="Label" Canvas.Top="273" Width="340"/>
        </Canvas>
    </Viewbox>
</Window>

希望能够在运行时,在此界面上使用CTRL+左键 复制一个相同的界面窗口,具有相同功能,C#代码要如何写?怎样把此xaml文件全转为C#代码?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • caozhy 回答这么多问题就耍赖把我的积分一笔勾销了 10月前

    WPF4.MainWindow win = new WPF4.MainWindow();
    win.Show();

    点赞 1 评论 复制链接分享