feat: WPF基础_11_动态布局

This commit is contained in:
Bunny 2025-01-01 19:11:00 +08:00
parent a57b9d9d0a
commit 95df7bdef1
10 changed files with 120 additions and 0 deletions

View File

@ -0,0 +1,9 @@
<Application x:Class="WPF基础_11_动态布局.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WPF基础_11_动态布局"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>

View File

@ -0,0 +1,12 @@
using System.Configuration;
using System.Data;
using System.Windows;
namespace WPF基础_11_动态布局;
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}

View File

@ -0,0 +1,10 @@
using System.Windows;
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

View File

@ -0,0 +1,29 @@
<Window x:Class="WPF基础_11_动态布局.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"
mc:Ignorable="d"
Icon="public/logo/1.ico"
Title="WPF基础_11_动态布局" Height="450" Width="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!-- Visibility="Visible" 显示面板 -->
<StackPanel Grid.Row="0" Grid.Column="0" Visibility="Visible">
<Button Name="CmdPre" Margin="10 10 10 3">上一页</Button>
<Button Name="CmdNext" Margin="10 10 10 3">下一页</Button>
<CheckBox Name="ChLongText" Margin="10" Checked="ChLongText_OnChecked" Unchecked="ChLongText_OnUnchecked">显示长文本</CheckBox>
</StackPanel>
<TextBox Grid.Row="0" Grid.Column="1" Margin="0 10 10 10 " TextWrapping="WrapWithOverflow" Grid.RowSpan="2">这是什么什么</TextBox>
<Button Grid.Row="1" Grid.Column="0" Name="CmdClose" Margin="10 3 10 10">关闭</Button>
</Grid>
</Window>

View File

@ -0,0 +1,30 @@
using System.Windows;
namespace WPF基础_11_动态布局;
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void ChLongText_OnChecked(object sender, RoutedEventArgs e)
{
CmdPre.Content = "非常长的上一页 非常长的上一页 非常长的上一页";
CmdNext.Content = "非常长的下一页 非常长的下一页 非常长的下一页";
ChLongText.Content = "显示长文本 显示长文本 显示长文本";
CmdClose.Content = "非常长的关闭按钮 非常长的关闭按钮 非常长的关闭按钮";
}
private void ChLongText_OnUnchecked(object sender, RoutedEventArgs e)
{
CmdPre.Content = "上一页";
CmdNext.Content = "下一页";
ChLongText.Content = "显示长文本";
CmdClose.Content = "关闭";
}
}

View File

@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<RootNamespace>WPF基础_11_动态布局</RootNamespace>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
</PropertyGroup>
<ItemGroup>
<Resource Include="public\images\003540AH4M72.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="public\logo\1.ico">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="public\logo\1.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
</ItemGroup>
</Project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

@ -50,6 +50,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF基础-9-InkCanvas1", "W
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF基础-10-布局示例", "WPF基础-10-布局示例\WPF基础-10-布局示例.csproj", "{4631C727-5394-44FC-84D7-DE1DE0622EF2}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF基础-10-布局示例", "WPF基础-10-布局示例\WPF基础-10-布局示例.csproj", "{4631C727-5394-44FC-84D7-DE1DE0622EF2}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF基础-11-动态布局", "WPF基础-11-动态布局\WPF基础-11-动态布局.csproj", "{376F75D0-937A-46A3-99E6-7260DD975D93}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -156,5 +158,9 @@ Global
{4631C727-5394-44FC-84D7-DE1DE0622EF2}.Debug|Any CPU.Build.0 = Debug|Any CPU {4631C727-5394-44FC-84D7-DE1DE0622EF2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4631C727-5394-44FC-84D7-DE1DE0622EF2}.Release|Any CPU.ActiveCfg = Release|Any CPU {4631C727-5394-44FC-84D7-DE1DE0622EF2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4631C727-5394-44FC-84D7-DE1DE0622EF2}.Release|Any CPU.Build.0 = Release|Any CPU {4631C727-5394-44FC-84D7-DE1DE0622EF2}.Release|Any CPU.Build.0 = Release|Any CPU
{376F75D0-937A-46A3-99E6-7260DD975D93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{376F75D0-937A-46A3-99E6-7260DD975D93}.Debug|Any CPU.Build.0 = Debug|Any CPU
{376F75D0-937A-46A3-99E6-7260DD975D93}.Release|Any CPU.ActiveCfg = Release|Any CPU
{376F75D0-937A-46A3-99E6-7260DD975D93}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal