feat: 14-效果和可视化对象-1绘制绘制可视化对象

This commit is contained in:
Bunny 2025-01-19 21:32:07 +08:00
parent fb3da6e29b
commit ca81b44353
9 changed files with 90 additions and 0 deletions

View File

@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<RootNamespace>_14_效果和可视化对象_1绘制绘制可视化对象</RootNamespace>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
</PropertyGroup>
<ItemGroup>
<Resource Include="public\003540AH4M72.jpg"/>
<Resource Include="public\bunny.png"/>
</ItemGroup>
</Project>

View File

@ -0,0 +1,9 @@
<Application x:Class="_14_效果和可视化对象_1绘制绘制可视化对象.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:_14_效果和可视化对象_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 _14_效果和可视化对象_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,11 @@
<Window x:Class="_14_效果和可视化对象_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="14-效果和可视化对象-1绘制绘制可视化对象 P329" Height="450" Width="800">
<StackPanel>
<Label>看后端代码</Label>
</StackPanel>
</Window>

View File

@ -0,0 +1,25 @@
using System.Windows;
using System.Windows.Media;
namespace _14_效果和可视化对象_1绘制绘制可视化对象;
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
var drawingVisual = new DrawingVisual();
using var context = drawingVisual.RenderOpen();
var pen = new Pen(Brushes.Aqua, 3);
context.DrawLine(pen, new Point(0, 50), new Point(50, 0));
context.DrawLine(pen, new Point(50, 0), new Point(100, 50));
context.DrawLine(pen, new Point(0, 50), new Point(100, 50));
context.Close();
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

View File

@ -64,6 +64,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "13-几何图形和图画-7
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "13-几何图形和图画-8图画", "13-几何图形和图画-8图画\13-几何图形和图画-8图画.csproj", "{3B7EF982-9ACD-4026-B3D6-7B22E0E31641}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "14-效果和可视化对象-1绘制绘制可视化对象", "14-效果和可视化对象-1绘制绘制可视化对象\14-效果和可视化对象-1绘制绘制可视化对象.csproj", "{3B0794E6-1A52-484B-9621-03C29708F6F9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -198,5 +200,9 @@ Global
{3B7EF982-9ACD-4026-B3D6-7B22E0E31641}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3B7EF982-9ACD-4026-B3D6-7B22E0E31641}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3B7EF982-9ACD-4026-B3D6-7B22E0E31641}.Release|Any CPU.Build.0 = Release|Any CPU
{3B0794E6-1A52-484B-9621-03C29708F6F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3B0794E6-1A52-484B-9621-03C29708F6F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3B0794E6-1A52-484B-9621-03C29708F6F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3B0794E6-1A52-484B-9621-03C29708F6F9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal