Transparent window with a border

前端 未结 1 1792
我寻月下人不归
我寻月下人不归 2021-01-20 04:20

Im trying to make a small screenshot program, im making a small WPF window with a border. This should function as a \"Viewport\" so everything inside the window (within the

相关标签:
1条回答
  • 2021-01-20 04:51

    Not sure if you want the window or just the grid transparent with border.

    That draws a border around the window:

    <Window x:Class="MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525" 
            AllowsTransparency="True" 
            WindowStyle="None" 
            Background="Transparent" 
            BorderThickness="2" 
            BorderBrush="Black">
        <Grid>
    
        </Grid>
    </Window>
    

    This is drawing a broder around the grid only:

    <Window x:Class="MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525" AllowsTransparency="True" WindowStyle="None" Background="Transparent">
        <Border BorderThickness="2" BorderBrush="Black">
            <Grid>
    
            </Grid>
        </Border>
    </Window>
    
    0 讨论(0)
提交回复
热议问题