feat: WPF控件-12-多文本
This commit is contained in:
parent
328110112b
commit
ade2d5bae6
|
@ -0,0 +1,9 @@
|
||||||
|
<Application x:Class="WPF控件_12_多文本.App"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="clr-namespace:WPF控件_12_多文本"
|
||||||
|
StartupUri="MainWindow.xaml">
|
||||||
|
<Application.Resources>
|
||||||
|
|
||||||
|
</Application.Resources>
|
||||||
|
</Application>
|
|
@ -0,0 +1,12 @@
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Data;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace WPF控件_12_多文本;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for App.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class App : Application
|
||||||
|
{
|
||||||
|
}
|
|
@ -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)
|
||||||
|
)]
|
|
@ -0,0 +1,32 @@
|
||||||
|
<Window x:Class="WPF控件_12_多文本.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"
|
||||||
|
Icon="public/003540AH4M72.jpg"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="WPF控件_12_多文本" Height="450" Width="800">
|
||||||
|
<ScrollViewer>
|
||||||
|
<StackPanel>
|
||||||
|
<Label>
|
||||||
|
RichTextBox
|
||||||
|
</Label>
|
||||||
|
<RichTextBox MinHeight="150" AutoWordSelection="True" />
|
||||||
|
|
||||||
|
<Label>
|
||||||
|
TextBox
|
||||||
|
</Label>
|
||||||
|
<TextBox Name="TextBox" MaxLength="199" TextWrapping="Wrap" MaxLines="2" MinHeight="150"
|
||||||
|
AcceptsReturn="True" AcceptsTab="True" AutoWordSelection="True"
|
||||||
|
MouseDoubleClick="TextBox_OnMouseDoubleClick" SelectionChanged="TextBox_OnSelectionChanged">
|
||||||
|
AcceptsReturn="True" (通常情况按下回车会触发默认按钮) AcceptsTab="True" (不会出现焦点现象跳转到下一个控件中)
|
||||||
|
|
||||||
|
</TextBox>
|
||||||
|
|
||||||
|
<Label>
|
||||||
|
PasswordBox
|
||||||
|
</Label>
|
||||||
|
<PasswordBox Margin="0 0 0 50" MinHeight="150" />
|
||||||
|
</StackPanel>
|
||||||
|
</ScrollViewer>
|
||||||
|
</Window>
|
|
@ -0,0 +1,25 @@
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace WPF控件_12_多文本;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for MainWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class MainWindow : Window
|
||||||
|
{
|
||||||
|
public MainWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TextBox_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"有多少行:{TextBox.LineCount}");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TextBox_OnSelectionChanged(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Console.WriteLine(TextBox.SelectedText);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
|
<RootNamespace>WPF控件_12_多文本</RootNamespace>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<UseWPF>true</UseWPF>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Resource Include="public\003540AH4M72.jpg">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Resource>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
Binary file not shown.
After Width: | Height: | Size: 97 KiB |
|
@ -26,6 +26,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF控件-11-Expander", "WP
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF控件-11-Expander2", "WPF控件-11-Expander2\WPF控件-11-Expander2.csproj", "{0D2CEE95-6B52-4D7D-B001-ED6AB4262875}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF控件-11-Expander2", "WPF控件-11-Expander2\WPF控件-11-Expander2.csproj", "{0D2CEE95-6B52-4D7D-B001-ED6AB4262875}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF控件-12-多文本", "WPF控件-12-多文本\WPF控件-12-多文本.csproj", "{45A695BD-4B02-47F4-8598-144E882A8CF6}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
@ -84,5 +86,9 @@ Global
|
||||||
{0D2CEE95-6B52-4D7D-B001-ED6AB4262875}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{0D2CEE95-6B52-4D7D-B001-ED6AB4262875}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{0D2CEE95-6B52-4D7D-B001-ED6AB4262875}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{0D2CEE95-6B52-4D7D-B001-ED6AB4262875}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{0D2CEE95-6B52-4D7D-B001-ED6AB4262875}.Release|Any CPU.Build.0 = Release|Any CPU
|
{0D2CEE95-6B52-4D7D-B001-ED6AB4262875}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{45A695BD-4B02-47F4-8598-144E882A8CF6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{45A695BD-4B02-47F4-8598-144E882A8CF6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{45A695BD-4B02-47F4-8598-144E882A8CF6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{45A695BD-4B02-47F4-8598-144E882A8CF6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|
Loading…
Reference in New Issue