问题描述
我通过使主窗口不可见来创建了无边界应用程序,然后创建了边界并调整了拐角半径以使我的应用程序看起来更吸引人.
我做了最小化/最大化/关闭按钮,尽管当应用程序最大化时,边框保持相同的高度和宽度.我希望它可以使高度和宽度在最大化时发生变化,或者具有被拖动到更宽的能力等.
我知道可以将主窗口的大小调整为"CanResize"或"CanResizeWithGrip",但是这些功能并非仅适用于边框.
有人知道我能解决这个问题吗?即使边框可调整大小?!
任何帮助表示赞赏.谢谢.
这是我的XAML:
I have created a borderless application by making the main window invisible, then I created a border and adjusted the corner radius to make my application look appealing.
I have made the minimize/maximize/close buttons although when the application is maximized the border stays the same height and width. I would like it so the height and width would change when maximized or have the ability to be dragged wider etc.
I know the main window can be made resizeable either "CanResize" or "CanResizeWithGrip" however these functions are not available solely to the border.
Does anyone know how I am able to solve this? i.e. Make the border resizable?!
Any help is appreciated. Thanks.
Here is my XAML:
Title="TITLE" Height="400" Width="600" AllowsTransparency="True" WindowStyle="None" Background="{x:Null}" Icon="/TITLE;component/Images/TITLE1.png">
<Grid>
<Border BorderBrush="#50000000" BorderThickness="4" HorizontalAlignment="Left" Margin="12,12,0,0" Name="TITLEBorder" VerticalAlignment="Top" CornerRadius="100,40,100,40" MouseLeftButtonDown="TITLEBorder_MouseLeftButtonDown" MinWidth="554" MinHeight="337" MaxWidth="Infinity" MaxHeight="Infinity" >
<Border.Effect>
<DropShadowEffect x:Name="TITLEBorderShdw" BlurRadius="44" ShadowDepth="0" Color="Black"></DropShadowEffect>
</Border.Effect>
<Border.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#8649E3BA" Offset="0" />
<GradientStop Color="#89FFFFFF" Offset="1" />
<GradientStop Color="#AF4CA2CC" Offset="0.639" />
</LinearGradientBrush>
</Border.Background>
<Grid>
<Button Name="CloseButton" Style="{StaticResource ResourceKey=CloseButton}" Height="20" Width="20" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="20,4" Click="CloseButton_Click" />
<Button Name="MinimizeButton" Height="20" Width="20" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="64,4" Style="{StaticResource ResourceKey=MinimizeButton}" Click="MinimizeButton_Click" />
<Button Name="MaximizeButton" Style="{StaticResource ResourceKey=MaximizeButton}" Height="20" Width="20" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="42,4"
Click="MaximizeButton_Click" />
<Button Name="RestoreButton" Style="{StaticResource ResourceKey=RestoreButton}" Height="20" VerticalAlignment="Top" Margin="484,4,42,0" Click="RestoreButton_Click" />
</Grid>
</Border>
</Grid>
</Window>
好吧,我已经做了这些改进;我现在想要调整大小?通过抓握或使用google找到的这一段,尽管没有说明您将需要在小部件上跟踪mouseEvents,如果鼠标在特定的角落,请更改光标.
然后捕获鼠标按下事件,并根据鼠标移动事件调整窗口小部件的大小. ",帮助/说明?
Okay, I have made these improvements; I would now like it to be resizable? either by grip or this paragraph which was found using google, although it was not explained "You wil need to trace mouseEvents on your widget, change the cursor if the mouse in a specific corner.
Then catch mouse press events and resize your widget on mouse move events. ", Help/Explaination?
Title="TITLE" AllowsTransparency="True" WindowStyle="None" Background="{x:Null}" Icon="/TITLE;component/Images/TITLE1.png">
<Grid>
<Border BorderBrush="#50000000" BorderThickness="4" HorizontalAlignment="Right" Margin="12,12,0,0" Name="TITLEBorder" VerticalAlignment="Stretch" CornerRadius="100,40,100,40" MouseLeftButtonDown="TITLEBorder_MouseLeftButtonDown" Width="640" Height="360" >
推荐答案
这篇关于WPF无边界应用程序,如何调整大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!