feat: 13-几何图形和图画-1路径和集合图形

This commit is contained in:
Bunny 2025-01-18 21:17:29 +08:00
parent c35fafb88e
commit aded10ee6d
15 changed files with 204 additions and 0 deletions

View File

@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<RootNamespace>_13_几何图形和图画_1路径和集合图形</RootNamespace>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
</PropertyGroup>
<ItemGroup>
<Resource Include="public\003540AH4M72.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="public\bunny.png"/>
</ItemGroup>
</Project>

View File

@ -0,0 +1,9 @@
<Application x:Class="_13_几何图形和图画_1路径和集合图形.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:_13_几何图形和图画_1路径和集合图形"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>

View File

@ -0,0 +1,12 @@
using System.Configuration;
using System.Data;
using System.Windows;
namespace _13_几何图形和图画_1路径和集合图形;
/// <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,41 @@
<Window x:Class="_13_几何图形和图画_1路径和集合图形.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/003540AH4M72.jpg" Title="13-几何图形和图画-1路径和集合图形" Height="450" Width="800">
<ScrollViewer>
<StackPanel Margin="10">
<Label>直接使用图形绘制</Label>
<Rectangle Fill="Red" Stroke="Blue" Width="100" Height="50" />
<Label>图形,使用路径绘制</Label>
<Path Fill="Yellow" Stroke="Blue">
<Path.Data>
<RectangleGeometry Rect="0,0 100,50" />
</Path.Data>
</Path>
<Label>绘制直线</Label>
<Line Stroke="Blue" X1="0" Y1="0" X2="10" Y2="100" />
<Label>转变成LineGeometry</Label>
<Path Fill="Yellow" Stroke="Blue">
<Path.Data>
<LineGeometry StartPoint="0,0" EndPoint="10,100" />
</Path.Data>
</Path>
<Label>也可以将如下Ellipse形状</Label>
<Ellipse Fill="Yellow" Stroke="Blue" Width="100" Height="50" HorizontalAlignment="Left" />
<Label>转成EllipseGeometry</Label>
<Path Fill="Yellow" Stroke="Blue">
<Path.Data>
<EllipseGeometry RadiusX="50" RadiusY="25" Center="50,25" />
</Path.Data>
</Path>
</StackPanel>
</ScrollViewer>
</Window>

View File

@ -0,0 +1,23 @@
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace _13_几何图形和图画_1路径和集合图形;
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

View File

@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<RootNamespace>_13_几何图形和图画_2使用GeometryGroup组合形状</RootNamespace>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,9 @@
<Application x:Class="_13_几何图形和图画_2使用GeometryGroup组合形状.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:_13_几何图形和图画_2使用GeometryGroup组合形状"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>

View File

@ -0,0 +1,12 @@
using System.Configuration;
using System.Data;
using System.Windows;
namespace _13_几何图形和图画_2使用GeometryGroup组合形状;
/// <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,12 @@
<Window x:Class="_13_几何图形和图画_2使用GeometryGroup组合形状.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:_13_几何图形和图画_2使用GeometryGroup组合形状"
mc:Ignorable="d"
Title="13-几何图形和图画-2使用GeometryGroup组合形状" Height="450" Width="800">
<Grid>
</Grid>
</Window>

View File

@ -0,0 +1,23 @@
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace _13_几何图形和图画_2使用GeometryGroup组合形状;
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}

View File

@ -48,6 +48,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "12-形状画刷和变换-20
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "12-形状画刷和变换-21透明掩码形成倒影效果", "12-形状画刷和变换-21透明掩码形成倒影效果\12-形状画刷和变换-21透明掩码形成倒影效果.csproj", "{1966B41A-7080-4C83-9762-2FF6CEDC8500}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "13-几何图形和图画-1路径和集合图形", "13-几何图形和图画-1路径和集合图形\13-几何图形和图画-1路径和集合图形.csproj", "{34DD467C-F7B1-4733-ADB7-341958C8695B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "13-几何图形和图画-2使用GeometryGroup组合形状", "13-几何图形和图画-2使用GeometryGroup组合形状\13-几何图形和图画-2使用GeometryGroup组合形状.csproj", "{23BCED14-3B5E-43FE-A173-9A638A57F816}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -150,5 +154,13 @@ Global
{1966B41A-7080-4C83-9762-2FF6CEDC8500}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1966B41A-7080-4C83-9762-2FF6CEDC8500}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1966B41A-7080-4C83-9762-2FF6CEDC8500}.Release|Any CPU.Build.0 = Release|Any CPU
{34DD467C-F7B1-4733-ADB7-341958C8695B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{34DD467C-F7B1-4733-ADB7-341958C8695B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{34DD467C-F7B1-4733-ADB7-341958C8695B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{34DD467C-F7B1-4733-ADB7-341958C8695B}.Release|Any CPU.Build.0 = Release|Any CPU
{23BCED14-3B5E-43FE-A173-9A638A57F816}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{23BCED14-3B5E-43FE-A173-9A638A57F816}.Debug|Any CPU.Build.0 = Debug|Any CPU
{23BCED14-3B5E-43FE-A173-9A638A57F816}.Release|Any CPU.ActiveCfg = Release|Any CPU
{23BCED14-3B5E-43FE-A173-9A638A57F816}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal