* UITextBox:增加ShowScrollBar属性,单独控制垂直滚动条
This commit is contained in:
parent
70cdd7ce18
commit
e8e590b891
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -19,6 +19,7 @@
|
||||
* 2020-01-01: V2.2.0 增加文件说明
|
||||
* 2020-06-03: V2.2.5 增加多行,增加滚动条
|
||||
* 2020-09-03: V2.2.7 增加FocusedSelectAll属性,激活时全选。
|
||||
* 2021-04-18: V3.0.3 增加ShowScrollBar属性,单独控制垂直滚动条
|
||||
******************************************************************************/
|
||||
|
||||
using System;
|
||||
@ -42,7 +43,7 @@ namespace Sunny.UI
|
||||
InitializeComponent();
|
||||
SetStyleFlags();
|
||||
CalcEditHeight();
|
||||
Height = MiniHeight;
|
||||
Height = MinHeight;
|
||||
ShowText = false;
|
||||
Font = UIFontColor.Font;
|
||||
|
||||
@ -72,7 +73,7 @@ namespace Sunny.UI
|
||||
bar.ValueChanged += Bar_ValueChanged;
|
||||
edit.MouseWheel += OnMouseWheel;
|
||||
bar.MouseEnter += Bar_MouseEnter;
|
||||
base.TextAlignment = ContentAlignment.MiddleLeft;
|
||||
TextAlignment = ContentAlignment.MiddleLeft;
|
||||
|
||||
SizeChange();
|
||||
|
||||
@ -203,14 +204,42 @@ namespace Sunny.UI
|
||||
{
|
||||
multiline = value;
|
||||
edit.Multiline = value;
|
||||
// edit.ScrollBars = value ? ScrollBars.Vertical : ScrollBars.None;
|
||||
// bar.Visible = multiline;
|
||||
|
||||
edit.ScrollBars = value ? ScrollBars.Vertical : ScrollBars.None;
|
||||
bar.Visible = multiline;
|
||||
if (value && Type != UIEditType.String)
|
||||
{
|
||||
Type = UIEditType.String;
|
||||
}
|
||||
|
||||
SizeChange();
|
||||
}
|
||||
}
|
||||
|
||||
private bool showScrollBar;
|
||||
|
||||
[DefaultValue(false)]
|
||||
[Description("显示垂直滚动条"), Category("SunnyUI")]
|
||||
public bool ShowScrollBar
|
||||
{
|
||||
get => showScrollBar;
|
||||
set
|
||||
{
|
||||
value = value && Multiline;
|
||||
showScrollBar = value;
|
||||
if (value)
|
||||
{
|
||||
edit.ScrollBars = ScrollBars.Vertical;
|
||||
bar.Visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
edit.ScrollBars = ScrollBars.None;
|
||||
bar.Visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[DefaultValue(true)]
|
||||
public bool WordWarp
|
||||
{
|
||||
@ -320,14 +349,16 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
private int MiniHeight;
|
||||
private int MinHeight;
|
||||
private int MaxHeight;
|
||||
|
||||
private void CalcEditHeight()
|
||||
{
|
||||
UIEdit edt = new UIEdit();
|
||||
TextBox edt = new TextBox();
|
||||
edt.Font = edit.Font;
|
||||
edt.Invalidate();
|
||||
MiniHeight = edt.Height;
|
||||
MinHeight = edt.PreferredHeight;
|
||||
edt.BorderStyle = BorderStyle.None;
|
||||
MaxHeight = edt.PreferredHeight * 2 + MinHeight - edt.PreferredHeight;
|
||||
edt.Dispose();
|
||||
}
|
||||
|
||||
@ -335,10 +366,8 @@ namespace Sunny.UI
|
||||
{
|
||||
if (!multiline)
|
||||
{
|
||||
if (Height < MiniHeight)
|
||||
{
|
||||
Height = MiniHeight;
|
||||
}
|
||||
if (Height < MinHeight) Height = MinHeight;
|
||||
if (Height > MaxHeight) Height = MaxHeight;
|
||||
|
||||
edit.Top = (Height - edit.Height) / 2;
|
||||
edit.Left = 4;
|
||||
@ -615,7 +644,7 @@ namespace Sunny.UI
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
string currentItemText = values[i].ToString();
|
||||
if (!currentItemText.Equals("ListItems"))
|
||||
if (currentItemText != null && !currentItemText.Equals("ListItems"))
|
||||
{
|
||||
list.Add(values[i]);
|
||||
}
|
||||
|
@ -1,84 +1,84 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net5.0-windows;netcoreapp3.1;net40</TargetFrameworks>
|
||||
<ProjectGuid>{AB1CB247-E20B-4CBE-B269-570ADDD96C53}</ProjectGuid>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<RootNamespace>Sunny.UI</RootNamespace>
|
||||
<Description>SunnyUI.Net 是基于.Net Framework 4.0+、.Net Core3.1、.Net 5 框架的 C# WinForm 开源控件库、工具类库、扩展类库、多页面开发框架。</Description>
|
||||
<Copyright>CopyRight © SunnyUI.Net 2012-2021</Copyright>
|
||||
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
||||
<Version>3.0.3</Version>
|
||||
<Authors>ShenYonghua</Authors>
|
||||
<Company>SunnyUI.Net</Company>
|
||||
<PackageId>SunnyUI</PackageId>
|
||||
<PackageProjectUrl>https://gitee.com/yhuse/SunnyUI</PackageProjectUrl>
|
||||
<RepositoryUrl>https://gitee.com/yhuse/SunnyUI</RepositoryUrl>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
|
||||
<PackageIcon>SunnyUI.png</PackageIcon>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<OutputPath>..\Bin\</OutputPath>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<DocumentationFile></DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net5.0-windows;netcoreapp3.1;net40</TargetFrameworks>
|
||||
<ProjectGuid>{AB1CB247-E20B-4CBE-B269-570ADDD96C53}</ProjectGuid>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<RootNamespace>Sunny.UI</RootNamespace>
|
||||
<Description>SunnyUI.Net 是基于.Net Framework 4.0+、.Net Core3.1、.Net 5 框架的 C# WinForm 开源控件库、工具类库、扩展类库、多页面开发框架。</Description>
|
||||
<Copyright>CopyRight © SunnyUI.Net 2012-2021</Copyright>
|
||||
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
||||
<Version>3.0.3</Version>
|
||||
<Authors>ShenYonghua</Authors>
|
||||
<Company>SunnyUI.Net</Company>
|
||||
<PackageId>SunnyUI</PackageId>
|
||||
<PackageProjectUrl>https://gitee.com/yhuse/SunnyUI</PackageProjectUrl>
|
||||
<RepositoryUrl>https://gitee.com/yhuse/SunnyUI</RepositoryUrl>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
|
||||
<PackageIcon>SunnyUI.png</PackageIcon>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<OutputPath>..\Bin\</OutputPath>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<DocumentationFile></DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<OutputPath>..\Bin\</OutputPath>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<DocumentationFile></DocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net5.0-windows|AnyCPU'">
|
||||
<Optimize>false</Optimize>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<OutputPath>..\Bin\</OutputPath>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<DocumentationFile></DocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net5.0-windows|AnyCPU'">
|
||||
<Optimize>false</Optimize>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Remove="Font\ElegantIcons.ttf" />
|
||||
<None Remove="Font\FontAwesome.ttf" />
|
||||
<None Remove="Font\LigatureSymbols.ttf" />
|
||||
<None Include="..\LICENSE">
|
||||
<Pack>True</Pack>
|
||||
<PackagePath></PackagePath>
|
||||
<Pack>True</Pack>
|
||||
<PackagePath></PackagePath>
|
||||
</None>
|
||||
<None Include="..\SunnyUI.png">
|
||||
<Pack>True</Pack>
|
||||
<PackagePath></PackagePath>
|
||||
<Pack>True</Pack>
|
||||
<PackagePath></PackagePath>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Font\ElegantIcons.ttf" />
|
||||
<EmbeddedResource Include="Font\FontAwesome.ttf" />
|
||||
<EmbeddedResource Include="Font\LigatureSymbols.ttf" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Font\ElegantIcons.ttf" />
|
||||
<EmbeddedResource Include="Font\FontAwesome.ttf" />
|
||||
<EmbeddedResource Include="Font\LigatureSymbols.ttf" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SunnyUI.Common" Version="3.0.3" />
|
||||
</ItemGroup>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net40'">
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Design" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net40'">
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Design" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
Loading…
x
Reference in New Issue
Block a user