first commit
This commit is contained in:
commit
b092361d23
61
X009/.gitattributes
vendored
Normal file
61
X009/.gitattributes
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
###############################################################################
|
||||
# Set default behavior to automatically normalize line endings.
|
||||
###############################################################################
|
||||
* text=auto
|
||||
###############################################################################
|
||||
# Set default behavior for command prompt diff.
|
||||
#
|
||||
# This is need for earlier builds of msysgit that does not have it on by
|
||||
# default for csharp files.
|
||||
# Note: This is only used by command line
|
||||
###############################################################################
|
||||
#*.cs diff=csharp
|
||||
###############################################################################
|
||||
# Set the merge driver for project and solution files
|
||||
#
|
||||
# Merging from the command prompt will add diff markers to the files if there
|
||||
# are conflicts (Merging from VS is not affected by the settings below, in VS
|
||||
# the diff markers are never inserted). Diff markers may cause the following
|
||||
# file extensions to fail to load in VS. An alternative would be to treat
|
||||
# these files as binary and thus will always conflict and require user
|
||||
# intervention with every merge. To do so, just uncomment the entries below
|
||||
###############################################################################
|
||||
#*.sln merge=binary
|
||||
#*.csproj merge=binary
|
||||
#*.vbproj merge=binary
|
||||
#*.vcxproj merge=binary
|
||||
#*.vcproj merge=binary
|
||||
#*.dbproj merge=binary
|
||||
#*.fsproj merge=binary
|
||||
#*.lsproj merge=binary
|
||||
#*.wixproj merge=binary
|
||||
#*.modelproj merge=binary
|
||||
#*.sqlproj merge=binary
|
||||
#*.wwaproj merge=binary
|
||||
###############################################################################
|
||||
# behavior for image files
|
||||
#
|
||||
# image files are treated as binary by default.
|
||||
###############################################################################
|
||||
#*.jpg binary
|
||||
#*.png binary
|
||||
#*.gif binary
|
||||
###############################################################################
|
||||
# diff behavior for common document formats
|
||||
#
|
||||
# Convert binary document formats to text before diffing them. This feature
|
||||
# is only available from the command line. Turn it on by uncommenting the
|
||||
# entries below.
|
||||
###############################################################################
|
||||
#*.doc diff=astextplain
|
||||
#*.DOC diff=astextplain
|
||||
#*.docx diff=astextplain
|
||||
#*.DOCX diff=astextplain
|
||||
#*.dot diff=astextplain
|
||||
#*.DOT diff=astextplain
|
||||
#*.pdf diff=astextplain
|
||||
#*.PDF diff=astextplain
|
||||
#*.rtf diff=astextplain
|
||||
#*.RTF diff=astextplain
|
||||
DVPCameraCS_Net6.0/x64 filter=lfs diff=lfs merge=lfs -text
|
||||
DVPCameraCS_Net6.0/x64/DVPCameraCS64.dll filter=lfs diff=lfs merge=lfs -text
|
190
X009/.gitignore
vendored
Normal file
190
X009/.gitignore
vendored
Normal file
@ -0,0 +1,190 @@
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.sln.docstates
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
build/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
|
||||
# Visual Studio 2015 cache/options directory
|
||||
.vs/
|
||||
/.vs/
|
||||
|
||||
# Roslyn cache directories
|
||||
*.ide/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
#NUNIT
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_i.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# JustCode is a .NET coding addin-in
|
||||
.JustCode
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
## TODO: Comment the next line if you want to checkin your
|
||||
## web deploy settings but do note that will include unencrypted
|
||||
## passwords
|
||||
*.pubxml
|
||||
|
||||
# NuGet Packages
|
||||
packages/*
|
||||
*.nupkg
|
||||
## TODO: If the tool you use requires repositories.config
|
||||
## uncomment the next line
|
||||
#!packages/repositories.config
|
||||
|
||||
# Enable "build/" folder in the NuGet Packages folder since
|
||||
# NuGet packages use it for MSBuild targets.
|
||||
# This line needs to be after the ignore of the build folder
|
||||
# (and the packages folder if the line above has been uncommented)
|
||||
!packages/build/
|
||||
|
||||
# Windows Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Windows Store app package directory
|
||||
AppPackages/
|
||||
|
||||
# Others
|
||||
sql/
|
||||
*.Cache
|
||||
ClientBin/
|
||||
[Ss]tyle[Cc]op.*
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
node_modules/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
3
X009/.gitmodules
vendored
Normal file
3
X009/.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[submodule "libs"]
|
||||
path = libs
|
||||
url = https://gitea.star-rising.cn/ProductRDCenter/DefectDetectShareLibs.git
|
187
X009/X009.sln
Normal file
187
X009/X009.sln
Normal file
@ -0,0 +1,187 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.3.32804.467
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Common", "Common", "{2B47A691-2317-4D19-8564-692A02CCAD90}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DataBase", "DataBase", "{5992961C-E540-4917-BDE3-FD38D3D9119D}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Device", "Device", "{4866184D-8BF7-4E88-B7B0-90AE832CF02E}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Process", "Process", "{ECEB5C37-BE45-4A07-9D45-1279674558B6}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UI", "UI", "{9F3E8531-5DE7-4231-88FD-2B7D42BF0B1F}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XKRS.Process", "src\XKRS.Process\XKRS.Process.csproj", "{A88E6864-5F59-48C6-8679-5F1D86585460}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XKRS.UI.Main", "src\XKRS.UI.Main\XKRS.UI.Main.csproj", "{02CD9AC7-2A3E-4728-B18E-867EF718B507}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XKRS.DataBase.Model", "src\XKRS.DataBase.Model\XKRS.DataBase.Model.csproj", "{CC0BE6C3-C74C-4E73-B7CB-2E3D18C87B11}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XKRS.Process.DataBase", "src\XKRS.Process.DataBase\XKRS.Process.DataBase.csproj", "{CB016162-1E90-4012-9739-F14CB9E0DE6B}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "User", "User", "{611C67A7-7BA2-41EE-865D-0C886902DEAC}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XKRS.UserOperate", "Src\XKRS.UserOperate\XKRS.UserOperate.csproj", "{574412DD-D5F8-4696-B9F9-153593F34425}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XKRS.Common.Device", "src\XKRS.Common.Device\XKRS.Common.Device.csproj", "{BBC5A191-ED14-47B0-9246-7EA281CD9089}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XKRS.Common.Model", "src\XKRS.Common.Model\XKRS.Common.Model.csproj", "{301F40A2-F585-42B3-AA39-5F48F6BC87BE}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XKRS.Device.MGSCamera", "src\XKRS.Device.MGSCamera\XKRS.Device.MGSCamera.csproj", "{9CD1732B-2018-43E5-9ED3-1FC6B4B6FAD0}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XKRS.Device.SimboVision", "src\XKRS.Device.SimboVision\XKRS.Device.SimboVision.csproj", "{BFAAB79F-88DF-486B-A8B6-676F14485BDF}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XKRS.Process.X009", "src\XKRS.Process.X009\XKRS.Process.X009.csproj", "{E69F515D-2019-4904-AE85-F4C942074E5F}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x64 = Release|x64
|
||||
ReleaseWithDbg|Any CPU = ReleaseWithDbg|Any CPU
|
||||
ReleaseWithDbg|x64 = ReleaseWithDbg|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{A88E6864-5F59-48C6-8679-5F1D86585460}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A88E6864-5F59-48C6-8679-5F1D86585460}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A88E6864-5F59-48C6-8679-5F1D86585460}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{A88E6864-5F59-48C6-8679-5F1D86585460}.Debug|x64.Build.0 = Debug|x64
|
||||
{A88E6864-5F59-48C6-8679-5F1D86585460}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A88E6864-5F59-48C6-8679-5F1D86585460}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A88E6864-5F59-48C6-8679-5F1D86585460}.Release|x64.ActiveCfg = Release|x64
|
||||
{A88E6864-5F59-48C6-8679-5F1D86585460}.Release|x64.Build.0 = Release|x64
|
||||
{A88E6864-5F59-48C6-8679-5F1D86585460}.ReleaseWithDbg|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A88E6864-5F59-48C6-8679-5F1D86585460}.ReleaseWithDbg|Any CPU.Build.0 = Release|Any CPU
|
||||
{A88E6864-5F59-48C6-8679-5F1D86585460}.ReleaseWithDbg|x64.ActiveCfg = Release|x64
|
||||
{A88E6864-5F59-48C6-8679-5F1D86585460}.ReleaseWithDbg|x64.Build.0 = Release|x64
|
||||
{02CD9AC7-2A3E-4728-B18E-867EF718B507}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{02CD9AC7-2A3E-4728-B18E-867EF718B507}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{02CD9AC7-2A3E-4728-B18E-867EF718B507}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{02CD9AC7-2A3E-4728-B18E-867EF718B507}.Debug|x64.Build.0 = Debug|x64
|
||||
{02CD9AC7-2A3E-4728-B18E-867EF718B507}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{02CD9AC7-2A3E-4728-B18E-867EF718B507}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{02CD9AC7-2A3E-4728-B18E-867EF718B507}.Release|x64.ActiveCfg = Release|x64
|
||||
{02CD9AC7-2A3E-4728-B18E-867EF718B507}.Release|x64.Build.0 = Release|x64
|
||||
{02CD9AC7-2A3E-4728-B18E-867EF718B507}.ReleaseWithDbg|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{02CD9AC7-2A3E-4728-B18E-867EF718B507}.ReleaseWithDbg|Any CPU.Build.0 = Release|Any CPU
|
||||
{02CD9AC7-2A3E-4728-B18E-867EF718B507}.ReleaseWithDbg|x64.ActiveCfg = Release|x64
|
||||
{02CD9AC7-2A3E-4728-B18E-867EF718B507}.ReleaseWithDbg|x64.Build.0 = Release|x64
|
||||
{CC0BE6C3-C74C-4E73-B7CB-2E3D18C87B11}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CC0BE6C3-C74C-4E73-B7CB-2E3D18C87B11}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CC0BE6C3-C74C-4E73-B7CB-2E3D18C87B11}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{CC0BE6C3-C74C-4E73-B7CB-2E3D18C87B11}.Debug|x64.Build.0 = Debug|x64
|
||||
{CC0BE6C3-C74C-4E73-B7CB-2E3D18C87B11}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CC0BE6C3-C74C-4E73-B7CB-2E3D18C87B11}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CC0BE6C3-C74C-4E73-B7CB-2E3D18C87B11}.Release|x64.ActiveCfg = Release|x64
|
||||
{CC0BE6C3-C74C-4E73-B7CB-2E3D18C87B11}.Release|x64.Build.0 = Release|x64
|
||||
{CC0BE6C3-C74C-4E73-B7CB-2E3D18C87B11}.ReleaseWithDbg|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CC0BE6C3-C74C-4E73-B7CB-2E3D18C87B11}.ReleaseWithDbg|Any CPU.Build.0 = Release|Any CPU
|
||||
{CC0BE6C3-C74C-4E73-B7CB-2E3D18C87B11}.ReleaseWithDbg|x64.ActiveCfg = Release|x64
|
||||
{CC0BE6C3-C74C-4E73-B7CB-2E3D18C87B11}.ReleaseWithDbg|x64.Build.0 = Release|x64
|
||||
{CB016162-1E90-4012-9739-F14CB9E0DE6B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CB016162-1E90-4012-9739-F14CB9E0DE6B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CB016162-1E90-4012-9739-F14CB9E0DE6B}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{CB016162-1E90-4012-9739-F14CB9E0DE6B}.Debug|x64.Build.0 = Debug|x64
|
||||
{CB016162-1E90-4012-9739-F14CB9E0DE6B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CB016162-1E90-4012-9739-F14CB9E0DE6B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CB016162-1E90-4012-9739-F14CB9E0DE6B}.Release|x64.ActiveCfg = Release|x64
|
||||
{CB016162-1E90-4012-9739-F14CB9E0DE6B}.Release|x64.Build.0 = Release|x64
|
||||
{CB016162-1E90-4012-9739-F14CB9E0DE6B}.ReleaseWithDbg|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CB016162-1E90-4012-9739-F14CB9E0DE6B}.ReleaseWithDbg|Any CPU.Build.0 = Release|Any CPU
|
||||
{CB016162-1E90-4012-9739-F14CB9E0DE6B}.ReleaseWithDbg|x64.ActiveCfg = Release|x64
|
||||
{CB016162-1E90-4012-9739-F14CB9E0DE6B}.ReleaseWithDbg|x64.Build.0 = Release|x64
|
||||
{574412DD-D5F8-4696-B9F9-153593F34425}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{574412DD-D5F8-4696-B9F9-153593F34425}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{574412DD-D5F8-4696-B9F9-153593F34425}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{574412DD-D5F8-4696-B9F9-153593F34425}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{574412DD-D5F8-4696-B9F9-153593F34425}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{574412DD-D5F8-4696-B9F9-153593F34425}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{574412DD-D5F8-4696-B9F9-153593F34425}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{574412DD-D5F8-4696-B9F9-153593F34425}.Release|x64.Build.0 = Release|Any CPU
|
||||
{574412DD-D5F8-4696-B9F9-153593F34425}.ReleaseWithDbg|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{574412DD-D5F8-4696-B9F9-153593F34425}.ReleaseWithDbg|Any CPU.Build.0 = Release|Any CPU
|
||||
{574412DD-D5F8-4696-B9F9-153593F34425}.ReleaseWithDbg|x64.ActiveCfg = Release|Any CPU
|
||||
{574412DD-D5F8-4696-B9F9-153593F34425}.ReleaseWithDbg|x64.Build.0 = Release|Any CPU
|
||||
{BBC5A191-ED14-47B0-9246-7EA281CD9089}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BBC5A191-ED14-47B0-9246-7EA281CD9089}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BBC5A191-ED14-47B0-9246-7EA281CD9089}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{BBC5A191-ED14-47B0-9246-7EA281CD9089}.Debug|x64.Build.0 = Debug|x64
|
||||
{BBC5A191-ED14-47B0-9246-7EA281CD9089}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BBC5A191-ED14-47B0-9246-7EA281CD9089}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{BBC5A191-ED14-47B0-9246-7EA281CD9089}.Release|x64.ActiveCfg = Release|x64
|
||||
{BBC5A191-ED14-47B0-9246-7EA281CD9089}.Release|x64.Build.0 = Release|x64
|
||||
{BBC5A191-ED14-47B0-9246-7EA281CD9089}.ReleaseWithDbg|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BBC5A191-ED14-47B0-9246-7EA281CD9089}.ReleaseWithDbg|Any CPU.Build.0 = Release|Any CPU
|
||||
{BBC5A191-ED14-47B0-9246-7EA281CD9089}.ReleaseWithDbg|x64.ActiveCfg = Release|x64
|
||||
{BBC5A191-ED14-47B0-9246-7EA281CD9089}.ReleaseWithDbg|x64.Build.0 = Release|x64
|
||||
{301F40A2-F585-42B3-AA39-5F48F6BC87BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{301F40A2-F585-42B3-AA39-5F48F6BC87BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{301F40A2-F585-42B3-AA39-5F48F6BC87BE}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{301F40A2-F585-42B3-AA39-5F48F6BC87BE}.Debug|x64.Build.0 = Debug|x64
|
||||
{301F40A2-F585-42B3-AA39-5F48F6BC87BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{301F40A2-F585-42B3-AA39-5F48F6BC87BE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{301F40A2-F585-42B3-AA39-5F48F6BC87BE}.Release|x64.ActiveCfg = Release|x64
|
||||
{301F40A2-F585-42B3-AA39-5F48F6BC87BE}.Release|x64.Build.0 = Release|x64
|
||||
{301F40A2-F585-42B3-AA39-5F48F6BC87BE}.ReleaseWithDbg|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{301F40A2-F585-42B3-AA39-5F48F6BC87BE}.ReleaseWithDbg|Any CPU.Build.0 = Release|Any CPU
|
||||
{301F40A2-F585-42B3-AA39-5F48F6BC87BE}.ReleaseWithDbg|x64.ActiveCfg = Release|x64
|
||||
{301F40A2-F585-42B3-AA39-5F48F6BC87BE}.ReleaseWithDbg|x64.Build.0 = Release|x64
|
||||
{9CD1732B-2018-43E5-9ED3-1FC6B4B6FAD0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9CD1732B-2018-43E5-9ED3-1FC6B4B6FAD0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9CD1732B-2018-43E5-9ED3-1FC6B4B6FAD0}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{9CD1732B-2018-43E5-9ED3-1FC6B4B6FAD0}.Debug|x64.Build.0 = Debug|x64
|
||||
{9CD1732B-2018-43E5-9ED3-1FC6B4B6FAD0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9CD1732B-2018-43E5-9ED3-1FC6B4B6FAD0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9CD1732B-2018-43E5-9ED3-1FC6B4B6FAD0}.Release|x64.ActiveCfg = Release|x64
|
||||
{9CD1732B-2018-43E5-9ED3-1FC6B4B6FAD0}.Release|x64.Build.0 = Release|x64
|
||||
{9CD1732B-2018-43E5-9ED3-1FC6B4B6FAD0}.ReleaseWithDbg|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9CD1732B-2018-43E5-9ED3-1FC6B4B6FAD0}.ReleaseWithDbg|Any CPU.Build.0 = Release|Any CPU
|
||||
{9CD1732B-2018-43E5-9ED3-1FC6B4B6FAD0}.ReleaseWithDbg|x64.ActiveCfg = Release|x64
|
||||
{9CD1732B-2018-43E5-9ED3-1FC6B4B6FAD0}.ReleaseWithDbg|x64.Build.0 = Release|x64
|
||||
{BFAAB79F-88DF-486B-A8B6-676F14485BDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BFAAB79F-88DF-486B-A8B6-676F14485BDF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BFAAB79F-88DF-486B-A8B6-676F14485BDF}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{BFAAB79F-88DF-486B-A8B6-676F14485BDF}.Debug|x64.Build.0 = Debug|x64
|
||||
{BFAAB79F-88DF-486B-A8B6-676F14485BDF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BFAAB79F-88DF-486B-A8B6-676F14485BDF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{BFAAB79F-88DF-486B-A8B6-676F14485BDF}.Release|x64.ActiveCfg = Release|x64
|
||||
{BFAAB79F-88DF-486B-A8B6-676F14485BDF}.Release|x64.Build.0 = Release|x64
|
||||
{BFAAB79F-88DF-486B-A8B6-676F14485BDF}.ReleaseWithDbg|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BFAAB79F-88DF-486B-A8B6-676F14485BDF}.ReleaseWithDbg|Any CPU.Build.0 = Release|Any CPU
|
||||
{BFAAB79F-88DF-486B-A8B6-676F14485BDF}.ReleaseWithDbg|x64.ActiveCfg = Release|x64
|
||||
{BFAAB79F-88DF-486B-A8B6-676F14485BDF}.ReleaseWithDbg|x64.Build.0 = Release|x64
|
||||
{E69F515D-2019-4904-AE85-F4C942074E5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E69F515D-2019-4904-AE85-F4C942074E5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E69F515D-2019-4904-AE85-F4C942074E5F}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{E69F515D-2019-4904-AE85-F4C942074E5F}.Debug|x64.Build.0 = Debug|x64
|
||||
{E69F515D-2019-4904-AE85-F4C942074E5F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E69F515D-2019-4904-AE85-F4C942074E5F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E69F515D-2019-4904-AE85-F4C942074E5F}.Release|x64.ActiveCfg = Release|x64
|
||||
{E69F515D-2019-4904-AE85-F4C942074E5F}.Release|x64.Build.0 = Release|x64
|
||||
{E69F515D-2019-4904-AE85-F4C942074E5F}.ReleaseWithDbg|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E69F515D-2019-4904-AE85-F4C942074E5F}.ReleaseWithDbg|Any CPU.Build.0 = Release|Any CPU
|
||||
{E69F515D-2019-4904-AE85-F4C942074E5F}.ReleaseWithDbg|x64.ActiveCfg = Release|x64
|
||||
{E69F515D-2019-4904-AE85-F4C942074E5F}.ReleaseWithDbg|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{A88E6864-5F59-48C6-8679-5F1D86585460} = {ECEB5C37-BE45-4A07-9D45-1279674558B6}
|
||||
{02CD9AC7-2A3E-4728-B18E-867EF718B507} = {9F3E8531-5DE7-4231-88FD-2B7D42BF0B1F}
|
||||
{CC0BE6C3-C74C-4E73-B7CB-2E3D18C87B11} = {5992961C-E540-4917-BDE3-FD38D3D9119D}
|
||||
{CB016162-1E90-4012-9739-F14CB9E0DE6B} = {ECEB5C37-BE45-4A07-9D45-1279674558B6}
|
||||
{574412DD-D5F8-4696-B9F9-153593F34425} = {611C67A7-7BA2-41EE-865D-0C886902DEAC}
|
||||
{BBC5A191-ED14-47B0-9246-7EA281CD9089} = {2B47A691-2317-4D19-8564-692A02CCAD90}
|
||||
{301F40A2-F585-42B3-AA39-5F48F6BC87BE} = {2B47A691-2317-4D19-8564-692A02CCAD90}
|
||||
{9CD1732B-2018-43E5-9ED3-1FC6B4B6FAD0} = {4866184D-8BF7-4E88-B7B0-90AE832CF02E}
|
||||
{BFAAB79F-88DF-486B-A8B6-676F14485BDF} = {4866184D-8BF7-4E88-B7B0-90AE832CF02E}
|
||||
{E69F515D-2019-4904-AE85-F4C942074E5F} = {ECEB5C37-BE45-4A07-9D45-1279674558B6}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {7E53EE8F-F06F-4DD1-895D-81471109E5A5}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
73
X009/src/HZH_Controls/Colors/BasisColors.cs
Normal file
73
X009/src/HZH_Controls/Colors/BasisColors.cs
Normal file
@ -0,0 +1,73 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-30
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="BasisColors.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
|
||||
namespace HZH_Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class BasisColors.
|
||||
/// </summary>
|
||||
public class BasisColors
|
||||
{
|
||||
/// <summary>
|
||||
/// The light
|
||||
/// </summary>
|
||||
private static Color light = ColorTranslator.FromHtml("#f5f7fa");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the light.
|
||||
/// </summary>
|
||||
/// <value>The light.</value>
|
||||
public static Color Light
|
||||
{
|
||||
get { return light; }
|
||||
internal set { light = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The medium
|
||||
/// </summary>
|
||||
private static Color medium = ColorTranslator.FromHtml("#f0f2f5");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the medium.
|
||||
/// </summary>
|
||||
/// <value>The medium.</value>
|
||||
public static Color Medium
|
||||
{
|
||||
get { return medium; }
|
||||
internal set { medium = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The dark
|
||||
/// </summary>
|
||||
private static Color dark = ColorTranslator.FromHtml("#000000");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the dark.
|
||||
/// </summary>
|
||||
/// <value>The dark.</value>
|
||||
public static Color Dark
|
||||
{
|
||||
get { return dark; }
|
||||
internal set { dark = value; }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
86
X009/src/HZH_Controls/Colors/BorderColors.cs
Normal file
86
X009/src/HZH_Controls/Colors/BorderColors.cs
Normal file
@ -0,0 +1,86 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-30
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="BorderColors.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace HZH_Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class BorderColors.
|
||||
/// </summary>
|
||||
public class BorderColors
|
||||
{
|
||||
/// <summary>
|
||||
/// The green
|
||||
/// </summary>
|
||||
private static Color green = ColorTranslator.FromHtml("#f0f9ea");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the green.
|
||||
/// </summary>
|
||||
/// <value>The green.</value>
|
||||
public static Color Green
|
||||
{
|
||||
get { return green; }
|
||||
internal set { green = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The blue
|
||||
/// </summary>
|
||||
private static Color blue = ColorTranslator.FromHtml("#ecf5ff");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the blue.
|
||||
/// </summary>
|
||||
/// <value>The blue.</value>
|
||||
public static Color Blue
|
||||
{
|
||||
get { return blue; }
|
||||
internal set { blue = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The red
|
||||
/// </summary>
|
||||
private static Color red = ColorTranslator.FromHtml("#fef0f0");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the red.
|
||||
/// </summary>
|
||||
/// <value>The red.</value>
|
||||
public static Color Red
|
||||
{
|
||||
get { return red; }
|
||||
internal set { red = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The yellow
|
||||
/// </summary>
|
||||
private static Color yellow = ColorTranslator.FromHtml("#fdf5e6");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the yellow.
|
||||
/// </summary>
|
||||
/// <value>The yellow.</value>
|
||||
public static Color Yellow
|
||||
{
|
||||
get { return yellow; }
|
||||
internal set { yellow = value; }
|
||||
}
|
||||
}
|
||||
}
|
203
X009/src/HZH_Controls/Colors/ColorEnums.cs
Normal file
203
X009/src/HZH_Controls/Colors/ColorEnums.cs
Normal file
@ -0,0 +1,203 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-30
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="ColorEnums.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace HZH_Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Enum BasisColorsTypes
|
||||
/// </summary>
|
||||
public enum BasisColorsTypes
|
||||
{
|
||||
/// <summary>
|
||||
/// The light
|
||||
/// </summary>
|
||||
Light = 1,
|
||||
/// <summary>
|
||||
/// The medium
|
||||
/// </summary>
|
||||
Medium = 2,
|
||||
/// <summary>
|
||||
/// The dark
|
||||
/// </summary>
|
||||
Dark = 3
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enum BorderColorsTypes
|
||||
/// </summary>
|
||||
public enum BorderColorsTypes
|
||||
{
|
||||
/// <summary>
|
||||
/// The green
|
||||
/// </summary>
|
||||
Green = 1,
|
||||
/// <summary>
|
||||
/// The blue
|
||||
/// </summary>
|
||||
Blue = 2,
|
||||
/// <summary>
|
||||
/// The red
|
||||
/// </summary>
|
||||
Red = 3,
|
||||
/// <summary>
|
||||
/// The yellow
|
||||
/// </summary>
|
||||
Yellow = 4
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enum GradientColorsTypes
|
||||
/// </summary>
|
||||
public enum GradientColorsTypes
|
||||
{
|
||||
/// <summary>
|
||||
/// The orange
|
||||
/// </summary>
|
||||
Orange = 1,
|
||||
/// <summary>
|
||||
/// The light green
|
||||
/// </summary>
|
||||
LightGreen = 2,
|
||||
/// <summary>
|
||||
/// The green
|
||||
/// </summary>
|
||||
Green = 3,
|
||||
/// <summary>
|
||||
/// The blue
|
||||
/// </summary>
|
||||
Blue = 4,
|
||||
/// <summary>
|
||||
/// The blue green
|
||||
/// </summary>
|
||||
BlueGreen = 5,
|
||||
/// <summary>
|
||||
/// The light violet
|
||||
/// </summary>
|
||||
LightViolet = 6,
|
||||
/// <summary>
|
||||
/// The violet
|
||||
/// </summary>
|
||||
Violet = 7,
|
||||
/// <summary>
|
||||
/// The gray
|
||||
/// </summary>
|
||||
Gray = 8
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enum LineColorsTypes
|
||||
/// </summary>
|
||||
public enum LineColorsTypes
|
||||
{
|
||||
/// <summary>
|
||||
/// The more light
|
||||
/// </summary>
|
||||
MoreLight = 1,
|
||||
/// <summary>
|
||||
/// The light
|
||||
/// </summary>
|
||||
Light = 2,
|
||||
/// <summary>
|
||||
/// The dark
|
||||
/// </summary>
|
||||
Dark = 3,
|
||||
/// <summary>
|
||||
/// The more dark
|
||||
/// </summary>
|
||||
MoreDark = 4
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enum StatusColorsTypes
|
||||
/// </summary>
|
||||
public enum StatusColorsTypes
|
||||
{
|
||||
/// <summary>
|
||||
/// The primary
|
||||
/// </summary>
|
||||
Primary = 1,
|
||||
/// <summary>
|
||||
/// The success
|
||||
/// </summary>
|
||||
Success = 2,
|
||||
/// <summary>
|
||||
/// The warning
|
||||
/// </summary>
|
||||
Warning = 3,
|
||||
/// <summary>
|
||||
/// The danger
|
||||
/// </summary>
|
||||
Danger = 4,
|
||||
/// <summary>
|
||||
/// The information
|
||||
/// </summary>
|
||||
Info = 5
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enum TableColorsTypes
|
||||
/// </summary>
|
||||
public enum TableColorsTypes
|
||||
{
|
||||
/// <summary>
|
||||
/// The green
|
||||
/// </summary>
|
||||
Green = 1,
|
||||
/// <summary>
|
||||
/// The blue
|
||||
/// </summary>
|
||||
Blue = 2,
|
||||
/// <summary>
|
||||
/// The red
|
||||
/// </summary>
|
||||
Red = 3,
|
||||
/// <summary>
|
||||
/// The yellow
|
||||
/// </summary>
|
||||
Yellow = 4,
|
||||
/// <summary>
|
||||
/// The gray
|
||||
/// </summary>
|
||||
Gray = 5
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enum TextColorsTypes
|
||||
/// </summary>
|
||||
public enum TextColorsTypes
|
||||
{
|
||||
/// <summary>
|
||||
/// The more light
|
||||
/// </summary>
|
||||
MoreLight = 1,
|
||||
/// <summary>
|
||||
/// The light
|
||||
/// </summary>
|
||||
Light = 2,
|
||||
/// <summary>
|
||||
/// The dark
|
||||
/// </summary>
|
||||
Dark = 3,
|
||||
/// <summary>
|
||||
/// The more dark
|
||||
/// </summary>
|
||||
MoreDark = 4
|
||||
}
|
||||
}
|
264
X009/src/HZH_Controls/Colors/ColorExt.cs
Normal file
264
X009/src/HZH_Controls/Colors/ColorExt.cs
Normal file
@ -0,0 +1,264 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-30
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="ColorExt.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace HZH_Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class ColorExt.
|
||||
/// </summary>
|
||||
public static class ColorExt
|
||||
{
|
||||
#region 重置内置的颜色 English:Reset color
|
||||
/// <summary>
|
||||
/// Resets the color.
|
||||
/// </summary>
|
||||
/// <param name="type">The type.</param>
|
||||
/// <param name="light">The light.</param>
|
||||
/// <param name="medium">The medium.</param>
|
||||
/// <param name="dark">The dark.</param>
|
||||
public static void ResetColor(
|
||||
this BasisColors type,
|
||||
Color light,
|
||||
Color medium,
|
||||
Color dark)
|
||||
{
|
||||
BasisColors.Light = light;
|
||||
BasisColors.Medium = medium;
|
||||
BasisColors.Dark = dark;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the color.
|
||||
/// </summary>
|
||||
/// <param name="type">The type.</param>
|
||||
/// <param name="green">The green.</param>
|
||||
/// <param name="blue">The blue.</param>
|
||||
/// <param name="red">The red.</param>
|
||||
/// <param name="yellow">The yellow.</param>
|
||||
public static void ResetColor(
|
||||
this BorderColors type,
|
||||
Color green,
|
||||
Color blue,
|
||||
Color red,
|
||||
Color yellow)
|
||||
{
|
||||
BorderColors.Green = green;
|
||||
BorderColors.Blue = blue;
|
||||
BorderColors.Red = red;
|
||||
BorderColors.Yellow = yellow;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the color.
|
||||
/// </summary>
|
||||
/// <param name="type">The type.</param>
|
||||
/// <param name="orange">The orange.</param>
|
||||
/// <param name="lightGreen">The light green.</param>
|
||||
/// <param name="green">The green.</param>
|
||||
/// <param name="blue">The blue.</param>
|
||||
/// <param name="blueGreen">The blue green.</param>
|
||||
/// <param name="lightViolet">The light violet.</param>
|
||||
/// <param name="violet">The violet.</param>
|
||||
/// <param name="gray">The gray.</param>
|
||||
public static void ResetColor(
|
||||
this GradientColors type,
|
||||
Color[] orange,
|
||||
Color[] lightGreen,
|
||||
Color[] green,
|
||||
Color[] blue,
|
||||
Color[] blueGreen,
|
||||
Color[] lightViolet,
|
||||
Color[] violet,
|
||||
Color[] gray
|
||||
)
|
||||
{
|
||||
if (orange != null && orange.Length == 2)
|
||||
GradientColors.Orange = orange;
|
||||
if (orange != null && orange.Length == 2)
|
||||
GradientColors.LightGreen = lightGreen;
|
||||
if (orange != null && orange.Length == 2)
|
||||
GradientColors.Green = green;
|
||||
if (orange != null && orange.Length == 2)
|
||||
GradientColors.Blue = blue;
|
||||
if (orange != null && orange.Length == 2)
|
||||
GradientColors.BlueGreen = blueGreen;
|
||||
if (orange != null && orange.Length == 2)
|
||||
GradientColors.LightViolet = lightViolet;
|
||||
if (orange != null && orange.Length == 2)
|
||||
GradientColors.Violet = violet;
|
||||
if (orange != null && orange.Length == 2)
|
||||
GradientColors.Gray = gray;
|
||||
}
|
||||
/// <summary>
|
||||
/// Resets the color.
|
||||
/// </summary>
|
||||
/// <param name="type">The type.</param>
|
||||
/// <param name="moreLight">The more light.</param>
|
||||
/// <param name="light">The light.</param>
|
||||
/// <param name="dark">The dark.</param>
|
||||
/// <param name="moreDark">The more dark.</param>
|
||||
public static void ResetColor(
|
||||
this LineColors type,
|
||||
Color moreLight,
|
||||
Color light,
|
||||
Color dark,
|
||||
Color moreDark)
|
||||
{
|
||||
LineColors.MoreLight = moreLight;
|
||||
LineColors.Light = light;
|
||||
LineColors.Dark = dark;
|
||||
LineColors.MoreDark = moreDark;
|
||||
}
|
||||
/// <summary>
|
||||
/// Resets the color.
|
||||
/// </summary>
|
||||
/// <param name="type">The type.</param>
|
||||
/// <param name="primary">The primary.</param>
|
||||
/// <param name="success">The success.</param>
|
||||
/// <param name="warning">The warning.</param>
|
||||
/// <param name="danger">The danger.</param>
|
||||
/// <param name="info">The information.</param>
|
||||
public static void ResetColor(
|
||||
this StatusColors type,
|
||||
Color primary,
|
||||
Color success,
|
||||
Color warning,
|
||||
Color danger,
|
||||
Color info
|
||||
)
|
||||
{
|
||||
StatusColors.Primary = primary;
|
||||
StatusColors.Success = success;
|
||||
StatusColors.Warning = warning;
|
||||
StatusColors.Danger = danger;
|
||||
StatusColors.Info = info;
|
||||
}
|
||||
/// <summary>
|
||||
/// Resets the color.
|
||||
/// </summary>
|
||||
/// <param name="type">The type.</param>
|
||||
/// <param name="green">The green.</param>
|
||||
/// <param name="blue">The blue.</param>
|
||||
/// <param name="red">The red.</param>
|
||||
/// <param name="yellow">The yellow.</param>
|
||||
/// <param name="gray">The gray.</param>
|
||||
public static void ResetColor(
|
||||
this TableColors type,
|
||||
Color green,
|
||||
Color blue,
|
||||
Color red,
|
||||
Color yellow,
|
||||
Color gray
|
||||
)
|
||||
{
|
||||
TableColors.Green = green;
|
||||
TableColors.Blue = blue;
|
||||
TableColors.Red = red;
|
||||
TableColors.Yellow = yellow;
|
||||
TableColors.Gray = gray;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the color.
|
||||
/// </summary>
|
||||
/// <param name="type">The type.</param>
|
||||
/// <param name="moreLight">The more light.</param>
|
||||
/// <param name="light">The light.</param>
|
||||
/// <param name="dark">The dark.</param>
|
||||
/// <param name="moreDark">The more dark.</param>
|
||||
public static void ResetColor(
|
||||
this TextColors type,
|
||||
Color moreLight,
|
||||
Color light,
|
||||
Color dark,
|
||||
Color moreDark)
|
||||
{
|
||||
TextColors.MoreLight = moreLight;
|
||||
TextColors.Light = light;
|
||||
TextColors.Dark = dark;
|
||||
TextColors.MoreDark = moreDark;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取一个内置颜色 English:Get a built-in color
|
||||
/// <summary>
|
||||
/// 功能描述:获取一个内置颜色 English:Get a built-in color
|
||||
/// 作 者:HZH
|
||||
/// 创建日期:2019-09-30 11:08:04
|
||||
/// 任务编号:POS
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="t">t</param>
|
||||
/// <returns>颜色列表</returns>
|
||||
public static Color[] GetInternalColor<T>(T t)
|
||||
{
|
||||
Type type = null;
|
||||
if (t is BasisColorsTypes)
|
||||
{
|
||||
type = typeof(BasisColors);
|
||||
}
|
||||
else if (t is BorderColorsTypes)
|
||||
{
|
||||
type = typeof(BorderColors);
|
||||
}
|
||||
else if (t is GradientColorsTypes)
|
||||
{
|
||||
type = typeof(GradientColors);
|
||||
}
|
||||
else if (t is LineColorsTypes)
|
||||
{
|
||||
type = typeof(LineColors);
|
||||
}
|
||||
else if (t is StatusColorsTypes)
|
||||
{
|
||||
type = typeof(StatusColors);
|
||||
}
|
||||
else if (t is TableColorsTypes)
|
||||
{
|
||||
type = typeof(TableColors);
|
||||
}
|
||||
else if (t is TextColorsTypes)
|
||||
{
|
||||
type = typeof(TextColors);
|
||||
}
|
||||
if (type == null)
|
||||
return new Color[] { Color.Empty };
|
||||
else
|
||||
{
|
||||
string strName = t.ToString();
|
||||
var pi = type.GetProperty(strName);
|
||||
if (pi == null)
|
||||
return new Color[] { Color.Empty };
|
||||
else
|
||||
{
|
||||
var c = pi.GetValue(null, null);
|
||||
if (c == null)
|
||||
return new Color[] { Color.Empty };
|
||||
else if (c is Color[])
|
||||
return (Color[])c;
|
||||
else
|
||||
return new Color[] { (Color)c };
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
142
X009/src/HZH_Controls/Colors/GradientColors.cs
Normal file
142
X009/src/HZH_Controls/Colors/GradientColors.cs
Normal file
@ -0,0 +1,142 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-30
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="GradientColors.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace HZH_Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class GradientColors.
|
||||
/// </summary>
|
||||
public class GradientColors
|
||||
{
|
||||
/// <summary>
|
||||
/// The orange
|
||||
/// </summary>
|
||||
private static Color[] orange = new Color[] { Color.FromArgb(252, 196, 136), Color.FromArgb(243, 138, 159) };
|
||||
|
||||
/// <summary>
|
||||
/// Gets the orange.
|
||||
/// </summary>
|
||||
/// <value>The orange.</value>
|
||||
public static Color[] Orange
|
||||
{
|
||||
get { return GradientColors.orange; }
|
||||
internal set { GradientColors.orange = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The light green
|
||||
/// </summary>
|
||||
private static Color[] lightGreen = new Color[] { Color.FromArgb(210, 251, 123), Color.FromArgb(152, 231, 160) };
|
||||
|
||||
/// <summary>
|
||||
/// Gets the light green.
|
||||
/// </summary>
|
||||
/// <value>The light green.</value>
|
||||
public static Color[] LightGreen
|
||||
{
|
||||
get { return GradientColors.lightGreen; }
|
||||
internal set { GradientColors.lightGreen = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The green
|
||||
/// </summary>
|
||||
private static Color[] green = new Color[] { Color.FromArgb(138, 241, 124), Color.FromArgb(32, 190, 179) };
|
||||
|
||||
/// <summary>
|
||||
/// Gets the green.
|
||||
/// </summary>
|
||||
/// <value>The green.</value>
|
||||
public static Color[] Green
|
||||
{
|
||||
get { return GradientColors.green; }
|
||||
internal set { GradientColors.green = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The blue
|
||||
/// </summary>
|
||||
private static Color[] blue = new Color[] { Color.FromArgb(193, 232, 251), Color.FromArgb(162, 197, 253) };
|
||||
|
||||
/// <summary>
|
||||
/// Gets the blue.
|
||||
/// </summary>
|
||||
/// <value>The blue.</value>
|
||||
public static Color[] Blue
|
||||
{
|
||||
get { return GradientColors.blue; }
|
||||
internal set { GradientColors.blue = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The blue green
|
||||
/// </summary>
|
||||
private static Color[] blueGreen = new Color[] { Color.FromArgb(122, 251, 218), Color.FromArgb(16, 193, 252) };
|
||||
|
||||
/// <summary>
|
||||
/// Gets the blue green.
|
||||
/// </summary>
|
||||
/// <value>The blue green.</value>
|
||||
public static Color[] BlueGreen
|
||||
{
|
||||
get { return GradientColors.blueGreen; }
|
||||
internal set { GradientColors.blueGreen = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The light violet
|
||||
/// </summary>
|
||||
private static Color[] lightViolet = new Color[] { Color.FromArgb(248, 192, 234), Color.FromArgb(164, 142, 210) };
|
||||
|
||||
/// <summary>
|
||||
/// Gets the light violet.
|
||||
/// </summary>
|
||||
/// <value>The light violet.</value>
|
||||
public static Color[] LightViolet
|
||||
{
|
||||
get { return GradientColors.lightViolet; }
|
||||
internal set { GradientColors.lightViolet = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The violet
|
||||
/// </summary>
|
||||
private static Color[] violet = new Color[] { Color.FromArgb(185, 154, 241), Color.FromArgb(137, 124, 242) };
|
||||
|
||||
/// <summary>
|
||||
/// Gets the violet.
|
||||
/// </summary>
|
||||
/// <value>The violet.</value>
|
||||
public static Color[] Violet
|
||||
{
|
||||
get { return GradientColors.violet; }
|
||||
internal set { GradientColors.violet = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The gray
|
||||
/// </summary>
|
||||
private static Color[] gray = new Color[] { Color.FromArgb(233, 238, 239), Color.FromArgb(147, 162, 175) };
|
||||
|
||||
/// <summary>
|
||||
/// Gets the gray.
|
||||
/// </summary>
|
||||
/// <value>The gray.</value>
|
||||
public static Color[] Gray
|
||||
{
|
||||
get { return GradientColors.gray; }
|
||||
internal set { GradientColors.gray = value; }
|
||||
}
|
||||
}
|
||||
}
|
86
X009/src/HZH_Controls/Colors/LineColors.cs
Normal file
86
X009/src/HZH_Controls/Colors/LineColors.cs
Normal file
@ -0,0 +1,86 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-30
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="LineColors.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace HZH_Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class LineColors.
|
||||
/// </summary>
|
||||
public class LineColors
|
||||
{
|
||||
/// <summary>
|
||||
/// The more light
|
||||
/// </summary>
|
||||
private static Color _MoreLight = ColorTranslator.FromHtml("#f2f6fc");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the more light.
|
||||
/// </summary>
|
||||
/// <value>The more light.</value>
|
||||
public static Color MoreLight
|
||||
{
|
||||
get { return _MoreLight; }
|
||||
internal set { _MoreLight = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The light
|
||||
/// </summary>
|
||||
private static Color _Light = ColorTranslator.FromHtml("#ebeef5");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the light.
|
||||
/// </summary>
|
||||
/// <value>The light.</value>
|
||||
public static Color Light
|
||||
{
|
||||
get { return _Light; }
|
||||
internal set { _Light = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The dark
|
||||
/// </summary>
|
||||
private static Color _Dark = ColorTranslator.FromHtml("#e4e7ed");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the dark.
|
||||
/// </summary>
|
||||
/// <value>The dark.</value>
|
||||
public static Color Dark
|
||||
{
|
||||
get { return _Dark; }
|
||||
internal set { _Dark = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The more dark
|
||||
/// </summary>
|
||||
private static Color _MoreDark = ColorTranslator.FromHtml("#dcdfe6");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the more dark.
|
||||
/// </summary>
|
||||
/// <value>The more dark.</value>
|
||||
public static Color MoreDark
|
||||
{
|
||||
get { return _MoreDark; }
|
||||
internal set { _MoreDark = value; }
|
||||
}
|
||||
}
|
||||
}
|
100
X009/src/HZH_Controls/Colors/StatusColors.cs
Normal file
100
X009/src/HZH_Controls/Colors/StatusColors.cs
Normal file
@ -0,0 +1,100 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-30
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="StatusColors.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace HZH_Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// 状态颜色
|
||||
/// </summary>
|
||||
public class StatusColors
|
||||
{
|
||||
/// <summary>
|
||||
/// The primary
|
||||
/// </summary>
|
||||
private static Color _Primary = ColorTranslator.FromHtml("#409eff");
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the primary.
|
||||
/// </summary>
|
||||
/// <value>The primary.</value>
|
||||
public static Color Primary
|
||||
{
|
||||
get { return _Primary; }
|
||||
internal set { _Primary = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The success
|
||||
/// </summary>
|
||||
private static Color _Success = ColorTranslator.FromHtml("#67c23a");
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the success.
|
||||
/// </summary>
|
||||
/// <value>The success.</value>
|
||||
public static Color Success
|
||||
{
|
||||
get { return _Success; }
|
||||
internal set { _Success = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The warning
|
||||
/// </summary>
|
||||
private static Color _Warning = ColorTranslator.FromHtml("#e6a23c");
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the warning.
|
||||
/// </summary>
|
||||
/// <value>The warning.</value>
|
||||
public static Color Warning
|
||||
{
|
||||
get { return _Warning; }
|
||||
internal set { _Warning = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The danger
|
||||
/// </summary>
|
||||
private static Color _Danger = ColorTranslator.FromHtml("#f56c6c");
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the danger.
|
||||
/// </summary>
|
||||
/// <value>The danger.</value>
|
||||
public static Color Danger
|
||||
{
|
||||
get { return _Danger; }
|
||||
internal set { _Danger = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The information
|
||||
/// </summary>
|
||||
private static Color _Info = ColorTranslator.FromHtml("#909399");
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the information.
|
||||
/// </summary>
|
||||
/// <value>The information.</value>
|
||||
public static Color Info
|
||||
{
|
||||
get { return _Info; }
|
||||
internal set { _Info = value; }
|
||||
}
|
||||
}
|
||||
}
|
100
X009/src/HZH_Controls/Colors/TableColors.cs
Normal file
100
X009/src/HZH_Controls/Colors/TableColors.cs
Normal file
@ -0,0 +1,100 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-30
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="TableColors.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace HZH_Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class TableColors.
|
||||
/// </summary>
|
||||
public class TableColors
|
||||
{
|
||||
/// <summary>
|
||||
/// The green
|
||||
/// </summary>
|
||||
private static Color green = ColorTranslator.FromHtml("#c2e7b0");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the green.
|
||||
/// </summary>
|
||||
/// <value>The green.</value>
|
||||
public static Color Green
|
||||
{
|
||||
get { return green; }
|
||||
internal set { green = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The blue
|
||||
/// </summary>
|
||||
private static Color blue = ColorTranslator.FromHtml("#a3d0fd");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the blue.
|
||||
/// </summary>
|
||||
/// <value>The blue.</value>
|
||||
public static Color Blue
|
||||
{
|
||||
get { return blue; }
|
||||
internal set { blue = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The red
|
||||
/// </summary>
|
||||
private static Color red = ColorTranslator.FromHtml("#fbc4c4");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the red.
|
||||
/// </summary>
|
||||
/// <value>The red.</value>
|
||||
public static Color Red
|
||||
{
|
||||
get { return red; }
|
||||
internal set { red = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The yellow
|
||||
/// </summary>
|
||||
private static Color yellow = ColorTranslator.FromHtml("#f5dab1");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the yellow.
|
||||
/// </summary>
|
||||
/// <value>The yellow.</value>
|
||||
public static Color Yellow
|
||||
{
|
||||
get { return yellow; }
|
||||
internal set { yellow = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The gray
|
||||
/// </summary>
|
||||
private static Color gray = ColorTranslator.FromHtml("#d3d4d6");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the gray.
|
||||
/// </summary>
|
||||
/// <value>The gray.</value>
|
||||
public static Color Gray
|
||||
{
|
||||
get { return gray; }
|
||||
internal set { gray = value; }
|
||||
}
|
||||
}
|
||||
}
|
86
X009/src/HZH_Controls/Colors/TextColors.cs
Normal file
86
X009/src/HZH_Controls/Colors/TextColors.cs
Normal file
@ -0,0 +1,86 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-30
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="TextColors.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace HZH_Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class TextColor.
|
||||
/// </summary>
|
||||
public class TextColors
|
||||
{
|
||||
/// <summary>
|
||||
/// The more light
|
||||
/// </summary>
|
||||
private static Color _MoreLight = ColorTranslator.FromHtml("#c0c4cc");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the more light.
|
||||
/// </summary>
|
||||
/// <value>The more light.</value>
|
||||
public static Color MoreLight
|
||||
{
|
||||
get { return _MoreLight; }
|
||||
internal set { _MoreLight = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The light
|
||||
/// </summary>
|
||||
private static Color _Light = ColorTranslator.FromHtml("#909399");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the light.
|
||||
/// </summary>
|
||||
/// <value>The light.</value>
|
||||
public static Color Light
|
||||
{
|
||||
get { return _Light; }
|
||||
internal set { _Light = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The dark
|
||||
/// </summary>
|
||||
private static Color _Dark = ColorTranslator.FromHtml("#606266");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the dark.
|
||||
/// </summary>
|
||||
/// <value>The dark.</value>
|
||||
public static Color Dark
|
||||
{
|
||||
get { return _Dark; }
|
||||
internal set { _Dark = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The more dark
|
||||
/// </summary>
|
||||
private static Color _MoreDark = ColorTranslator.FromHtml("#303133");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the more dark.
|
||||
/// </summary>
|
||||
/// <value>The more dark.</value>
|
||||
public static Color MoreDark
|
||||
{
|
||||
get { return _MoreDark; }
|
||||
internal set { _MoreDark = value; }
|
||||
}
|
||||
}
|
||||
}
|
118
X009/src/HZH_Controls/Controls/Btn/UCBtnExt.Designer.cs
generated
Normal file
118
X009/src/HZH_Controls/Controls/Btn/UCBtnExt.Designer.cs
generated
Normal file
@ -0,0 +1,118 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-08-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCBtnExt.Designer.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCBtnExt.
|
||||
/// Implements the <see cref="HZH_Controls.Controls.UCControlBase" />
|
||||
/// </summary>
|
||||
/// <seealso cref="HZH_Controls.Controls.UCControlBase" />
|
||||
public partial class UCBtnExt
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.lbl = new System.Windows.Forms.Label();
|
||||
this.lblTips = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// lbl
|
||||
//
|
||||
this.lbl.BackColor = System.Drawing.Color.Transparent;
|
||||
this.lbl.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lbl.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.lbl.ForeColor = System.Drawing.Color.White;
|
||||
this.lbl.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.lbl.Location = new System.Drawing.Point(0, 0);
|
||||
this.lbl.Name = "lbl";
|
||||
this.lbl.Size = new System.Drawing.Size(184, 60);
|
||||
this.lbl.TabIndex = 0;
|
||||
this.lbl.Text = "自定义按钮";
|
||||
this.lbl.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.lbl.MouseClick += new System.Windows.Forms.MouseEventHandler(this.lbl_MouseClick);
|
||||
this.lbl.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lbl_MouseDown);
|
||||
this.lbl.MouseUp += new System.Windows.Forms.MouseEventHandler(this.lbl_MouseUp);
|
||||
//
|
||||
// lblTips
|
||||
//
|
||||
this.lblTips.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lblTips.BackColor = System.Drawing.Color.Transparent;
|
||||
this.lblTips.Font = new System.Drawing.Font("Arial Unicode MS", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.lblTips.ForeColor = System.Drawing.Color.White;
|
||||
this.lblTips.ImageIndex = 0;
|
||||
this.lblTips.Location = new System.Drawing.Point(158, 0);
|
||||
this.lblTips.Name = "lblTips";
|
||||
this.lblTips.Size = new System.Drawing.Size(24, 24);
|
||||
this.lblTips.TabIndex = 1;
|
||||
this.lblTips.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.lblTips.Visible = false;
|
||||
//
|
||||
// UCBtnExt
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackColor = System.Drawing.Color.Transparent;
|
||||
this.ConerRadius = 5;
|
||||
this.Controls.Add(this.lblTips);
|
||||
this.Controls.Add(this.lbl);
|
||||
this.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
|
||||
this.IsRadius = true;
|
||||
this.IsShowRect = true;
|
||||
this.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.Name = "UCBtnExt";
|
||||
this.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(58)))));
|
||||
this.Size = new System.Drawing.Size(184, 60);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// The label
|
||||
/// </summary>
|
||||
public System.Windows.Forms.Label lbl;
|
||||
/// <summary>
|
||||
/// The label tips
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Label lblTips;
|
||||
|
||||
|
||||
}
|
||||
}
|
280
X009/src/HZH_Controls/Controls/Btn/UCBtnExt.cs
Normal file
280
X009/src/HZH_Controls/Controls/Btn/UCBtnExt.cs
Normal file
@ -0,0 +1,280 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-08-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCBtnExt.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCBtnExt.
|
||||
/// Implements the <see cref="HZH_Controls.Controls.UCControlBase" />
|
||||
/// </summary>
|
||||
/// <seealso cref="HZH_Controls.Controls.UCControlBase" />
|
||||
[DefaultEvent("BtnClick")]
|
||||
|
||||
public partial class UCBtnExt : UCControlBase
|
||||
{
|
||||
#region 字段属性
|
||||
private bool enabledMouseEffect = false;
|
||||
[Description("是否启用鼠标效果"), Category("自定义")]
|
||||
public bool EnabledMouseEffect
|
||||
{
|
||||
get { return enabledMouseEffect; }
|
||||
set { enabledMouseEffect = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示角标
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is show tips; otherwise, <c>false</c>.</value>
|
||||
[Description("是否显示角标"), Category("自定义")]
|
||||
public bool IsShowTips
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.lblTips.Visible;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.lblTips.Visible = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 角标文字
|
||||
/// </summary>
|
||||
/// <value>The tips text.</value>
|
||||
[Description("角标文字"), Category("自定义")]
|
||||
public string TipsText
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.lblTips.Text;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.lblTips.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The BTN back color
|
||||
/// </summary>
|
||||
private Color _btnBackColor = Color.White;
|
||||
/// <summary>
|
||||
/// 按钮背景色
|
||||
/// </summary>
|
||||
/// <value>The color of the BTN back.</value>
|
||||
[Description("按钮背景色"), Category("自定义")]
|
||||
public Color BtnBackColor
|
||||
{
|
||||
get { return _btnBackColor; }
|
||||
set
|
||||
{
|
||||
_btnBackColor = value;
|
||||
this.BackColor = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The BTN fore color
|
||||
/// </summary>
|
||||
private Color _btnForeColor = Color.White;
|
||||
/// <summary>
|
||||
/// 按钮字体颜色
|
||||
/// </summary>
|
||||
/// <value>The color of the BTN fore.</value>
|
||||
[Description("按钮字体颜色"), Category("自定义")]
|
||||
public virtual Color BtnForeColor
|
||||
{
|
||||
get { return _btnForeColor; }
|
||||
set
|
||||
{
|
||||
_btnForeColor = value;
|
||||
this.lbl.ForeColor = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The BTN font
|
||||
/// </summary>
|
||||
private Font _btnFont = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
/// <summary>
|
||||
/// 按钮字体
|
||||
/// </summary>
|
||||
/// <value>The BTN font.</value>
|
||||
[Description("按钮字体"), Category("自定义")]
|
||||
public Font BtnFont
|
||||
{
|
||||
get { return _btnFont; }
|
||||
set
|
||||
{
|
||||
_btnFont = value;
|
||||
this.lbl.Font = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 按钮点击事件
|
||||
/// </summary>
|
||||
[Description("按钮点击事件"), Category("自定义")]
|
||||
public event EventHandler BtnClick;
|
||||
/// <summary>
|
||||
/// 按钮按下事件
|
||||
/// </summary>
|
||||
[Description("按钮按下事件"), Category("自定义")]
|
||||
public event MouseEventHandler BtnMouseDown;
|
||||
/// <summary>
|
||||
/// 按钮抬起事件
|
||||
/// </summary>
|
||||
[Description("按钮抬起事件"), Category("自定义")]
|
||||
public event MouseEventHandler BtnMouseUp;
|
||||
/// <summary>
|
||||
/// The BTN text
|
||||
/// </summary>
|
||||
private string _btnText;
|
||||
/// <summary>
|
||||
/// 按钮文字
|
||||
/// </summary>
|
||||
/// <value>The BTN text.</value>
|
||||
[Description("按钮文字"), Category("自定义")]
|
||||
public virtual string BtnText
|
||||
{
|
||||
get { return _btnText; }
|
||||
set
|
||||
{
|
||||
_btnText = value;
|
||||
lbl.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The m tips color
|
||||
/// </summary>
|
||||
private Color m_tipsColor = Color.FromArgb(232, 30, 99);
|
||||
/// <summary>
|
||||
/// 角标颜色
|
||||
/// </summary>
|
||||
/// <value>The color of the tips.</value>
|
||||
[Description("角标颜色"), Category("自定义")]
|
||||
public Color TipsColor
|
||||
{
|
||||
get { return m_tipsColor; }
|
||||
set { m_tipsColor = value; }
|
||||
}
|
||||
[Description("鼠标效果生效时发生,需要和MouseEffected同时使用,否则无效"), Category("自定义")]
|
||||
public event EventHandler MouseEffecting;
|
||||
[Description("鼠标效果结束时发生,需要和MouseEffecting同时使用,否则无效"), Category("自定义")]
|
||||
public event EventHandler MouseEffected;
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCBtnExt" /> class.
|
||||
/// </summary>
|
||||
public UCBtnExt()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.TabStop = false;
|
||||
lblTips.Paint += lblTips_Paint;
|
||||
this.lbl.MouseEnter += lbl_MouseEnter;
|
||||
this.lbl.MouseLeave += lbl_MouseLeave;
|
||||
}
|
||||
Color m_cacheColor = Color.Empty;
|
||||
void lbl_MouseLeave(object sender, EventArgs e)
|
||||
{
|
||||
if (enabledMouseEffect)
|
||||
{
|
||||
if (MouseEffecting != null && MouseEffected != null)
|
||||
{
|
||||
MouseEffected(this, e);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_cacheColor != Color.Empty)
|
||||
{
|
||||
this.FillColor = m_cacheColor;
|
||||
m_cacheColor = Color.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void lbl_MouseEnter(object sender, EventArgs e)
|
||||
{
|
||||
if (enabledMouseEffect)
|
||||
{
|
||||
if (MouseEffecting != null && MouseEffected != null)
|
||||
{
|
||||
MouseEffecting(this, e);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (FillColor != Color.Empty && FillColor != null)
|
||||
{
|
||||
m_cacheColor = this.FillColor;
|
||||
this.FillColor = this.FillColor.ChangeColor(-0.2f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the Paint event of the lblTips control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="PaintEventArgs" /> instance containing the event data.</param>
|
||||
void lblTips_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
e.Graphics.SetGDIHigh();
|
||||
e.Graphics.FillEllipse(new SolidBrush(m_tipsColor), new Rectangle(0, 0, lblTips.Width - 1, lblTips.Height - 1));
|
||||
System.Drawing.SizeF sizeEnd = e.Graphics.MeasureString(TipsText, lblTips.Font);
|
||||
|
||||
e.Graphics.DrawString(TipsText, lblTips.Font, new SolidBrush(lblTips.ForeColor), new PointF((lblTips.Width - sizeEnd.Width) / 2, (lblTips.Height - sizeEnd.Height) / 2 + 1));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the MouseDown event of the lbl control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
|
||||
private void lbl_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (BtnMouseDown != null)
|
||||
{
|
||||
BtnMouseDown(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void lbl_MouseUp(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (BtnMouseUp != null)
|
||||
{
|
||||
BtnMouseUp(this, null);
|
||||
}
|
||||
}
|
||||
|
||||
private void lbl_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (this.BtnClick != null)
|
||||
BtnClick(this, e);
|
||||
}
|
||||
}
|
||||
}
|
120
X009/src/HZH_Controls/Controls/Btn/UCBtnExt.resx
Normal file
120
X009/src/HZH_Controls/Controls/Btn/UCBtnExt.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
90
X009/src/HZH_Controls/Controls/Btn/UCBtnFillet.Designer.cs
generated
Normal file
90
X009/src/HZH_Controls/Controls/Btn/UCBtnFillet.Designer.cs
generated
Normal file
@ -0,0 +1,90 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-08-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCBtnFillet.Designer.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCBtnFillet.
|
||||
/// Implements the <see cref="HZH_Controls.Controls.UCControlBase" />
|
||||
/// </summary>
|
||||
/// <seealso cref="HZH_Controls.Controls.UCControlBase" />
|
||||
partial class UCBtnFillet
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.lbl = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// lbl
|
||||
//
|
||||
this.lbl.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lbl.Font = new System.Drawing.Font("微软雅黑", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.lbl.Image = global::HZH_Controls.Properties.Resources.alarm;
|
||||
this.lbl.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.lbl.Location = new System.Drawing.Point(0, 0);
|
||||
this.lbl.Name = "lbl";
|
||||
this.lbl.Padding = new System.Windows.Forms.Padding(5, 0, 0, 0);
|
||||
this.lbl.Size = new System.Drawing.Size(120, 76);
|
||||
this.lbl.TabIndex = 0;
|
||||
this.lbl.Text = "按钮1 ";
|
||||
this.lbl.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
this.lbl.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lbl_MouseDown);
|
||||
//
|
||||
// UCBtnFillet
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackColor = System.Drawing.Color.Transparent;
|
||||
this.ConerRadius = 5;
|
||||
this.Controls.Add(this.lbl);
|
||||
this.IsShowRect = true;
|
||||
this.IsRadius = true;
|
||||
this.Name = "UCBtnFillet";
|
||||
this.Size = new System.Drawing.Size(120, 76);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// The label
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Label lbl;
|
||||
}
|
||||
}
|
88
X009/src/HZH_Controls/Controls/Btn/UCBtnFillet.cs
Normal file
88
X009/src/HZH_Controls/Controls/Btn/UCBtnFillet.cs
Normal file
@ -0,0 +1,88 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-08-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCBtnFillet.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCBtnFillet.
|
||||
/// Implements the <see cref="HZH_Controls.Controls.UCControlBase" />
|
||||
/// </summary>
|
||||
/// <seealso cref="HZH_Controls.Controls.UCControlBase" />
|
||||
[DefaultEvent("BtnClick")]
|
||||
public partial class UCBtnFillet : UCControlBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 按钮点击事件
|
||||
/// </summary>
|
||||
[Description("按钮点击事件"), Category("自定义")]
|
||||
public event EventHandler BtnClick;
|
||||
/// <summary>
|
||||
/// 按钮图片
|
||||
/// </summary>
|
||||
/// <value>The BTN image.</value>
|
||||
[Description("按钮图片"), Category("自定义")]
|
||||
public Image BtnImage
|
||||
{
|
||||
get
|
||||
{
|
||||
return lbl.Image;
|
||||
}
|
||||
set
|
||||
{
|
||||
lbl.Image = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 按钮文字
|
||||
/// </summary>
|
||||
/// <value>The BTN text.</value>
|
||||
[Description("按钮文字"), Category("自定义")]
|
||||
public string BtnText
|
||||
{
|
||||
get { return lbl.Text; }
|
||||
set
|
||||
{
|
||||
lbl.Text = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCBtnFillet" /> class.
|
||||
/// </summary>
|
||||
public UCBtnFillet()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the MouseDown event of the lbl control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
|
||||
private void lbl_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (BtnClick != null)
|
||||
BtnClick(this, e);
|
||||
}
|
||||
}
|
||||
}
|
120
X009/src/HZH_Controls/Controls/Btn/UCBtnFillet.resx
Normal file
120
X009/src/HZH_Controls/Controls/Btn/UCBtnFillet.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
69
X009/src/HZH_Controls/Controls/Btn/UCBtnImg.Designer.cs
generated
Normal file
69
X009/src/HZH_Controls/Controls/Btn/UCBtnImg.Designer.cs
generated
Normal file
@ -0,0 +1,69 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-08-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCBtnImg.Designer.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCBtnImg.
|
||||
/// Implements the <see cref="HZH_Controls.Controls.UCBtnExt" />
|
||||
/// </summary>
|
||||
/// <seealso cref="HZH_Controls.Controls.UCBtnExt" />
|
||||
partial class UCBtnImg
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// lbl
|
||||
//
|
||||
this.lbl.Image = global::HZH_Controls.Properties.Resources.back;
|
||||
//
|
||||
// UCBtnImg
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.IsShowTips = true;
|
||||
this.Name = "UCBtnImg";
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
129
X009/src/HZH_Controls/Controls/Btn/UCBtnImg.cs
Normal file
129
X009/src/HZH_Controls/Controls/Btn/UCBtnImg.cs
Normal file
@ -0,0 +1,129 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-08-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCBtnImg.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCBtnImg.
|
||||
/// Implements the <see cref="HZH_Controls.Controls.UCBtnExt" />
|
||||
/// </summary>
|
||||
/// <seealso cref="HZH_Controls.Controls.UCBtnExt" />
|
||||
public partial class UCBtnImg : UCBtnExt
|
||||
{
|
||||
/// <summary>
|
||||
/// The BTN text
|
||||
/// </summary>
|
||||
private string _btnText = "自定义按钮";
|
||||
/// <summary>
|
||||
/// 按钮文字
|
||||
/// </summary>
|
||||
/// <value>The BTN text.</value>
|
||||
[Description("按钮文字"), Category("自定义")]
|
||||
public override string BtnText
|
||||
{
|
||||
get { return _btnText; }
|
||||
set
|
||||
{
|
||||
_btnText = value;
|
||||
lbl.Text = value;
|
||||
lbl.Refresh();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 图片
|
||||
/// </summary>
|
||||
/// <value>The image.</value>
|
||||
[Description("图片"), Category("自定义")]
|
||||
public virtual Image Image
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.lbl.Image;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.lbl.Image = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The image font icons
|
||||
/// </summary>
|
||||
private object imageFontIcons;
|
||||
/// <summary>
|
||||
/// Gets or sets the image font icons.
|
||||
/// </summary>
|
||||
/// <value>The image font icons.</value>
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
|
||||
[Editor(typeof(ImagePropertyEditor), typeof(System.Drawing.Design.UITypeEditor))]
|
||||
public object ImageFontIcons
|
||||
{
|
||||
get { return imageFontIcons; }
|
||||
set
|
||||
{
|
||||
if (value == null || value is Image)
|
||||
{
|
||||
imageFontIcons = value;
|
||||
if (value != null)
|
||||
{
|
||||
Image = (Image)value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 图片位置
|
||||
/// </summary>
|
||||
/// <value>The image align.</value>
|
||||
[Description("图片位置"), Category("自定义")]
|
||||
public virtual ContentAlignment ImageAlign
|
||||
{
|
||||
get { return this.lbl.ImageAlign; }
|
||||
set { lbl.ImageAlign = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 文字位置
|
||||
/// </summary>
|
||||
/// <value>The text align.</value>
|
||||
[Description("文字位置"), Category("自定义")]
|
||||
public virtual ContentAlignment TextAlign
|
||||
{
|
||||
get { return this.lbl.TextAlign; }
|
||||
set { lbl.TextAlign = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCBtnImg" /> class.
|
||||
/// </summary>
|
||||
public UCBtnImg()
|
||||
{
|
||||
InitializeComponent();
|
||||
IsShowTips = false;
|
||||
base.BtnForeColor = ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(102)))), ((int)(((byte)(102)))), ((int)(((byte)(102)))));
|
||||
base.BtnFont = new System.Drawing.Font("微软雅黑", 17F);
|
||||
base.BtnText = "自定义按钮";
|
||||
}
|
||||
}
|
||||
}
|
120
X009/src/HZH_Controls/Controls/Btn/UCBtnImg.resx
Normal file
120
X009/src/HZH_Controls/Controls/Btn/UCBtnImg.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
79
X009/src/HZH_Controls/Controls/Btn/UCDropDownBtn.Designer.cs
generated
Normal file
79
X009/src/HZH_Controls/Controls/Btn/UCDropDownBtn.Designer.cs
generated
Normal file
@ -0,0 +1,79 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-27-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCDropDownBtn.Designer.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCDropDownBtn.
|
||||
/// Implements the <see cref="HZH_Controls.Controls.UCBtnImg" />
|
||||
/// </summary>
|
||||
/// <seealso cref="HZH_Controls.Controls.UCBtnImg" />
|
||||
partial class UCDropDownBtn
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UCDropDownBtn));
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// lbl
|
||||
//
|
||||
this.lbl.Font = new System.Drawing.Font("微软雅黑", 14F);
|
||||
this.lbl.ForeColor = System.Drawing.Color.White;
|
||||
this.lbl.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
this.lbl.ImageList = null;
|
||||
this.lbl.Text = "自定义按钮";
|
||||
this.lbl.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// UCDropDownBtn
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BtnFont = new System.Drawing.Font("微软雅黑", 14F);
|
||||
this.BtnForeColor = System.Drawing.Color.White;
|
||||
this.ForeColor = System.Drawing.Color.White;
|
||||
this.Image = ((System.Drawing.Image)(resources.GetObject("$this.Image")));
|
||||
this.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
this.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.Name = "UCDropDownBtn";
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
211
X009/src/HZH_Controls/Controls/Btn/UCDropDownBtn.cs
Normal file
211
X009/src/HZH_Controls/Controls/Btn/UCDropDownBtn.cs
Normal file
@ -0,0 +1,211 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-27-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCDropDownBtn.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCDropDownBtn.
|
||||
/// Implements the <see cref="HZH_Controls.Controls.UCBtnImg" />
|
||||
/// </summary>
|
||||
/// <seealso cref="HZH_Controls.Controls.UCBtnImg" />
|
||||
[DefaultEvent("BtnClick")]
|
||||
public partial class UCDropDownBtn : UCBtnImg
|
||||
{
|
||||
/// <summary>
|
||||
/// The FRM anchor
|
||||
/// </summary>
|
||||
Forms.FrmAnchor _frmAnchor;
|
||||
/// <summary>
|
||||
/// The drop panel height
|
||||
/// </summary>
|
||||
private int _dropPanelHeight = -1;
|
||||
/// <summary>
|
||||
/// 按钮点击事件
|
||||
/// </summary>
|
||||
public new event EventHandler BtnClick;
|
||||
/// <summary>
|
||||
/// 下拉框高度
|
||||
/// </summary>
|
||||
/// <value>The height of the drop panel.</value>
|
||||
[Description("下拉框高度"), Category("自定义")]
|
||||
public int DropPanelHeight
|
||||
{
|
||||
get { return _dropPanelHeight; }
|
||||
set { _dropPanelHeight = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The BTNS
|
||||
/// </summary>
|
||||
private string[] btns;
|
||||
/// <summary>
|
||||
/// 需要显示的按钮文字
|
||||
/// </summary>
|
||||
/// <value>The BTNS.</value>
|
||||
[Description("需要显示的按钮文字"), Category("自定义")]
|
||||
public string[] Btns
|
||||
{
|
||||
get { return btns; }
|
||||
set { btns = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 图片
|
||||
/// </summary>
|
||||
/// <value>The image.</value>
|
||||
[Obsolete("不再可用的属性")]
|
||||
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public override Image Image
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
/// <summary>
|
||||
/// 图片位置
|
||||
/// </summary>
|
||||
/// <value>The image align.</value>
|
||||
[Obsolete("不再可用的属性")]
|
||||
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public override ContentAlignment ImageAlign
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
/// <summary>
|
||||
/// 按钮字体颜色
|
||||
/// </summary>
|
||||
/// <value>The color of the BTN fore.</value>
|
||||
[Description("按钮字体颜色"), Category("自定义")]
|
||||
public override Color BtnForeColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.BtnForeColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.BtnForeColor = value;
|
||||
Bitmap bit = new Bitmap(12, 10);
|
||||
Graphics g = Graphics.FromImage(bit);
|
||||
g.SetGDIHigh();
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
path.AddLines(new Point[]
|
||||
{
|
||||
new Point(1,1),
|
||||
new Point(11,1),
|
||||
new Point(6,10),
|
||||
new Point(1,1)
|
||||
});
|
||||
g.FillPath(new SolidBrush(value), path);
|
||||
g.Dispose();
|
||||
this.lbl.Image = bit;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCDropDownBtn" /> class.
|
||||
/// </summary>
|
||||
public UCDropDownBtn()
|
||||
{
|
||||
InitializeComponent();
|
||||
IsShowTips = false;
|
||||
this.lbl.ImageAlign = ContentAlignment.MiddleRight;
|
||||
base.BtnClick += UCDropDownBtn_BtnClick;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the BtnClick event of the UCDropDownBtn control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
void UCDropDownBtn_BtnClick(object sender, EventArgs e)
|
||||
{
|
||||
if (_frmAnchor == null || _frmAnchor.IsDisposed || _frmAnchor.Visible == false)
|
||||
{
|
||||
|
||||
if (Btns != null && Btns.Length > 0)
|
||||
{
|
||||
int intRow = 0;
|
||||
int intCom = 1;
|
||||
var p = this.PointToScreen(this.Location);
|
||||
while (true)
|
||||
{
|
||||
int intScreenHeight = Screen.PrimaryScreen.Bounds.Height;
|
||||
if ((p.Y + this.Height + Btns.Length / intCom * 50 < intScreenHeight || p.Y - Btns.Length / intCom * 50 > 0)
|
||||
&& (_dropPanelHeight <= 0 ? true : (Btns.Length / intCom * 50 <= _dropPanelHeight)))
|
||||
{
|
||||
intRow = Btns.Length / intCom + (Btns.Length % intCom != 0 ? 1 : 0);
|
||||
break;
|
||||
}
|
||||
intCom++;
|
||||
}
|
||||
UCTimePanel ucTime = new UCTimePanel();
|
||||
ucTime.IsShowBorder = true;
|
||||
int intWidth = this.Width / intCom;
|
||||
|
||||
Size size = new Size(intCom * intWidth, intRow * 50);
|
||||
ucTime.Size = size;
|
||||
ucTime.FirstEvent = true;
|
||||
ucTime.SelectSourceEvent += ucTime_SelectSourceEvent;
|
||||
ucTime.Row = intRow;
|
||||
ucTime.Column = intCom;
|
||||
|
||||
List<KeyValuePair<string, string>> lst = new List<KeyValuePair<string, string>>();
|
||||
foreach (var item in Btns)
|
||||
{
|
||||
lst.Add(new KeyValuePair<string, string>(item, item));
|
||||
}
|
||||
ucTime.Source = lst;
|
||||
|
||||
_frmAnchor = new Forms.FrmAnchor(this, ucTime);
|
||||
_frmAnchor.Load += (a, b) => { (a as Form).Size = size; };
|
||||
|
||||
_frmAnchor.Show(this.FindForm());
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_frmAnchor.Close();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Handles the SelectSourceEvent event of the ucTime control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
void ucTime_SelectSourceEvent(object sender, EventArgs e)
|
||||
{
|
||||
if (_frmAnchor != null && !_frmAnchor.IsDisposed && _frmAnchor.Visible)
|
||||
{
|
||||
_frmAnchor.Close();
|
||||
|
||||
if (BtnClick != null)
|
||||
{
|
||||
BtnClick(sender.ToString(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
131
X009/src/HZH_Controls/Controls/Btn/UCDropDownBtn.resx
Normal file
131
X009/src/HZH_Controls/Controls/Btn/UCDropDownBtn.resx
Normal file
@ -0,0 +1,131 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="$this.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAAA4AAAAYCAYAAADKx8xXAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAD0SURBVDhPjZLtDcIwDES9Ezt1py7AMCgrdIGKH3SC0OfE
|
||||
JZ/FJxmR+E55livP1ycua4iPJboKLxnZti0HPeFwemPc9z3KcRx68AbX04uEHw4eXB4A8wqmOcfmsvCE
|
||||
oLkoCOb/uAlT5zMxp+IOA6noQYY3x6TAnb/YYSIOXN7NaZhdkEuaoxBlmFUQcaG4g5DN14UQlzNcne+t
|
||||
uT6Ifmupq1tDK2YAqd5n+qirNbQCBdzyNea7xUQ0MZW4/O/W0Ipmu5bpGlrVc4b+a5kJk+G6ME2YbC2U
|
||||
CxNhMlzKlNtzZZ/i2hpQbt8LI6+6MU3qLpSvC4l8ASkgxV0fp9H6AAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
81
X009/src/HZH_Controls/Controls/BtnsGroup/UCBtnsGroup.Designer.cs
generated
Normal file
81
X009/src/HZH_Controls/Controls/BtnsGroup/UCBtnsGroup.Designer.cs
generated
Normal file
@ -0,0 +1,81 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-15-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCBtnsGroup.Designer.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCBtnsGroup.
|
||||
/// Implements the <see cref="System.Windows.Forms.UserControl" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Windows.Forms.UserControl" />
|
||||
partial class UCBtnsGroup
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// flowLayoutPanel1
|
||||
//
|
||||
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
|
||||
this.flowLayoutPanel1.Size = new System.Drawing.Size(420, 50);
|
||||
this.flowLayoutPanel1.TabIndex = 0;
|
||||
//
|
||||
// UCBtnsGroup
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.Controls.Add(this.flowLayoutPanel1);
|
||||
this.MinimumSize = new System.Drawing.Size(0, 50);
|
||||
this.Name = "UCBtnsGroup";
|
||||
this.Size = new System.Drawing.Size(420, 50);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// The flow layout panel1
|
||||
/// </summary>
|
||||
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
|
||||
}
|
||||
}
|
229
X009/src/HZH_Controls/Controls/BtnsGroup/UCBtnsGroup.cs
Normal file
229
X009/src/HZH_Controls/Controls/BtnsGroup/UCBtnsGroup.cs
Normal file
@ -0,0 +1,229 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-15-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCBtnsGroup.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCBtnsGroup.
|
||||
/// Implements the <see cref="System.Windows.Forms.UserControl" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Windows.Forms.UserControl" />
|
||||
public partial class UCBtnsGroup : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// 选中改变事件
|
||||
/// </summary>
|
||||
[Description("选中改变事件"), Category("自定义")]
|
||||
public event EventHandler SelectedItemChanged;
|
||||
/// <summary>
|
||||
/// The m data source
|
||||
/// </summary>
|
||||
private Dictionary<string, string> m_dataSource = new Dictionary<string, string>();
|
||||
/// <summary>
|
||||
/// 数据源
|
||||
/// </summary>
|
||||
/// <value>The data source.</value>
|
||||
[Description("数据源"), Category("自定义")]
|
||||
public Dictionary<string, string> DataSource
|
||||
{
|
||||
get { return m_dataSource; }
|
||||
set
|
||||
{
|
||||
m_dataSource = value;
|
||||
Reload();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The m select item
|
||||
/// </summary>
|
||||
private List<string> m_selectItem = new List<string>();
|
||||
/// <summary>
|
||||
/// 选中项
|
||||
/// </summary>
|
||||
/// <value>The select item.</value>
|
||||
[Description("选中项"), Category("自定义")]
|
||||
public List<string> SelectItem
|
||||
{
|
||||
get { return m_selectItem; }
|
||||
set
|
||||
{
|
||||
m_selectItem = value;
|
||||
if (m_selectItem == null)
|
||||
m_selectItem = new List<string>();
|
||||
SetSelected();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The m is multiple
|
||||
/// </summary>
|
||||
private bool m_isMultiple = false;
|
||||
/// <summary>
|
||||
/// 是否多选
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is multiple; otherwise, <c>false</c>.</value>
|
||||
[Description("是否多选"), Category("自定义")]
|
||||
public bool IsMultiple
|
||||
{
|
||||
get { return m_isMultiple; }
|
||||
set { m_isMultiple = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCBtnsGroup" /> class.
|
||||
/// </summary>
|
||||
public UCBtnsGroup()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reloads this instance.
|
||||
/// </summary>
|
||||
private void Reload()
|
||||
{
|
||||
try
|
||||
{
|
||||
ControlHelper.FreezeControl(flowLayoutPanel1, true);
|
||||
this.flowLayoutPanel1.Controls.Clear();
|
||||
if (DataSource != null)
|
||||
{
|
||||
foreach (var item in DataSource)
|
||||
{
|
||||
UCBtnExt btn = new UCBtnExt();
|
||||
btn.BackColor = System.Drawing.Color.Transparent;
|
||||
btn.BtnBackColor = System.Drawing.Color.White;
|
||||
btn.BtnFont = new System.Drawing.Font("微软雅黑", 10F);
|
||||
btn.BtnForeColor = System.Drawing.Color.Gray;
|
||||
btn.BtnText = item.Value;
|
||||
btn.ConerRadius = 5;
|
||||
btn.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
btn.FillColor = System.Drawing.Color.White;
|
||||
btn.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
btn.IsRadius = true;
|
||||
btn.IsShowRect = true;
|
||||
btn.IsShowTips = false;
|
||||
btn.Location = new System.Drawing.Point(5, 5);
|
||||
btn.Margin = new System.Windows.Forms.Padding(5);
|
||||
btn.Name = item.Key;
|
||||
btn.RectColor = System.Drawing.Color.FromArgb(224, 224, 224);
|
||||
btn.RectWidth = 1;
|
||||
btn.Size = new System.Drawing.Size(72, 38);
|
||||
btn.TabStop = false;
|
||||
btn.BtnClick += btn_BtnClick;
|
||||
this.flowLayoutPanel1.Controls.Add(btn);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
ControlHelper.FreezeControl(flowLayoutPanel1, false);
|
||||
}
|
||||
SetSelected();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the BtnClick event of the btn control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
void btn_BtnClick(object sender, EventArgs e)
|
||||
{
|
||||
var btn = sender as UCBtnExt;
|
||||
if (m_selectItem.Contains(btn.Name))
|
||||
{
|
||||
btn.RectColor = System.Drawing.Color.FromArgb(224, 224, 224);
|
||||
m_selectItem.Remove(btn.Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!m_isMultiple)
|
||||
{
|
||||
foreach (var item in m_selectItem)
|
||||
{
|
||||
var lst = this.flowLayoutPanel1.Controls.Find(item, false);
|
||||
if (lst.Length == 1)
|
||||
{
|
||||
var _btn = lst[0] as UCBtnExt;
|
||||
_btn.RectColor = System.Drawing.Color.FromArgb(224, 224, 224);
|
||||
}
|
||||
}
|
||||
m_selectItem.Clear();
|
||||
}
|
||||
btn.RectColor = System.Drawing.Color.FromArgb(255, 77, 59);
|
||||
m_selectItem.Add(btn.Name);
|
||||
}
|
||||
if (SelectedItemChanged != null)
|
||||
SelectedItemChanged(this, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the selected.
|
||||
/// </summary>
|
||||
private void SetSelected()
|
||||
{
|
||||
if (m_selectItem != null && m_selectItem.Count > 0 && DataSource != null && DataSource.Count > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
ControlHelper.FreezeControl(flowLayoutPanel1, true);
|
||||
if (m_isMultiple)
|
||||
{
|
||||
foreach (var item in m_selectItem)
|
||||
{
|
||||
var lst = this.flowLayoutPanel1.Controls.Find(item, false);
|
||||
if (lst.Length == 1)
|
||||
{
|
||||
var btn = lst[0] as UCBtnExt;
|
||||
btn.RectColor = System.Drawing.Color.FromArgb(255, 77, 59);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UCBtnExt btn = null;
|
||||
foreach (var item in m_selectItem)
|
||||
{
|
||||
var lst = this.flowLayoutPanel1.Controls.Find(item, false);
|
||||
if (lst.Length == 1)
|
||||
{
|
||||
btn = lst[0] as UCBtnExt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (btn != null)
|
||||
{
|
||||
m_selectItem = new List<string>() { btn.Name };
|
||||
btn.RectColor = System.Drawing.Color.FromArgb(255, 77, 59);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
ControlHelper.FreezeControl(flowLayoutPanel1, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
120
X009/src/HZH_Controls/Controls/BtnsGroup/UCBtnsGroup.resx
Normal file
120
X009/src/HZH_Controls/Controls/BtnsGroup/UCBtnsGroup.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
38
X009/src/HZH_Controls/Controls/Charts/AuxiliaryLable.cs
Normal file
38
X009/src/HZH_Controls/Controls/Charts/AuxiliaryLable.cs
Normal file
@ -0,0 +1,38 @@
|
||||
using System.Drawing;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
public class AuxiliaryLable
|
||||
{
|
||||
public string Text
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public Brush TextBrush
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public Brush TextBack
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public float LocationX
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public AuxiliaryLable()
|
||||
{
|
||||
TextBrush = Brushes.Black;
|
||||
TextBack = Brushes.Transparent;
|
||||
LocationX = 0.5f;
|
||||
}
|
||||
}
|
||||
}
|
122
X009/src/HZH_Controls/Controls/Charts/AuxiliaryLine.cs
Normal file
122
X009/src/HZH_Controls/Controls/Charts/AuxiliaryLine.cs
Normal file
@ -0,0 +1,122 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-17
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="AuxiliaryLine.cs">
|
||||
// Copyright by Huang Zhenghui(»ÆÕý»Ô) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub£ºhttps://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee£ºhttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class AuxiliaryLine.
|
||||
/// Implements the <see cref="System.IDisposable" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.IDisposable" />
|
||||
internal class AuxiliaryLine : IDisposable
|
||||
{
|
||||
private bool disposedValue = false;
|
||||
|
||||
public float Value
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public float PaintValue
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public float PaintValueBackUp
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public Color LineColor
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public Pen PenDash
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public Pen PenSolid
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public float LineThickness
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public Brush LineTextBrush
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public bool IsLeftFrame
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
private bool isDashStyle = true;
|
||||
|
||||
public bool IsDashStyle
|
||||
{
|
||||
get { return isDashStyle; }
|
||||
set { isDashStyle = value; }
|
||||
}
|
||||
|
||||
|
||||
public Pen GetPen()
|
||||
{
|
||||
return IsDashStyle ? PenDash : PenSolid;
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!disposedValue)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
if(PenDash==null)
|
||||
PenDash.Dispose();
|
||||
if(PenSolid==null)
|
||||
PenSolid.Dispose();
|
||||
if(LineTextBrush==null)
|
||||
LineTextBrush.Dispose();
|
||||
}
|
||||
disposedValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
public string Tip { get; set; }
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-26
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="FunelChartAlignment.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Enum FunelChartAlignment
|
||||
/// </summary>
|
||||
public enum FunelChartAlignment
|
||||
{
|
||||
/// <summary>
|
||||
/// The left
|
||||
/// </summary>
|
||||
Left,
|
||||
/// <summary>
|
||||
/// The center
|
||||
/// </summary>
|
||||
Center,
|
||||
/// <summary>
|
||||
/// The right
|
||||
/// </summary>
|
||||
Right
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-26
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="FunelChartDirection.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Enum FunelChartDirection
|
||||
/// </summary>
|
||||
public enum FunelChartDirection
|
||||
{
|
||||
/// <summary>
|
||||
/// Up
|
||||
/// </summary>
|
||||
UP,
|
||||
/// <summary>
|
||||
/// Down
|
||||
/// </summary>
|
||||
Down
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-26
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="FunelChartItem.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class FunelChartItem.
|
||||
/// </summary>
|
||||
public class FunelChartItem
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the text.
|
||||
/// </summary>
|
||||
/// <value>The text.</value>
|
||||
public string Text { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the value.
|
||||
/// </summary>
|
||||
/// <value>The value.</value>
|
||||
public float Value { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the value.
|
||||
/// </summary>
|
||||
/// <value>The color of the value.</value>
|
||||
public System.Drawing.Color? ValueColor { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the text fore.
|
||||
/// </summary>
|
||||
/// <value>The color of the text fore.</value>
|
||||
public System.Drawing.Color? TextForeColor { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,506 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-26
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCFunnelChart.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCFunnelChart.
|
||||
/// Implements the <see cref="System.Windows.Forms.UserControl" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Windows.Forms.UserControl" />
|
||||
public class UCFunnelChart : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// The title
|
||||
/// </summary>
|
||||
private string title;
|
||||
/// <summary>
|
||||
/// Gets or sets the title.
|
||||
/// </summary>
|
||||
/// <value>The title.</value>
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置标题")]
|
||||
public string Title
|
||||
{
|
||||
get { return title; }
|
||||
set
|
||||
{
|
||||
title = value;
|
||||
ResetTitleSize();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The title font
|
||||
/// </summary>
|
||||
private Font titleFont = new Font("微软雅黑", 12);
|
||||
/// <summary>
|
||||
/// Gets or sets the title font.
|
||||
/// </summary>
|
||||
/// <value>The title font.</value>
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置标题字体")]
|
||||
public Font TitleFont
|
||||
{
|
||||
get { return titleFont; }
|
||||
set
|
||||
{
|
||||
titleFont = value;
|
||||
ResetTitleSize();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The title fore color
|
||||
/// </summary>
|
||||
private Color titleForeColor = Color.Black;
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the title fore.
|
||||
/// </summary>
|
||||
/// <value>The color of the title fore.</value>
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置标题文字颜色")]
|
||||
public Color TitleForeColor
|
||||
{
|
||||
get { return titleForeColor; }
|
||||
set
|
||||
{
|
||||
titleForeColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The items
|
||||
/// </summary>
|
||||
private FunelChartItem[] items;
|
||||
/// <summary>
|
||||
/// Gets or sets the items.
|
||||
/// </summary>
|
||||
/// <value>The items.</value>
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置项目")]
|
||||
public FunelChartItem[] Items
|
||||
{
|
||||
get { return items; }
|
||||
set
|
||||
{
|
||||
items = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The direction
|
||||
/// </summary>
|
||||
private FunelChartDirection direction = FunelChartDirection.UP;
|
||||
/// <summary>
|
||||
/// Gets or sets the direction.
|
||||
/// </summary>
|
||||
/// <value>The direction.</value>
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置方向")]
|
||||
public FunelChartDirection Direction
|
||||
{
|
||||
get { return direction; }
|
||||
set
|
||||
{
|
||||
direction = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The alignment
|
||||
/// </summary>
|
||||
private FunelChartAlignment alignment = FunelChartAlignment.Center;
|
||||
/// <summary>
|
||||
/// Gets or sets the alignment.
|
||||
/// </summary>
|
||||
/// <value>The alignment.</value>
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置对齐方式")]
|
||||
public FunelChartAlignment Alignment
|
||||
{
|
||||
get { return alignment; }
|
||||
set
|
||||
{
|
||||
alignment = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The item text align
|
||||
/// </summary>
|
||||
private FunelChartAlignment itemTextAlign = FunelChartAlignment.Center;
|
||||
/// <summary>
|
||||
/// Gets or sets the item text align.
|
||||
/// </summary>
|
||||
/// <value>The item text align.</value>
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置文字位置")]
|
||||
public FunelChartAlignment ItemTextAlign
|
||||
{
|
||||
get { return itemTextAlign; }
|
||||
set
|
||||
{
|
||||
itemTextAlign = value;
|
||||
ResetWorkingRect();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The show value
|
||||
/// </summary>
|
||||
private bool showValue = false;
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether [show value].
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if [show value]; otherwise, <c>false</c>.</value>
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置是否显示值")]
|
||||
public bool ShowValue
|
||||
{
|
||||
get { return showValue; }
|
||||
set
|
||||
{
|
||||
showValue = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The value format
|
||||
/// </summary>
|
||||
private string valueFormat = "0.##";
|
||||
/// <summary>
|
||||
/// Gets or sets the value format.
|
||||
/// </summary>
|
||||
/// <value>The value format.</value>
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置值格式化")]
|
||||
public string ValueFormat
|
||||
{
|
||||
get { return valueFormat; }
|
||||
set
|
||||
{
|
||||
valueFormat = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The m rect working
|
||||
/// </summary>
|
||||
RectangleF m_rectWorking;
|
||||
/// <summary>
|
||||
/// The m title size
|
||||
/// </summary>
|
||||
SizeF m_titleSize = SizeF.Empty;
|
||||
/// <summary>
|
||||
/// The int split width
|
||||
/// </summary>
|
||||
int intSplitWidth = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCFunnelChart"/> class.
|
||||
/// </summary>
|
||||
public UCFunnelChart()
|
||||
{
|
||||
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
||||
this.SetStyle(ControlStyles.DoubleBuffer, true);
|
||||
this.SetStyle(ControlStyles.ResizeRedraw, true);
|
||||
this.SetStyle(ControlStyles.Selectable, true);
|
||||
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||||
this.SetStyle(ControlStyles.UserPaint, true);
|
||||
this.FontChanged += UCFunnelChart_FontChanged;
|
||||
Font = new Font("微软雅黑", 8);
|
||||
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.SizeChanged += UCFunnelChart_SizeChanged;
|
||||
Size = new System.Drawing.Size(150, 150);
|
||||
items = new FunelChartItem[0];
|
||||
if (ControlHelper.IsDesignMode())
|
||||
{
|
||||
items = new FunelChartItem[5];
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
items[i] = new FunelChartItem()
|
||||
{
|
||||
Text = "item" + i,
|
||||
Value = 10 * (i + 1)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the FontChanged event of the UCFunnelChart control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||||
void UCFunnelChart_FontChanged(object sender, EventArgs e)
|
||||
{
|
||||
ResetWorkingRect();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the SizeChanged event of the UCFunnelChart control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||||
void UCFunnelChart_SizeChanged(object sender, EventArgs e)
|
||||
{
|
||||
ResetWorkingRect();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the working rect.
|
||||
/// </summary>
|
||||
private void ResetWorkingRect()
|
||||
{
|
||||
if (itemTextAlign == FunelChartAlignment.Center)
|
||||
{
|
||||
m_rectWorking = new RectangleF(0, m_titleSize.Height == 0 ? 0 : (m_titleSize.Height + 10), this.Width, this.Height - (m_titleSize.Height == 0 ? 0 : (m_titleSize.Height + 10)));
|
||||
}
|
||||
else if (itemTextAlign == FunelChartAlignment.Left)
|
||||
{
|
||||
float fltMax = 0;
|
||||
if (items != null && items.Length > 0)
|
||||
{
|
||||
using (Graphics g = this.CreateGraphics())
|
||||
{
|
||||
fltMax = items.Max(p => g.MeasureString(p.Text, Font).Width);
|
||||
}
|
||||
}
|
||||
m_rectWorking = new RectangleF(fltMax, m_titleSize.Height == 0 ? 0 : (m_titleSize.Height + 10), this.Width - fltMax, this.Height - (m_titleSize.Height == 0 ? 0 : (m_titleSize.Height + 10)));
|
||||
}
|
||||
else
|
||||
{
|
||||
float fltMax = 0;
|
||||
if (items != null && items.Length > 0)
|
||||
{
|
||||
using (Graphics g = this.CreateGraphics())
|
||||
{
|
||||
fltMax = items.Max(p => g.MeasureString(p.Text, Font).Width);
|
||||
}
|
||||
}
|
||||
m_rectWorking = new RectangleF(0, m_titleSize.Height == 0 ? 0 : (m_titleSize.Height + 10), this.Width - fltMax, this.Height - (m_titleSize.Height == 0 ? 0 : (m_titleSize.Height + 10)));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the size of the title.
|
||||
/// </summary>
|
||||
private void ResetTitleSize()
|
||||
{
|
||||
if (string.IsNullOrEmpty(title))
|
||||
{
|
||||
m_titleSize = SizeF.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
using (Graphics g = this.CreateGraphics())
|
||||
{
|
||||
m_titleSize = g.MeasureString(title, titleFont);
|
||||
m_titleSize.Height += 20;
|
||||
}
|
||||
}
|
||||
ResetWorkingRect();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 引发 <see cref="E:System.Windows.Forms.Control.Paint" /> 事件。
|
||||
/// </summary>
|
||||
/// <param name="e">包含事件数据的 <see cref="T:System.Windows.Forms.PaintEventArgs" />。</param>
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
var g = e.Graphics;
|
||||
g.SetGDIHigh();
|
||||
|
||||
if (!string.IsNullOrEmpty(title))
|
||||
{
|
||||
g.DrawString(title, titleFont, new SolidBrush(titleForeColor), new RectangleF(0, 0, this.Width, m_titleSize.Height), new StringFormat() { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center });
|
||||
}
|
||||
|
||||
if (items == null || items.Length <= 0)
|
||||
{
|
||||
g.DrawString("没有数据", Font, new SolidBrush(Color.Black), this.m_rectWorking, new StringFormat() { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center });
|
||||
return;
|
||||
}
|
||||
|
||||
List<FunelChartItem> lstItems;
|
||||
if (direction == FunelChartDirection.UP)
|
||||
{
|
||||
lstItems = items.OrderBy(p => p.Value).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
lstItems = items.OrderByDescending(p => p.Value).ToList();
|
||||
}
|
||||
|
||||
List<RectangleF> lstRects = new List<RectangleF>();
|
||||
List<GraphicsPath> lstPaths = new List<GraphicsPath>();
|
||||
float maxValue = lstItems.Max(p => p.Value);
|
||||
float dblSplitHeight = m_rectWorking.Height / lstItems.Count;
|
||||
for (int i = 0; i < lstItems.Count; i++)
|
||||
{
|
||||
FunelChartItem item = lstItems[i];
|
||||
if (item.ValueColor == null || item.ValueColor == Color.Empty || item.ValueColor == Color.Transparent)
|
||||
item.ValueColor = ControlHelper.Colors[i];
|
||||
|
||||
switch (alignment)
|
||||
{
|
||||
case FunelChartAlignment.Left:
|
||||
lstRects.Add(new RectangleF(m_rectWorking.Left, m_rectWorking.Top + dblSplitHeight * i, item.Value / maxValue * m_rectWorking.Width, dblSplitHeight));
|
||||
break;
|
||||
case FunelChartAlignment.Center:
|
||||
lstRects.Add(new RectangleF(m_rectWorking.Left + (m_rectWorking.Width - (item.Value / maxValue * m_rectWorking.Width)) / 2, m_rectWorking.Top + dblSplitHeight * i, item.Value / maxValue * m_rectWorking.Width, dblSplitHeight));
|
||||
break;
|
||||
case FunelChartAlignment.Right:
|
||||
lstRects.Add(new RectangleF(m_rectWorking.Right - (item.Value / maxValue * m_rectWorking.Width), m_rectWorking.Top + dblSplitHeight * i, item.Value / maxValue * m_rectWorking.Width, dblSplitHeight));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < lstRects.Count; i++)
|
||||
{
|
||||
var rect = lstRects[i];
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
List<PointF> lstPoints = new List<PointF>();
|
||||
if (direction == FunelChartDirection.UP)
|
||||
{
|
||||
switch (alignment)
|
||||
{
|
||||
case FunelChartAlignment.Left:
|
||||
lstPoints.Add(new PointF(rect.Left, rect.Top));
|
||||
if (i != 0)
|
||||
{
|
||||
lstPoints.Add(new PointF(lstRects[i - 1].Right, rect.Top));
|
||||
}
|
||||
break;
|
||||
case FunelChartAlignment.Center:
|
||||
if (i == 0)
|
||||
{
|
||||
lstPoints.Add(new PointF(rect.Left + rect.Width / 2, rect.Top));
|
||||
}
|
||||
else
|
||||
{
|
||||
lstPoints.Add(new PointF(lstRects[i - 1].Left, rect.Top));
|
||||
lstPoints.Add(new PointF(lstRects[i - 1].Right, rect.Top));
|
||||
}
|
||||
break;
|
||||
case FunelChartAlignment.Right:
|
||||
if (i == 0)
|
||||
{
|
||||
lstPoints.Add(new PointF(rect.Right, rect.Top));
|
||||
}
|
||||
else
|
||||
{
|
||||
lstPoints.Add(new PointF(rect.Right - lstRects[i - 1].Width, rect.Top));
|
||||
lstPoints.Add(new PointF(rect.Right, rect.Top));
|
||||
}
|
||||
break;
|
||||
}
|
||||
lstPoints.Add(new PointF(rect.Right, rect.Bottom - intSplitWidth));
|
||||
lstPoints.Add(new PointF(rect.Left, rect.Bottom - intSplitWidth));
|
||||
}
|
||||
else
|
||||
{
|
||||
lstPoints.Add(new PointF(rect.Left, rect.Top + intSplitWidth));
|
||||
lstPoints.Add(new PointF(rect.Right, rect.Top + intSplitWidth));
|
||||
switch (alignment)
|
||||
{
|
||||
case FunelChartAlignment.Left:
|
||||
if (i == lstRects.Count - 1)
|
||||
{
|
||||
lstPoints.Add(new PointF(rect.Left, rect.Bottom));
|
||||
}
|
||||
else
|
||||
{
|
||||
lstPoints.Add(new PointF(lstRects[i + 1].Right, rect.Bottom));
|
||||
lstPoints.Add(new PointF(rect.Left, rect.Bottom));
|
||||
}
|
||||
break;
|
||||
case FunelChartAlignment.Center:
|
||||
if (i == lstRects.Count - 1)
|
||||
{
|
||||
lstPoints.Add(new PointF(rect.Left + rect.Width / 2, rect.Bottom));
|
||||
}
|
||||
else
|
||||
{
|
||||
lstPoints.Add(new PointF(lstRects[i + 1].Right, rect.Bottom));
|
||||
lstPoints.Add(new PointF(lstRects[i + 1].Left, rect.Bottom));
|
||||
}
|
||||
break;
|
||||
case FunelChartAlignment.Right:
|
||||
if (i == lstRects.Count - 1)
|
||||
{
|
||||
lstPoints.Add(new PointF(rect.Right, rect.Bottom));
|
||||
}
|
||||
else
|
||||
{
|
||||
lstPoints.Add(new PointF(rect.Right, rect.Bottom));
|
||||
lstPoints.Add(new PointF(lstRects[i + 1].Left, rect.Bottom));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
path.AddLines(lstPoints.ToArray());
|
||||
path.CloseAllFigures();
|
||||
// g.DrawPath(new Pen(new SolidBrush(lstItems[i].ValueColor.Value)), path);
|
||||
g.FillPath(new SolidBrush(lstItems[i].ValueColor.Value), path);
|
||||
|
||||
//写字
|
||||
if (itemTextAlign == FunelChartAlignment.Center)
|
||||
{
|
||||
g.DrawString(lstItems[i].Text + (ShowValue ? lstItems[i].Value.ToString("\n" + valueFormat) : ""), Font, new SolidBrush((lstItems[i].TextForeColor == null || lstItems[i].TextForeColor == Color.Empty || lstItems[i].TextForeColor == Color.Transparent) ? Color.White : lstItems[i].TextForeColor.Value), rect, new StringFormat() { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center });
|
||||
}
|
||||
else if (itemTextAlign == FunelChartAlignment.Left)
|
||||
{
|
||||
g.DrawString(lstItems[i].Text + (ShowValue ? lstItems[i].Value.ToString("\n" + valueFormat) : ""), Font, new SolidBrush((lstItems[i].TextForeColor == null || lstItems[i].TextForeColor == Color.Empty || lstItems[i].TextForeColor == Color.Transparent) ? lstItems[i].ValueColor.Value : lstItems[i].TextForeColor.Value), new RectangleF(0, rect.Top, rect.Left, rect.Height), new StringFormat() { Alignment = StringAlignment.Far, LineAlignment = StringAlignment.Center });
|
||||
g.DrawLine(new Pen(new SolidBrush((lstItems[i].TextForeColor == null || lstItems[i].TextForeColor == Color.Empty || lstItems[i].TextForeColor == Color.Transparent) ? lstItems[i].ValueColor.Value : lstItems[i].TextForeColor.Value)), rect.Left, rect.Top + rect.Height / 2, rect.Left + rect.Width / 2, rect.Top + rect.Height / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
g.DrawString(lstItems[i].Text + (ShowValue ? lstItems[i].Value.ToString("\n" + valueFormat) : ""), Font, new SolidBrush((lstItems[i].TextForeColor == null || lstItems[i].TextForeColor == Color.Empty || lstItems[i].TextForeColor == Color.Transparent) ? lstItems[i].ValueColor.Value : lstItems[i].TextForeColor.Value), new RectangleF(rect.Right, rect.Top, this.Width - rect.Right, rect.Height), new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center });
|
||||
g.DrawLine(new Pen(new SolidBrush((lstItems[i].TextForeColor == null || lstItems[i].TextForeColor == Color.Empty || lstItems[i].TextForeColor == Color.Transparent) ? lstItems[i].ValueColor.Value : lstItems[i].TextForeColor.Value)), rect.Left + rect.Width / 2, rect.Top + rect.Height / 2, rect.Right, rect.Top + rect.Height / 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
113
X009/src/HZH_Controls/Controls/Charts/MarkText.cs
Normal file
113
X009/src/HZH_Controls/Controls/Charts/MarkText.cs
Normal file
@ -0,0 +1,113 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-23
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="MarkText.cs">
|
||||
// Copyright by Huang Zhenghui(»ÆÕý»Ô) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub£ºhttps://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee£ºhttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System.Drawing;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class MarkText.
|
||||
/// </summary>
|
||||
public class MarkText
|
||||
{
|
||||
/// <summary>
|
||||
/// The mark text offect
|
||||
/// </summary>
|
||||
public static readonly int MarkTextOffect = 5;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the curve key.
|
||||
/// </summary>
|
||||
/// <value>The curve key.</value>
|
||||
public string CurveKey
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the index.
|
||||
/// </summary>
|
||||
/// <value>The index.</value>
|
||||
public int Index
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the mark text.
|
||||
/// </summary>
|
||||
/// <value>The mark text.</value>
|
||||
public string Text
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
private Color? textColor = null;
|
||||
|
||||
public Color? TextColor
|
||||
{
|
||||
get { return textColor; }
|
||||
set { textColor = value; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The position style
|
||||
/// </summary>
|
||||
private MarkTextPositionStyle positionStyle = MarkTextPositionStyle.Auto;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the position style.
|
||||
/// </summary>
|
||||
/// <value>The position style.</value>
|
||||
public MarkTextPositionStyle PositionStyle
|
||||
{
|
||||
get { return positionStyle; }
|
||||
set { positionStyle = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the index of the direction from data.
|
||||
/// </summary>
|
||||
/// <param name="data">The data.</param>
|
||||
/// <param name="Index">The index.</param>
|
||||
/// <returns>MarkTextPositionStyle.</returns>
|
||||
public static MarkTextPositionStyle CalculateDirectionFromDataIndex(float[] data, int Index)
|
||||
{
|
||||
float num = (Index == 0) ? data[Index] : data[Index - 1];
|
||||
float num2 = (Index == data.Length - 1) ? data[Index] : data[Index + 1];
|
||||
if (num < data[Index] && data[Index] < num2)
|
||||
{
|
||||
return MarkTextPositionStyle.Left;
|
||||
}
|
||||
if (num > data[Index] && data[Index] > num2)
|
||||
{
|
||||
return MarkTextPositionStyle.Right;
|
||||
}
|
||||
if (num <= data[Index] && data[Index] >= num2)
|
||||
{
|
||||
return MarkTextPositionStyle.Up;
|
||||
}
|
||||
if (num >= data[Index] && data[Index] <= num2)
|
||||
{
|
||||
return MarkTextPositionStyle.Down;
|
||||
}
|
||||
return MarkTextPositionStyle.Up;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
public enum MarkTextPositionStyle
|
||||
{
|
||||
Up = 1,
|
||||
Right = 2,
|
||||
Down = 4,
|
||||
Left = 8,
|
||||
Auto = 16
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-25
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="RadarLine.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class RadarLine.
|
||||
/// </summary>
|
||||
public class RadarLine
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
public string Name { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the values.
|
||||
/// </summary>
|
||||
/// <value>The values.</value>
|
||||
public double[] Values { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the line.
|
||||
/// </summary>
|
||||
/// <value>The color of the line.</value>
|
||||
public Color? LineColor { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether [show value text].
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if [show value text]; otherwise, <c>false</c>.</value>
|
||||
public bool ShowValueText { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the fill.
|
||||
/// </summary>
|
||||
/// <value>The color of the fill.</value>
|
||||
public Color? FillColor { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
public class RadarPosition
|
||||
{
|
||||
public string Text { get; set; }
|
||||
public double MaxValue { get; set; }
|
||||
public double MinValue { get; set; }
|
||||
}
|
||||
}
|
732
X009/src/HZH_Controls/Controls/Charts/RadarChart/UCRadarChart.cs
Normal file
732
X009/src/HZH_Controls/Controls/Charts/RadarChart/UCRadarChart.cs
Normal file
@ -0,0 +1,732 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-25
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCRadarChart.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCRadarChart.
|
||||
/// Implements the <see cref="System.Windows.Forms.UserControl" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Windows.Forms.UserControl" />
|
||||
public class UCRadarChart : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// The split count
|
||||
/// </summary>
|
||||
private int splitCount = 5;
|
||||
/// <summary>
|
||||
/// Gets or sets the split count.
|
||||
/// </summary>
|
||||
/// <value>The split count.</value>
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置分隔份数")]
|
||||
public int SplitCount
|
||||
{
|
||||
get { return splitCount; }
|
||||
set
|
||||
{
|
||||
splitCount = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置是否使用圆代替连线进行分隔")]
|
||||
public bool UseRoundSplit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The split odd color
|
||||
/// </summary>
|
||||
private Color splitOddColor = Color.White;
|
||||
/// <summary>
|
||||
/// 分隔奇数栏背景色
|
||||
/// </summary>
|
||||
/// <value>The color of the split odd.</value>
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置分隔奇数栏背景色")]
|
||||
public Color SplitOddColor
|
||||
{
|
||||
get { return splitOddColor; }
|
||||
set
|
||||
{
|
||||
splitOddColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The split even color
|
||||
/// </summary>
|
||||
private Color splitEvenColor = Color.FromArgb(232, 232, 232);
|
||||
/// <summary>
|
||||
/// 分隔偶数栏背景色
|
||||
/// </summary>
|
||||
/// <value>The color of the split even.</value>
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置分隔偶数栏背景色")]
|
||||
public Color SplitEvenColor
|
||||
{
|
||||
get { return splitEvenColor; }
|
||||
set
|
||||
{
|
||||
splitEvenColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The line color
|
||||
/// </summary>
|
||||
private Color lineColor = Color.FromArgb(153, 153, 153);
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the line.
|
||||
/// </summary>
|
||||
/// <value>The color of the line.</value>
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置线条色")]
|
||||
public Color LineColor
|
||||
{
|
||||
get { return lineColor; }
|
||||
set
|
||||
{
|
||||
lineColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The radar positions
|
||||
/// </summary>
|
||||
private RadarPosition[] radarPositions;
|
||||
/// <summary>
|
||||
/// 节点列表,至少需要3个
|
||||
/// </summary>
|
||||
/// <value>The radar positions.</value>
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置节点,至少需要3个")]
|
||||
public RadarPosition[] RadarPositions
|
||||
{
|
||||
get { return radarPositions; }
|
||||
set
|
||||
{
|
||||
radarPositions = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The title
|
||||
/// </summary>
|
||||
private string title;
|
||||
/// <summary>
|
||||
/// 标题
|
||||
/// </summary>
|
||||
/// <value>The title.</value>
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置标题")]
|
||||
public string Title
|
||||
{
|
||||
get { return title; }
|
||||
set
|
||||
{
|
||||
title = value;
|
||||
ResetTitleSize();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The title font
|
||||
/// </summary>
|
||||
private Font titleFont = new Font("微软雅黑", 12);
|
||||
/// <summary>
|
||||
/// Gets or sets the title font.
|
||||
/// </summary>
|
||||
/// <value>The title font.</value>
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置标题字体")]
|
||||
public Font TitleFont
|
||||
{
|
||||
get { return titleFont; }
|
||||
set
|
||||
{
|
||||
titleFont = value;
|
||||
ResetTitleSize();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The title color
|
||||
/// </summary>
|
||||
private Color titleColor = Color.Black;
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the title.
|
||||
/// </summary>
|
||||
/// <value>The color of the title.</value>
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置标题文本颜色")]
|
||||
public Color TitleColor
|
||||
{
|
||||
get { return titleColor; }
|
||||
set
|
||||
{
|
||||
titleColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The lines
|
||||
/// </summary>
|
||||
private RadarLine[] lines;
|
||||
/// <summary>
|
||||
/// Gets or sets the lines.
|
||||
/// </summary>
|
||||
/// <value>The lines.</value>
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置值线条,Values长度必须与RadarPositions长度一致,否则无法显示")]
|
||||
public RadarLine[] Lines
|
||||
{
|
||||
get { return lines; }
|
||||
set
|
||||
{
|
||||
lines = value;
|
||||
if (lines != null)
|
||||
{
|
||||
int c = lines.Length;
|
||||
showLinesIndex = new int[c];
|
||||
for (int i = 0; i < c; i++)
|
||||
{
|
||||
showLinesIndex[i] = i;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
showLinesIndex = null;
|
||||
}
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private bool showCheck = false;
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置项目是否可选")]
|
||||
public bool ShowCheck
|
||||
{
|
||||
get { return showCheck; }
|
||||
set { showCheck = value; }
|
||||
}
|
||||
|
||||
private int[] showLinesIndex;
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("当ShowCheck=true时,显示的线条索引,每次修改Lines此属性将被覆盖")]
|
||||
public int[] ShowLinesIndex
|
||||
{
|
||||
get { return showLinesIndex; }
|
||||
set { showLinesIndex = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The title size
|
||||
/// </summary>
|
||||
SizeF titleSize = SizeF.Empty;
|
||||
/// <summary>
|
||||
/// The m rect working
|
||||
/// </summary>
|
||||
private RectangleF m_rectWorking = Rectangle.Empty;
|
||||
/// <summary>
|
||||
/// The line value type size
|
||||
/// </summary>
|
||||
SizeF lineValueTypeSize = SizeF.Empty;
|
||||
/// <summary>
|
||||
/// The int line value COM count
|
||||
/// </summary>
|
||||
int intLineValueComCount = 0;
|
||||
/// <summary>
|
||||
/// The int line value row count
|
||||
/// </summary>
|
||||
int intLineValueRowCount = 0;
|
||||
|
||||
List<RectangleF> m_lstLineTitleRects = new List<RectangleF>();
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCRadarChart"/> class.
|
||||
/// </summary>
|
||||
public UCRadarChart()
|
||||
{
|
||||
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
||||
this.SetStyle(ControlStyles.DoubleBuffer, true);
|
||||
this.SetStyle(ControlStyles.ResizeRedraw, true);
|
||||
this.SetStyle(ControlStyles.Selectable, true);
|
||||
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||||
this.MouseClick += UCRadarChart_MouseClick;
|
||||
this.SetStyle(ControlStyles.UserPaint, true);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.SizeChanged += UCRadarChart_SizeChanged;
|
||||
Size = new System.Drawing.Size(150, 150);
|
||||
radarPositions = new RadarPosition[0];
|
||||
if (ControlHelper.IsDesignMode())
|
||||
{
|
||||
radarPositions = new RadarPosition[7];
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
radarPositions[i] = new RadarPosition
|
||||
{
|
||||
Text = "Item" + (i + 1),
|
||||
MaxValue = 100
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
lines = new RadarLine[0];
|
||||
if (ControlHelper.IsDesignMode())
|
||||
{
|
||||
Random r = new Random();
|
||||
lines = new RadarLine[2];
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
lines[i] = new RadarLine()
|
||||
{
|
||||
Name = "line" + i
|
||||
};
|
||||
lines[i].Values = new double[radarPositions.Length];
|
||||
for (int j = 0; j < radarPositions.Length; j++)
|
||||
{
|
||||
lines[i].Values[j] = r.Next(20, (int)radarPositions[j].MaxValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void UCRadarChart_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (!showCheck)
|
||||
return;
|
||||
for (int i = 0; i < m_lstLineTitleRects.Count; i++)
|
||||
{
|
||||
if (m_lstLineTitleRects[i].Contains(e.Location))
|
||||
{
|
||||
var lst = showLinesIndex.ToList();
|
||||
if (lst.Contains(i))
|
||||
{
|
||||
lst.Remove(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
lst.Add(i);
|
||||
}
|
||||
showLinesIndex = lst.ToArray();
|
||||
Invalidate();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the SizeChanged event of the UCRadarChart control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||||
void UCRadarChart_SizeChanged(object sender, EventArgs e)
|
||||
{
|
||||
ResetWorkingRect();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the working rect.
|
||||
/// </summary>
|
||||
private void ResetWorkingRect()
|
||||
{
|
||||
if (lines != null && lines.Length > 0)
|
||||
{
|
||||
using (Graphics g = this.CreateGraphics())
|
||||
{
|
||||
foreach (var item in lines)
|
||||
{
|
||||
var s = g.MeasureString(item.Name, Font);
|
||||
if (s.Width > lineValueTypeSize.Width)
|
||||
lineValueTypeSize = s;
|
||||
}
|
||||
}
|
||||
}
|
||||
var lineTypePanelHeight = 0f;
|
||||
if (lineValueTypeSize != SizeF.Empty)
|
||||
{
|
||||
intLineValueComCount = (int)(this.Width / (lineValueTypeSize.Width + 25));
|
||||
|
||||
intLineValueRowCount = lines.Length / intLineValueComCount;
|
||||
if (lines.Length % intLineValueComCount != 0)
|
||||
{
|
||||
intLineValueRowCount++;
|
||||
}
|
||||
lineTypePanelHeight = (lineValueTypeSize.Height + 10) * intLineValueRowCount;
|
||||
}
|
||||
var min = Math.Min(this.Width, this.Height - titleSize.Height - lineTypePanelHeight);
|
||||
var rectWorking = new RectangleF((this.Width - min) / 2 + 10, titleSize.Height + lineTypePanelHeight + 10, min - 10, min - 10);
|
||||
//处理文字
|
||||
float fltSplitAngle = 360.0000000F / radarPositions.Length;
|
||||
float fltRadiusWidth = rectWorking.Width / 2.0000000F;
|
||||
float minX = rectWorking.Left;
|
||||
float maxX = rectWorking.Right;
|
||||
float minY = rectWorking.Top;
|
||||
float maxY = rectWorking.Bottom;
|
||||
using (Graphics g = this.CreateGraphics())
|
||||
{
|
||||
PointF centrePoint = new PointF(rectWorking.Left + rectWorking.Width / 2, rectWorking.Top + rectWorking.Height / 2);
|
||||
for (int i = 0; i < radarPositions.Length; i++)
|
||||
{
|
||||
float fltAngle = 270 + fltSplitAngle * i;
|
||||
fltAngle = fltAngle % 360;
|
||||
PointF _point = GetPointByAngle(centrePoint, fltAngle, fltRadiusWidth);
|
||||
var _txtSize = g.MeasureString(radarPositions[i].Text, Font);
|
||||
if (_point.X < centrePoint.X)//左
|
||||
{
|
||||
if (_point.X - _txtSize.Width < minX)
|
||||
{
|
||||
minX = rectWorking.Left + _txtSize.Width;
|
||||
}
|
||||
}
|
||||
else//右
|
||||
{
|
||||
if (_point.X + _txtSize.Width > maxX)
|
||||
{
|
||||
maxX = rectWorking.Right - _txtSize.Width;
|
||||
}
|
||||
}
|
||||
if (_point.Y < centrePoint.Y)//上
|
||||
{
|
||||
if (_point.Y - _txtSize.Height < minY)
|
||||
{
|
||||
minY = rectWorking.Top + _txtSize.Height;
|
||||
}
|
||||
}
|
||||
else//下
|
||||
{
|
||||
if (_point.Y + _txtSize.Height > maxY)
|
||||
{
|
||||
maxY = rectWorking.Bottom - _txtSize.Height;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
min = Math.Min(maxX - minX, maxY - minY);
|
||||
m_rectWorking = new RectangleF(minX, minY, min, min);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 引发 <see cref="E:System.Windows.Forms.Control.Paint" /> 事件。
|
||||
/// </summary>
|
||||
/// <param name="e">包含事件数据的 <see cref="T:System.Windows.Forms.PaintEventArgs" />。</param>
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
var g = e.Graphics;
|
||||
g.SetGDIHigh();
|
||||
|
||||
if (!string.IsNullOrEmpty(title))
|
||||
{
|
||||
g.DrawString(title, titleFont, new SolidBrush(titleColor), new RectangleF(m_rectWorking.Left + (m_rectWorking.Width - titleSize.Width) / 2, m_rectWorking.Top - titleSize.Height - 10 - (intLineValueRowCount * (10 + lineValueTypeSize.Height)), titleSize.Width, titleSize.Height));
|
||||
}
|
||||
|
||||
if (radarPositions.Length <= 2)
|
||||
{
|
||||
g.DrawString("至少需要3个顶点", Font, new SolidBrush(Color.Black), m_rectWorking, new StringFormat() { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center });
|
||||
return;
|
||||
}
|
||||
|
||||
var y = m_rectWorking.Top - 20 - (intLineValueRowCount * (10 + lineValueTypeSize.Height));
|
||||
|
||||
for (int i = 0; i < intLineValueRowCount; i++)
|
||||
{
|
||||
var x = 0f;
|
||||
int intCount = intLineValueComCount;
|
||||
if (i == intLineValueRowCount - 1)
|
||||
{
|
||||
intCount = lines.Length % intLineValueComCount;
|
||||
|
||||
}
|
||||
x = m_rectWorking.Left + (m_rectWorking.Width - intCount * (lineValueTypeSize.Width + 25)) / 2;
|
||||
|
||||
for (int j = 0; j < intCount; j++)
|
||||
{
|
||||
//标题可选
|
||||
var _r = new RectangleF(x + (lineValueTypeSize.Width + 25) * j, y + lineValueTypeSize.Height * i, 15, lineValueTypeSize.Height);
|
||||
m_lstLineTitleRects.Add(_r);
|
||||
if (showCheck && !showLinesIndex.ToList().Contains(j))
|
||||
{
|
||||
g.DrawRectangle(new Pen(new SolidBrush(lines[i * intLineValueComCount + j].LineColor.Value), 2), _r.X, _r.Y, _r.Width, _r.Height);
|
||||
}
|
||||
else
|
||||
g.FillRectangle(new SolidBrush(lines[i * intLineValueComCount + j].LineColor.Value), _r);
|
||||
g.DrawString(lines[i * intLineValueComCount + j].Name, Font, new SolidBrush(lines[i * intLineValueComCount + j].LineColor.Value), new PointF(x + (lineValueTypeSize.Width + 25) * j + 20, y + lineValueTypeSize.Height * i));
|
||||
}
|
||||
}
|
||||
|
||||
float fltSplitAngle = 360F / radarPositions.Length;
|
||||
float fltRadiusWidth = m_rectWorking.Width / 2;
|
||||
float fltSplitRadiusWidth = fltRadiusWidth / splitCount;
|
||||
PointF centrePoint = new PointF(m_rectWorking.Left + m_rectWorking.Width / 2, m_rectWorking.Top + m_rectWorking.Height / 2);
|
||||
|
||||
List<List<PointF>> lstRingPoints = new List<List<PointF>>(splitCount);
|
||||
//分割点
|
||||
for (int i = 0; i < radarPositions.Length; i++)
|
||||
{
|
||||
float fltAngle = 270 + fltSplitAngle * i;
|
||||
fltAngle = fltAngle % 360;
|
||||
for (int j = 0; j < splitCount; j++)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
lstRingPoints.Add(new List<PointF>());
|
||||
}
|
||||
PointF _point = GetPointByAngle(centrePoint, fltAngle, fltSplitRadiusWidth * (splitCount - j));
|
||||
lstRingPoints[j].Add(_point);
|
||||
}
|
||||
}
|
||||
|
||||
if (UseRoundSplit)
|
||||
{
|
||||
for (int i = 0; i < splitCount; i++)
|
||||
{
|
||||
RectangleF rect = new RectangleF(centrePoint.X - fltSplitRadiusWidth * (splitCount - i), centrePoint.Y - fltSplitRadiusWidth * (splitCount - i), fltSplitRadiusWidth * (splitCount - i) * 2, fltSplitRadiusWidth * (splitCount - i) * 2);
|
||||
if (i % 2 == 0)
|
||||
{
|
||||
g.FillEllipse(new SolidBrush(splitOddColor), rect);
|
||||
}
|
||||
else
|
||||
{
|
||||
g.FillEllipse(new SolidBrush(splitEvenColor), rect);
|
||||
}
|
||||
|
||||
g.DrawEllipse(new Pen(new SolidBrush(lineColor)), rect);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//间隔颜色
|
||||
for (int i = 0; i < lstRingPoints.Count; i++)
|
||||
{
|
||||
var ring = lstRingPoints[i];
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
path.AddLines(ring.ToArray());
|
||||
if ((lstRingPoints.Count - i) % 2 == 0)
|
||||
{
|
||||
g.FillPath(new SolidBrush(splitEvenColor), path);
|
||||
}
|
||||
else
|
||||
{
|
||||
g.FillPath(new SolidBrush(splitOddColor), path);
|
||||
}
|
||||
}
|
||||
//画环
|
||||
foreach (var ring in lstRingPoints)
|
||||
{
|
||||
ring.Add(ring[0]);
|
||||
g.DrawLines(new Pen(new SolidBrush(lineColor)), ring.ToArray());
|
||||
}
|
||||
}
|
||||
//分割线
|
||||
foreach (var item in lstRingPoints[0])
|
||||
{
|
||||
g.DrawLine(new Pen(new SolidBrush(lineColor)), centrePoint, item);
|
||||
}
|
||||
|
||||
//值
|
||||
for (int i = 0; i < lines.Length; i++)
|
||||
{
|
||||
if (showCheck && !showLinesIndex.ToList().Contains(i))
|
||||
continue;
|
||||
var line = lines[i];
|
||||
if (line.Values.Length != radarPositions.Length)//如果数据长度和节点长度不一致则不绘制
|
||||
continue;
|
||||
if (line.LineColor == null || line.LineColor == Color.Empty || line.LineColor == Color.Transparent)
|
||||
line.LineColor = ControlHelper.Colors[i + 13];
|
||||
List<PointF> ps = new List<PointF>();
|
||||
for (int j = 0; j < radarPositions.Length; j++)
|
||||
{
|
||||
float fltAngle = 270 + fltSplitAngle * j;
|
||||
fltAngle = fltAngle % 360;
|
||||
PointF _point = GetPointByAngle(centrePoint, fltAngle, fltRadiusWidth * (float)((line.Values[j] - radarPositions[j].MinValue) / (radarPositions[j].MaxValue - radarPositions[j].MinValue)));
|
||||
ps.Add(_point);
|
||||
}
|
||||
ps.Add(ps[0]);
|
||||
if (line.FillColor != null && line.FillColor != Color.Empty && line.FillColor != Color.Transparent)
|
||||
{
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
path.AddLines(ps.ToArray());
|
||||
g.FillPath(new SolidBrush(line.FillColor.Value), path);
|
||||
}
|
||||
g.DrawLines(new Pen(new SolidBrush(line.LineColor.Value), 2), ps.ToArray());
|
||||
|
||||
for (int j = 0; j < radarPositions.Length; j++)
|
||||
{
|
||||
var item = ps[j];
|
||||
g.FillEllipse(new SolidBrush(Color.White), new RectangleF(item.X - 3, item.Y - 3, 6, 6));
|
||||
g.DrawEllipse(new Pen(new SolidBrush(line.LineColor.Value)), new RectangleF(item.X - 3, item.Y - 3, 6, 6));
|
||||
if (line.ShowValueText)
|
||||
{
|
||||
var valueSize = g.MeasureString(line.Values[j].ToString("0.##"), Font);
|
||||
g.DrawString(line.Values[j].ToString("0.##"), Font, new SolidBrush(line.LineColor.Value), new PointF(item.X - valueSize.Width / 2, item.Y - valueSize.Height - 5));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//文本
|
||||
|
||||
for (int i = 0; i < radarPositions.Length; i++)
|
||||
{
|
||||
PointF point = lstRingPoints[0][i];
|
||||
var txtSize = g.MeasureString(radarPositions[i].Text, Font);
|
||||
|
||||
if (point.X == centrePoint.X)
|
||||
{
|
||||
if (point.Y > centrePoint.Y)
|
||||
{
|
||||
g.DrawString(radarPositions[i].Text, Font, new SolidBrush(ForeColor), new PointF(point.X - txtSize.Width / 2, point.Y + 10));
|
||||
}
|
||||
else
|
||||
{
|
||||
g.DrawString(radarPositions[i].Text, Font, new SolidBrush(ForeColor), new PointF(point.X - txtSize.Width / 2, point.Y - 10 - txtSize.Height));
|
||||
}
|
||||
}
|
||||
else if (point.Y == centrePoint.Y)
|
||||
{
|
||||
if (point.X < centrePoint.X)
|
||||
g.DrawString(radarPositions[i].Text, Font, new SolidBrush(ForeColor), new PointF(point.X - 10 - txtSize.Width, point.Y - txtSize.Height / 2));
|
||||
else
|
||||
g.DrawString(radarPositions[i].Text, Font, new SolidBrush(ForeColor), new PointF(point.X + 10, point.Y - txtSize.Height / 2));
|
||||
}
|
||||
else if (point.X < centrePoint.X)//左
|
||||
{
|
||||
if (point.Y < centrePoint.Y)//左上
|
||||
{
|
||||
g.DrawString(radarPositions[i].Text, Font, new SolidBrush(ForeColor), new PointF(point.X - 10 - txtSize.Width, point.Y - 10 + txtSize.Height / 2));
|
||||
}
|
||||
else//左下
|
||||
{
|
||||
g.DrawString(radarPositions[i].Text, Font, new SolidBrush(ForeColor), new PointF(point.X - 10 - txtSize.Width, point.Y + 10 - txtSize.Height / 2));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (point.Y < centrePoint.Y)//右上
|
||||
{
|
||||
g.DrawString(radarPositions[i].Text, Font, new SolidBrush(ForeColor), new PointF(point.X + 10, point.Y - 10 + txtSize.Height / 2));
|
||||
}
|
||||
else//右下
|
||||
{
|
||||
g.DrawString(radarPositions[i].Text, Font, new SolidBrush(ForeColor), new PointF(point.X + 10, point.Y + 10 - txtSize.Height / 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#region 根据中心点、角度、半径计算圆边坐标点 English:Calculating the coordinate points of circular edge according to the center point, angle and radius
|
||||
/// <summary>
|
||||
/// 功能描述:根据中心点、角度、半径计算圆边坐标点 English:Calculating the coordinate points of circular edge according to the center point, angle and radius
|
||||
/// 作 者:HZH
|
||||
/// 创建日期:2019-09-25 09:46:32
|
||||
/// 任务编号:POS
|
||||
/// </summary>
|
||||
/// <param name="centrePoint">centrePoint</param>
|
||||
/// <param name="fltAngle">fltAngle</param>
|
||||
/// <param name="fltRadiusWidth">fltRadiusWidth</param>
|
||||
/// <returns>返回值</returns>
|
||||
private PointF GetPointByAngle(PointF centrePoint, float fltAngle, float fltRadiusWidth)
|
||||
{
|
||||
PointF p = centrePoint;
|
||||
if (fltAngle == 0)
|
||||
{
|
||||
p.X += fltRadiusWidth;
|
||||
}
|
||||
else if (fltAngle == 90)
|
||||
{
|
||||
p.Y += fltRadiusWidth;
|
||||
}
|
||||
else if (fltAngle == 180)
|
||||
{
|
||||
p.X -= fltRadiusWidth;
|
||||
}
|
||||
else if (fltAngle == 270)
|
||||
{
|
||||
p.Y -= fltRadiusWidth;
|
||||
}
|
||||
else if (fltAngle > 0 && fltAngle < 90)
|
||||
{
|
||||
p.Y += (float)Math.Sin(Math.PI * (fltAngle / 180.00F)) * fltRadiusWidth;
|
||||
p.X += (float)Math.Cos(Math.PI * (fltAngle / 180.00F)) * fltRadiusWidth;
|
||||
}
|
||||
else if (fltAngle > 90 && fltAngle < 180)
|
||||
{
|
||||
p.Y += (float)Math.Sin(Math.PI * ((180 - fltAngle) / 180.00F)) * fltRadiusWidth;
|
||||
p.X -= (float)Math.Cos(Math.PI * ((180 - fltAngle) / 180.00F)) * fltRadiusWidth;
|
||||
}
|
||||
else if (fltAngle > 180 && fltAngle < 270)
|
||||
{
|
||||
p.Y -= (float)Math.Sin(Math.PI * ((fltAngle - 180) / 180.00F)) * fltRadiusWidth;
|
||||
p.X -= (float)Math.Cos(Math.PI * ((fltAngle - 180) / 180.00F)) * fltRadiusWidth;
|
||||
}
|
||||
else if (fltAngle > 270 && fltAngle < 360)
|
||||
{
|
||||
p.Y -= (float)Math.Sin(Math.PI * ((360 - fltAngle) / 180.00F)) * fltRadiusWidth;
|
||||
p.X += (float)Math.Cos(Math.PI * ((360 - fltAngle) / 180.00F)) * fltRadiusWidth;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Resets the size of the title.
|
||||
/// </summary>
|
||||
private void ResetTitleSize()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(title))
|
||||
{
|
||||
using (Graphics g = this.CreateGraphics())
|
||||
{
|
||||
titleSize = g.MeasureString(title, titleFont);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
titleSize = SizeF.Empty;
|
||||
}
|
||||
titleSize.Height += 20;
|
||||
ResetWorkingRect();
|
||||
}
|
||||
}
|
||||
}
|
36
X009/src/HZH_Controls/Controls/Charts/ZoomType.cs
Normal file
36
X009/src/HZH_Controls/Controls/Charts/ZoomType.cs
Normal file
@ -0,0 +1,36 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-17
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="ZoomType.cs">
|
||||
// Copyright by Huang Zhenghui(»ÆÕý»Ô) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub£ºhttps://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee£ºhttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Enum ZoomType
|
||||
/// </summary>
|
||||
public enum ZoomType
|
||||
{
|
||||
/// <summary>
|
||||
/// The none
|
||||
/// </summary>
|
||||
None,
|
||||
/// <summary>
|
||||
/// The enlarge
|
||||
/// </summary>
|
||||
Enlarge,
|
||||
/// <summary>
|
||||
/// The reduce
|
||||
/// </summary>
|
||||
Reduce
|
||||
}
|
||||
}
|
105
X009/src/HZH_Controls/Controls/Checkbox/UCCheckBox.Designer.cs
generated
Normal file
105
X009/src/HZH_Controls/Controls/Checkbox/UCCheckBox.Designer.cs
generated
Normal file
@ -0,0 +1,105 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-08-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCCheckBox.Designer.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCCheckBox.
|
||||
/// Implements the <see cref="System.Windows.Forms.UserControl" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Windows.Forms.UserControl" />
|
||||
partial class UCCheckBox
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.panel1.Location = new System.Drawing.Point(1, 1);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(18, 28);
|
||||
this.panel1.TabIndex = 0;
|
||||
this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint);
|
||||
this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.CheckBox_MouseDown);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.label1.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(62)))), ((int)(((byte)(62)))), ((int)(((byte)(62)))));
|
||||
this.label1.Location = new System.Drawing.Point(19, 1);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Padding = new System.Windows.Forms.Padding(5, 0, 0, 0);
|
||||
this.label1.Size = new System.Drawing.Size(213, 28);
|
||||
this.label1.TabIndex = 1;
|
||||
this.label1.Text = "复选框";
|
||||
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.label1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.CheckBox_MouseDown);
|
||||
//
|
||||
// UCCheckBox
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Name = "UCCheckBox";
|
||||
this.Padding = new System.Windows.Forms.Padding(1);
|
||||
this.Size = new System.Drawing.Size(233, 30);
|
||||
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.CheckBox_MouseDown);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// The panel1
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
/// <summary>
|
||||
/// The label1
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Label label1;
|
||||
}
|
||||
}
|
228
X009/src/HZH_Controls/Controls/Checkbox/UCCheckBox.cs
Normal file
228
X009/src/HZH_Controls/Controls/Checkbox/UCCheckBox.cs
Normal file
@ -0,0 +1,228 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-08-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCCheckBox.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCCheckBox.
|
||||
/// Implements the <see cref="System.Windows.Forms.UserControl" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Windows.Forms.UserControl" />
|
||||
[DefaultEvent("CheckedChangeEvent")]
|
||||
public partial class UCCheckBox : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// 选中改变事件
|
||||
/// </summary>
|
||||
[Description("选中改变事件"), Category("自定义")]
|
||||
public event EventHandler CheckedChangeEvent;
|
||||
/// <summary>
|
||||
/// 字体
|
||||
/// </summary>
|
||||
/// <value>The font.</value>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
|
||||
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
[Description("字体"), Category("自定义")]
|
||||
public override Font Font
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Font;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Font = value;
|
||||
label1.Font = value;
|
||||
}
|
||||
}
|
||||
private Color _boxColor = Color.FromArgb(64, 158, 255);
|
||||
[Description("颜色"), Category("自定义")]
|
||||
public Color BoxColor
|
||||
{
|
||||
get { return _boxColor; }
|
||||
set
|
||||
{
|
||||
_boxColor = value;
|
||||
panel1.Refresh();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The fore color
|
||||
/// </summary>
|
||||
private Color _ForeColor = Color.FromArgb(62, 62, 62);
|
||||
/// <summary>
|
||||
/// 字体颜色
|
||||
/// </summary>
|
||||
/// <value>The color of the fore.</value>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
[Description("字体颜色"), Category("自定义")]
|
||||
public new Color ForeColor
|
||||
{
|
||||
get { return _ForeColor; }
|
||||
set
|
||||
{
|
||||
base.ForeColor = value;
|
||||
label1.ForeColor = value;
|
||||
_ForeColor = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The text
|
||||
/// </summary>
|
||||
private string _Text = "复选框";
|
||||
/// <summary>
|
||||
/// 文本
|
||||
/// </summary>
|
||||
/// <value>The text value.</value>
|
||||
[Description("文本"), Category("自定义")]
|
||||
public string TextValue
|
||||
{
|
||||
get { return _Text; }
|
||||
set
|
||||
{
|
||||
label1.Text = value;
|
||||
_Text = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The checked
|
||||
/// </summary>
|
||||
private bool _checked = false;
|
||||
/// <summary>
|
||||
/// 是否选中
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if checked; otherwise, <c>false</c>.</value>
|
||||
[Description("是否选中"), Category("自定义")]
|
||||
public bool Checked
|
||||
{
|
||||
get
|
||||
{
|
||||
return _checked;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_checked != value)
|
||||
{
|
||||
_checked = value;
|
||||
Refresh();
|
||||
if (CheckedChangeEvent != null)
|
||||
{
|
||||
CheckedChangeEvent(this, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置一个值,该值指示控件是否可以对用户交互作出响应。
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if enabled; otherwise, <c>false</c>.</value>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
|
||||
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
public new bool Enabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Enabled;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Enabled = value;
|
||||
Refresh();
|
||||
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCCheckBox" /> class.
|
||||
/// </summary>
|
||||
public UCCheckBox()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
||||
this.SetStyle(ControlStyles.DoubleBuffer, true);
|
||||
this.SetStyle(ControlStyles.ResizeRedraw, true);
|
||||
this.SetStyle(ControlStyles.Selectable, true);
|
||||
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||||
this.SetStyle(ControlStyles.UserPaint, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the MouseDown event of the CheckBox control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
|
||||
private void CheckBox_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
Checked = !Checked;
|
||||
}
|
||||
|
||||
private void panel1_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
e.Graphics.Clear(panel1.BackColor);
|
||||
|
||||
Rectangle rect = new Rectangle(new Point(2, (this.panel1.Height - 14) / 2), new Size(14, 14));
|
||||
e.Graphics.SetGDIHigh();
|
||||
if (this.Enabled)
|
||||
{
|
||||
if (_checked)
|
||||
{
|
||||
e.Graphics.DrawRectangle(new Pen(_boxColor, 2), rect);
|
||||
e.Graphics.FillRectangle(new SolidBrush(_boxColor), new Rectangle(rect.Left + 3, rect.Top + 3, 8, 8));
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Graphics.DrawRectangle(new Pen(_boxColor, 2), rect);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_checked)
|
||||
{
|
||||
e.Graphics.DrawRectangle(new Pen(Color.FromArgb(189, 189, 189), 2), rect);
|
||||
e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(189, 189, 189)), new Rectangle(rect.Left + 3, rect.Top + 3, 8, 8));
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Graphics.DrawRectangle(new Pen(Color.FromArgb(189, 189, 189), 2), rect);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UCCheckBox_EnabledChanged(object sender, EventArgs e)
|
||||
{
|
||||
panel1.Refresh();
|
||||
}
|
||||
}
|
||||
}
|
120
X009/src/HZH_Controls/Controls/Checkbox/UCCheckBox.resx
Normal file
120
X009/src/HZH_Controls/Controls/Checkbox/UCCheckBox.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
147
X009/src/HZH_Controls/Controls/ComboBox/UCCombox.Designer.cs
generated
Normal file
147
X009/src/HZH_Controls/Controls/ComboBox/UCCombox.Designer.cs
generated
Normal file
@ -0,0 +1,147 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-08-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCCombox.Designer.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCCombox.
|
||||
/// Implements the <see cref="HZH_Controls.Controls.UCControlBase" />
|
||||
/// </summary>
|
||||
/// <seealso cref="HZH_Controls.Controls.UCControlBase" />
|
||||
partial class UCCombox
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.txtInput = new HZH_Controls.Controls.TextBoxEx();
|
||||
this.lblInput = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.BackColor = System.Drawing.Color.Transparent;
|
||||
this.panel1.BackgroundImage = global::HZH_Controls.Properties.Resources.ComboBox;
|
||||
this.panel1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.panel1.Location = new System.Drawing.Point(136, 0);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(37, 32);
|
||||
this.panel1.TabIndex = 0;
|
||||
this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.click_MouseDown);
|
||||
//
|
||||
// txtInput
|
||||
//
|
||||
this.txtInput.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtInput.BackColor = System.Drawing.Color.White;
|
||||
this.txtInput.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.txtInput.DecLength = 2;
|
||||
this.txtInput.Font = new System.Drawing.Font("微软雅黑", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.txtInput.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.txtInput.InputType = HZH_Controls.TextInputType.NotControl;
|
||||
this.txtInput.Location = new System.Drawing.Point(3, 4);
|
||||
this.txtInput.Margin = new System.Windows.Forms.Padding(3, 3, 10, 3);
|
||||
this.txtInput.MaxValue = new decimal(new int[] {
|
||||
1000000,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.txtInput.MinValue = new decimal(new int[] {
|
||||
1000000,
|
||||
0,
|
||||
0,
|
||||
-2147483648});
|
||||
this.txtInput.MyRectangle = new System.Drawing.Rectangle(0, 0, 0, 0);
|
||||
this.txtInput.Name = "txtInput";
|
||||
this.txtInput.OldText = null;
|
||||
this.txtInput.PromptColor = System.Drawing.Color.Silver;
|
||||
this.txtInput.PromptFont = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.txtInput.PromptText = "";
|
||||
this.txtInput.RegexPattern = "";
|
||||
this.txtInput.Size = new System.Drawing.Size(133, 24);
|
||||
this.txtInput.TabIndex = 1;
|
||||
this.txtInput.TextChanged += new System.EventHandler(this.txtInput_TextChanged);
|
||||
//
|
||||
// lblInput
|
||||
//
|
||||
this.lblInput.AutoSize = true;
|
||||
this.lblInput.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.lblInput.Location = new System.Drawing.Point(3, 6);
|
||||
this.lblInput.Name = "lblInput";
|
||||
this.lblInput.Size = new System.Drawing.Size(0, 20);
|
||||
this.lblInput.TabIndex = 2;
|
||||
this.lblInput.Visible = false;
|
||||
this.lblInput.MouseDown += new System.Windows.Forms.MouseEventHandler(this.click_MouseDown);
|
||||
//
|
||||
// UCCombox
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackColor = System.Drawing.Color.Transparent;
|
||||
this.ConerRadius = 5;
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Controls.Add(this.txtInput);
|
||||
this.Controls.Add(this.lblInput);
|
||||
this.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240)))));
|
||||
this.IsRadius = true;
|
||||
this.IsShowRect = true;
|
||||
this.Name = "UCCombox";
|
||||
this.Size = new System.Drawing.Size(173, 32);
|
||||
this.Load += new System.EventHandler(this.UCComboBox_Load);
|
||||
this.SizeChanged += new System.EventHandler(this.UCComboBox_SizeChanged);
|
||||
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.click_MouseDown);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// The panel1
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
/// <summary>
|
||||
/// The text input
|
||||
/// </summary>
|
||||
public TextBoxEx txtInput;
|
||||
/// <summary>
|
||||
/// The label input
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Label lblInput;
|
||||
}
|
||||
}
|
602
X009/src/HZH_Controls/Controls/ComboBox/UCCombox.cs
Normal file
602
X009/src/HZH_Controls/Controls/ComboBox/UCCombox.cs
Normal file
@ -0,0 +1,602 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-08-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCCombox.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCCombox.
|
||||
/// Implements the <see cref="HZH_Controls.Controls.UCControlBase" />
|
||||
/// </summary>
|
||||
/// <seealso cref="HZH_Controls.Controls.UCControlBase" />
|
||||
[DefaultEvent("SelectedChangedEvent")]
|
||||
public partial class UCCombox : UCControlBase
|
||||
{
|
||||
/// <summary>
|
||||
/// The fore color
|
||||
/// </summary>
|
||||
Color _ForeColor = Color.FromArgb(64, 64, 64);
|
||||
/// <summary>
|
||||
/// 文字颜色
|
||||
/// </summary>
|
||||
/// <value>The color of the fore.</value>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
[Description("文字颜色"), Category("自定义")]
|
||||
public override Color ForeColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return _ForeColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
_ForeColor = value;
|
||||
lblInput.ForeColor = value;
|
||||
txtInput.ForeColor = value;
|
||||
}
|
||||
}
|
||||
|
||||
Color _selectItemColor = Color.FromArgb(64, 64, 64);
|
||||
[Description("选中颜色"), Category("自定义")]
|
||||
public Color SelectItemColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return _selectItemColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
_selectItemColor = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 选中事件
|
||||
/// </summary>
|
||||
[Description("选中事件"), Category("自定义")]
|
||||
public event EventHandler SelectedChangedEvent;
|
||||
/// <summary>
|
||||
/// 文本改变事件
|
||||
/// </summary>
|
||||
[Description("文本改变事件"), Category("自定义")]
|
||||
public event EventHandler TextChangedEvent;
|
||||
|
||||
/// <summary>
|
||||
/// The box style
|
||||
/// </summary>
|
||||
private ComboBoxStyle _BoxStyle = ComboBoxStyle.DropDown;
|
||||
/// <summary>
|
||||
/// 控件样式
|
||||
/// </summary>
|
||||
/// <value>The box style.</value>
|
||||
[Description("控件样式"), Category("自定义")]
|
||||
public ComboBoxStyle BoxStyle
|
||||
{
|
||||
get { return _BoxStyle; }
|
||||
set
|
||||
{
|
||||
_BoxStyle = value;
|
||||
if (value == ComboBoxStyle.DropDownList)
|
||||
{
|
||||
lblInput.Visible = true;
|
||||
txtInput.Visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
lblInput.Visible = false;
|
||||
txtInput.Visible = true;
|
||||
}
|
||||
|
||||
if (this._BoxStyle == ComboBoxStyle.DropDownList)
|
||||
{
|
||||
txtInput.BackColor = _BackColor;
|
||||
base.FillColor = _BackColor;
|
||||
base.RectColor = _BackColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
txtInput.BackColor = Color.White;
|
||||
base.FillColor = Color.White;
|
||||
base.RectColor = Color.FromArgb(220, 220, 220);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The font
|
||||
/// </summary>
|
||||
private Font _Font = new Font("微软雅黑", 12);
|
||||
/// <summary>
|
||||
/// 字体
|
||||
/// </summary>
|
||||
/// <value>The font.</value>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
|
||||
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
[Description("字体"), Category("自定义")]
|
||||
public new Font Font
|
||||
{
|
||||
get { return _Font; }
|
||||
set
|
||||
{
|
||||
_Font = value;
|
||||
lblInput.Font = value;
|
||||
txtInput.Font = value;
|
||||
txtInput.PromptFont = value;
|
||||
this.txtInput.Location = new Point(this.txtInput.Location.X, (this.Height - txtInput.Height) / 2);
|
||||
this.lblInput.Location = new Point(this.lblInput.Location.X, (this.Height - lblInput.Height) / 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 当使用边框时填充颜色,当值为背景色或透明色或空值则不填充
|
||||
/// </summary>
|
||||
/// <value>The color of the fill.</value>
|
||||
[Obsolete("不再可用的属性")]
|
||||
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private new Color FillColor
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 边框颜色
|
||||
/// </summary>
|
||||
/// <value>The color of the rect.</value>
|
||||
[Obsolete("不再可用的属性")]
|
||||
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private new Color RectColor
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The text value
|
||||
/// </summary>
|
||||
private string _TextValue;
|
||||
/// <summary>
|
||||
/// 文字
|
||||
/// </summary>
|
||||
/// <value>The text value.</value>
|
||||
[Description("文字"), Category("自定义")]
|
||||
public string TextValue
|
||||
{
|
||||
get { return _TextValue; }
|
||||
set
|
||||
{
|
||||
_TextValue = value;
|
||||
if (lblInput.Text != value)
|
||||
lblInput.Text = value;
|
||||
if (txtInput.Text != value)
|
||||
txtInput.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The source
|
||||
/// </summary>
|
||||
private List<KeyValuePair<string, string>> _source = null;
|
||||
/// <summary>
|
||||
/// 数据源
|
||||
/// </summary>
|
||||
/// <value>The source.</value>
|
||||
[Description("数据源"), Category("自定义")]
|
||||
public List<KeyValuePair<string, string>> Source
|
||||
{
|
||||
get { return _source; }
|
||||
set
|
||||
{
|
||||
_source = value;
|
||||
_selectedIndex = -1;
|
||||
_selectedValue = "";
|
||||
_selectedItem = new KeyValuePair<string, string>();
|
||||
_selectedText = "";
|
||||
lblInput.Text = "";
|
||||
txtInput.Text = "";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The selected item
|
||||
/// </summary>
|
||||
private KeyValuePair<string, string> _selectedItem = new KeyValuePair<string, string>();
|
||||
|
||||
/// <summary>
|
||||
/// The selected index
|
||||
/// </summary>
|
||||
private int _selectedIndex = -1;
|
||||
/// <summary>
|
||||
/// 选中的数据下标
|
||||
/// </summary>
|
||||
/// <value>The index of the selected.</value>
|
||||
[Description("选中的数据下标"), Category("自定义")]
|
||||
public int SelectedIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return _selectedIndex;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value < 0 || _source == null || _source.Count <= 0 || value >= _source.Count)
|
||||
{
|
||||
_selectedIndex = -1;
|
||||
_selectedValue = "";
|
||||
_selectedItem = new KeyValuePair<string, string>();
|
||||
SelectedText = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
_selectedIndex = value;
|
||||
_selectedItem = _source[value];
|
||||
_selectedValue = _source[value].Key;
|
||||
SelectedText = _source[value].Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The selected value
|
||||
/// </summary>
|
||||
private string _selectedValue = "";
|
||||
/// <summary>
|
||||
/// 选中的值
|
||||
/// </summary>
|
||||
/// <value>The selected value.</value>
|
||||
[Description("选中的值"), Category("自定义")]
|
||||
public string SelectedValue
|
||||
{
|
||||
get
|
||||
{
|
||||
return _selectedValue;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_source == null || _source.Count <= 0)
|
||||
{
|
||||
SelectedText = "";
|
||||
_selectedValue = "";
|
||||
_selectedIndex = -1;
|
||||
_selectedItem = new KeyValuePair<string, string>();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < _source.Count; i++)
|
||||
{
|
||||
if (_source[i].Key == value)
|
||||
{
|
||||
_selectedValue = value;
|
||||
_selectedIndex = i;
|
||||
_selectedItem = _source[i];
|
||||
SelectedText = _source[i].Value;
|
||||
return;
|
||||
}
|
||||
}
|
||||
_selectedValue = "";
|
||||
_selectedIndex = -1;
|
||||
_selectedItem = new KeyValuePair<string, string>();
|
||||
SelectedText = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The selected text
|
||||
/// </summary>
|
||||
private string _selectedText = "";
|
||||
/// <summary>
|
||||
/// 选中的文本
|
||||
/// </summary>
|
||||
/// <value>The selected text.</value>
|
||||
[Description("选中的文本"), Category("自定义")]
|
||||
public string SelectedText
|
||||
{
|
||||
get { return _selectedText; }
|
||||
private set
|
||||
{
|
||||
_selectedText = value;
|
||||
lblInput.Text = _selectedText;
|
||||
txtInput.Text = _selectedText;
|
||||
if (SelectedChangedEvent != null)
|
||||
{
|
||||
SelectedChangedEvent(this, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The item width
|
||||
/// </summary>
|
||||
private int _ItemWidth = 70;
|
||||
/// <summary>
|
||||
/// 项宽度
|
||||
/// </summary>
|
||||
/// <value>The width of the item.</value>
|
||||
[Description("项宽度"), Category("自定义")]
|
||||
public int ItemWidth
|
||||
{
|
||||
get { return _ItemWidth; }
|
||||
set { _ItemWidth = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The drop panel height
|
||||
/// </summary>
|
||||
private int _dropPanelHeight = -1;
|
||||
/// <summary>
|
||||
/// 下拉面板高度
|
||||
/// </summary>
|
||||
/// <value>The height of the drop panel.</value>
|
||||
[Description("下拉面板高度"), Category("自定义")]
|
||||
public int DropPanelHeight
|
||||
{
|
||||
get { return _dropPanelHeight; }
|
||||
set { _dropPanelHeight = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取或设置控件的背景色。
|
||||
/// </summary>
|
||||
/// <value>The color of the back.</value>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
[Obsolete("不再可用的属性,如需要改变背景色,请使用BackColorExt")]
|
||||
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private new Color BackColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.BackColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.BackColor = Color.Transparent;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The back color
|
||||
/// </summary>
|
||||
private Color _BackColor = Color.FromArgb(240, 240, 240);
|
||||
/// <summary>
|
||||
/// 背景色
|
||||
/// </summary>
|
||||
/// <value>The back color ext.</value>
|
||||
[Description("背景色"), Category("自定义")]
|
||||
public Color BackColorExt
|
||||
{
|
||||
get
|
||||
{
|
||||
return _BackColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == Color.Transparent)
|
||||
return;
|
||||
_BackColor = value;
|
||||
lblInput.BackColor = value;
|
||||
|
||||
if (this._BoxStyle == ComboBoxStyle.DropDownList)
|
||||
{
|
||||
txtInput.BackColor = value;
|
||||
base.FillColor = value;
|
||||
base.RectColor = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
txtInput.BackColor = Color.White;
|
||||
base.FillColor = Color.White;
|
||||
base.RectColor = Color.FromArgb(220, 220, 220);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The triangle color
|
||||
/// </summary>
|
||||
private Color triangleColor = Color.FromArgb(255, 77, 59);
|
||||
/// <summary>
|
||||
/// 三角颜色
|
||||
/// </summary>
|
||||
/// <value>The color of the triangle.</value>
|
||||
[Description("三角颜色"), Category("自定义")]
|
||||
public Color TriangleColor
|
||||
{
|
||||
get { return triangleColor; }
|
||||
set
|
||||
{
|
||||
triangleColor = value;
|
||||
Bitmap bit = new Bitmap(12, 10);
|
||||
Graphics g = Graphics.FromImage(bit);
|
||||
g.SetGDIHigh();
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
path.AddLines(new Point[]
|
||||
{
|
||||
new Point(1,1),
|
||||
new Point(11,1),
|
||||
new Point(6,10),
|
||||
new Point(1,1)
|
||||
});
|
||||
g.FillPath(new SolidBrush(value), path);
|
||||
g.Dispose();
|
||||
panel1.BackgroundImage = bit;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCCombox" /> class.
|
||||
/// </summary>
|
||||
public UCCombox()
|
||||
{
|
||||
InitializeComponent();
|
||||
lblInput.BackColor = _BackColor;
|
||||
if (this._BoxStyle == ComboBoxStyle.DropDownList)
|
||||
{
|
||||
txtInput.BackColor = _BackColor;
|
||||
base.FillColor = _BackColor;
|
||||
base.RectColor = _BackColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
txtInput.BackColor = Color.White;
|
||||
base.FillColor = Color.White;
|
||||
base.RectColor = Color.FromArgb(220, 220, 220);
|
||||
}
|
||||
base.BackColor = Color.Transparent;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the SizeChanged event of the UCComboBox control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void UCComboBox_SizeChanged(object sender, EventArgs e)
|
||||
{
|
||||
this.txtInput.Location = new Point(this.txtInput.Location.X, (this.Height - txtInput.Height) / 2);
|
||||
this.lblInput.Location = new Point(this.lblInput.Location.X, (this.Height - lblInput.Height) / 2);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the TextChanged event of the txtInput control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void txtInput_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
TextValue = txtInput.Text;
|
||||
if (TextChangedEvent != null)
|
||||
{
|
||||
TextChangedEvent(this, null);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the MouseDown event of the click control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
|
||||
protected virtual void click_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (_frmAnchor == null || _frmAnchor.IsDisposed || _frmAnchor.Visible == false)
|
||||
{
|
||||
|
||||
if (this.Source != null && this.Source.Count > 0)
|
||||
{
|
||||
int intRow = 0;
|
||||
int intCom = 1;
|
||||
var p = this.PointToScreen(this.Location);
|
||||
while (true)
|
||||
{
|
||||
int intScreenHeight = Screen.PrimaryScreen.Bounds.Height;
|
||||
if ((p.Y + this.Height + this.Source.Count / intCom * 50 < intScreenHeight || p.Y - this.Source.Count / intCom * 50 > 0)
|
||||
&& (_dropPanelHeight <= 0 ? true : (this.Source.Count / intCom * 50 <= _dropPanelHeight)))
|
||||
{
|
||||
intRow = this.Source.Count / intCom + (this.Source.Count % intCom != 0 ? 1 : 0);
|
||||
break;
|
||||
}
|
||||
intCom++;
|
||||
}
|
||||
UCTimePanel ucTime = new UCTimePanel();
|
||||
ucTime.SelectColor = SelectItemColor;
|
||||
ucTime.IsShowBorder = true;
|
||||
int intWidth = this.Width / intCom;
|
||||
if (intWidth < _ItemWidth)
|
||||
intWidth = _ItemWidth;
|
||||
Size size = new Size(intCom * intWidth, intRow * 50);
|
||||
ucTime.Size = size;
|
||||
ucTime.FirstEvent = true;
|
||||
ucTime.SelectSourceEvent += ucTime_SelectSourceEvent;
|
||||
ucTime.Row = intRow;
|
||||
ucTime.Column = intCom;
|
||||
List<KeyValuePair<string, string>> lst = new List<KeyValuePair<string, string>>();
|
||||
foreach (var item in this.Source)
|
||||
{
|
||||
lst.Add(new KeyValuePair<string, string>(item.Key, item.Value));
|
||||
}
|
||||
ucTime.Source = lst;
|
||||
|
||||
ucTime.SetSelect(_selectedValue);
|
||||
|
||||
_frmAnchor = new Forms.FrmAnchor(this, ucTime);
|
||||
_frmAnchor.Load += (a, b) => { (a as Form).Size = size; };
|
||||
|
||||
_frmAnchor.Show(this.FindForm());
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_frmAnchor.Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The FRM anchor
|
||||
/// </summary>
|
||||
Forms.FrmAnchor _frmAnchor;
|
||||
/// <summary>
|
||||
/// Handles the SelectSourceEvent event of the ucTime control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
void ucTime_SelectSourceEvent(object sender, EventArgs e)
|
||||
{
|
||||
if (_frmAnchor != null && !_frmAnchor.IsDisposed && _frmAnchor.Visible)
|
||||
{
|
||||
SelectedValue = sender.ToString();
|
||||
_frmAnchor.Close();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the Load event of the UCComboBox control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void UCComboBox_Load(object sender, EventArgs e)
|
||||
{
|
||||
txtInput.ForeColor = ForeColor;
|
||||
if (this._BoxStyle == ComboBoxStyle.DropDownList)
|
||||
{
|
||||
txtInput.BackColor = _BackColor;
|
||||
base.FillColor = _BackColor;
|
||||
base.RectColor = _BackColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
txtInput.BackColor = Color.White;
|
||||
base.FillColor = Color.White;
|
||||
base.RectColor = Color.FromArgb(220, 220, 220);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
120
X009/src/HZH_Controls/Controls/ComboBox/UCCombox.resx
Normal file
120
X009/src/HZH_Controls/Controls/ComboBox/UCCombox.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
73
X009/src/HZH_Controls/Controls/ComboBox/UCComboxGrid.Designer.cs
generated
Normal file
73
X009/src/HZH_Controls/Controls/ComboBox/UCComboxGrid.Designer.cs
generated
Normal file
@ -0,0 +1,73 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-28-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCComboxGrid.Designer.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCComboxGrid.
|
||||
/// Implements the <see cref="HZH_Controls.Controls.UCCombox" />
|
||||
/// </summary>
|
||||
/// <seealso cref="HZH_Controls.Controls.UCCombox" />
|
||||
partial class UCComboxGrid
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// txtInput
|
||||
//
|
||||
this.txtInput.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240)))));
|
||||
//
|
||||
// UCComboxGrid
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackColor = System.Drawing.Color.Transparent;
|
||||
this.BoxStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240)))));
|
||||
this.Name = "UCComboxGrid";
|
||||
this.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240)))));
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
229
X009/src/HZH_Controls/Controls/ComboBox/UCComboxGrid.cs
Normal file
229
X009/src/HZH_Controls/Controls/ComboBox/UCComboxGrid.cs
Normal file
@ -0,0 +1,229 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-28-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCComboxGrid.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using HZH_Controls.Controls;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCComboxGrid.
|
||||
/// Implements the <see cref="HZH_Controls.Controls.UCCombox" />
|
||||
/// </summary>
|
||||
/// <seealso cref="HZH_Controls.Controls.UCCombox" />
|
||||
public partial class UCComboxGrid : UCCombox
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// The m row type
|
||||
/// </summary>
|
||||
private Type m_rowType = typeof(UCDataGridViewRow);
|
||||
/// <summary>
|
||||
/// 表格行类型
|
||||
/// </summary>
|
||||
/// <value>The type of the grid row.</value>
|
||||
[Description("表格行类型"), Category("自定义")]
|
||||
public Type GridRowType
|
||||
{
|
||||
get { return m_rowType; }
|
||||
set
|
||||
{
|
||||
m_rowType = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The int width
|
||||
/// </summary>
|
||||
int intWidth = 0;
|
||||
|
||||
/// <summary>
|
||||
/// The m columns
|
||||
/// </summary>
|
||||
private List<DataGridViewColumnEntity> m_columns = null;
|
||||
/// <summary>
|
||||
/// 表格列
|
||||
/// </summary>
|
||||
/// <value>The grid columns.</value>
|
||||
[Description("表格列"), Category("自定义")]
|
||||
public List<DataGridViewColumnEntity> GridColumns
|
||||
{
|
||||
get { return m_columns; }
|
||||
set
|
||||
{
|
||||
m_columns = value;
|
||||
if (value != null)
|
||||
intWidth = value.Sum(p => p.WidthType == SizeType.Absolute ? p.Width : (p.Width < 80 ? 80 : p.Width));
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The m data source
|
||||
/// </summary>
|
||||
private List<object> m_dataSource = null;
|
||||
/// <summary>
|
||||
/// 表格数据源
|
||||
/// </summary>
|
||||
/// <value>The grid data source.</value>
|
||||
[Description("表格数据源"), Category("自定义")]
|
||||
public List<object> GridDataSource
|
||||
{
|
||||
get { return m_dataSource; }
|
||||
set { m_dataSource = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The m text field
|
||||
/// </summary>
|
||||
private string m_textField;
|
||||
/// <summary>
|
||||
/// 显示值字段名称
|
||||
/// </summary>
|
||||
/// <value>The text field.</value>
|
||||
[Description("显示值字段名称"), Category("自定义")]
|
||||
public string TextField
|
||||
{
|
||||
get { return m_textField; }
|
||||
set
|
||||
{
|
||||
m_textField = value;
|
||||
SetText();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 控件样式
|
||||
/// </summary>
|
||||
/// <value>The box style.</value>
|
||||
[Obsolete("不再可用的属性")]
|
||||
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private new ComboBoxStyle BoxStyle
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
/// <summary>
|
||||
/// The select source
|
||||
/// </summary>
|
||||
private object selectSource = null;
|
||||
/// <summary>
|
||||
/// 选中的数据源
|
||||
/// </summary>
|
||||
/// <value>The select source.</value>
|
||||
[Description("选中的数据源"), Category("自定义")]
|
||||
public object SelectSource
|
||||
{
|
||||
get { return selectSource; }
|
||||
set
|
||||
{
|
||||
selectSource = value;
|
||||
SetText();
|
||||
if (SelectedChangedEvent != null)
|
||||
{
|
||||
SelectedChangedEvent(value, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 选中数据源改变事件
|
||||
/// </summary>
|
||||
[Description("选中数据源改变事件"), Category("自定义")]
|
||||
public new event EventHandler SelectedChangedEvent;
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCComboxGrid" /> class.
|
||||
/// </summary>
|
||||
public UCComboxGrid()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
/// <summary>
|
||||
/// The m uc panel
|
||||
/// </summary>
|
||||
UCComboxGridPanel m_ucPanel = null;
|
||||
/// <summary>
|
||||
/// The FRM anchor
|
||||
/// </summary>
|
||||
Forms.FrmAnchor _frmAnchor;
|
||||
/// <summary>
|
||||
/// Handles the MouseDown event of the click control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
|
||||
protected override void click_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (m_columns == null || m_columns.Count <= 0)
|
||||
return;
|
||||
if (m_ucPanel == null)
|
||||
{
|
||||
var p = this.Parent.PointToScreen(this.Location);
|
||||
int intScreenHeight = Screen.PrimaryScreen.Bounds.Height;
|
||||
int intHeight = Math.Max(p.Y, intScreenHeight - p.Y - this.Height);
|
||||
intHeight -= 100;
|
||||
m_ucPanel = new UCComboxGridPanel();
|
||||
m_ucPanel.ItemClick += m_ucPanel_ItemClick;
|
||||
m_ucPanel.Height = intHeight;
|
||||
m_ucPanel.Width = intWidth;
|
||||
m_ucPanel.Columns = m_columns;
|
||||
m_ucPanel.RowType = m_rowType;
|
||||
if (m_dataSource != null && m_dataSource.Count > 0)
|
||||
{
|
||||
int _intHeight = Math.Min(140 + m_dataSource.Count * 36, m_ucPanel.Height);
|
||||
if (_intHeight <= 0)
|
||||
_intHeight = 140;
|
||||
m_ucPanel.Height = _intHeight;
|
||||
}
|
||||
}
|
||||
m_ucPanel.DataSource = m_dataSource;
|
||||
if (_frmAnchor == null || _frmAnchor.IsDisposed || _frmAnchor.Visible == false)
|
||||
{
|
||||
_frmAnchor = new Forms.FrmAnchor(this, m_ucPanel, isNotFocus: false);
|
||||
_frmAnchor.Show(this.FindForm());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the ItemClick event of the m_ucPanel control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="DataGridViewEventArgs" /> instance containing the event data.</param>
|
||||
void m_ucPanel_ItemClick(object sender, DataGridViewEventArgs e)
|
||||
{
|
||||
_frmAnchor.Hide();
|
||||
SelectSource = sender;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the text.
|
||||
/// </summary>
|
||||
private void SetText()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(m_textField) && selectSource != null)
|
||||
{
|
||||
var pro = selectSource.GetType().GetProperty(m_textField);
|
||||
if (pro != null)
|
||||
{
|
||||
TextValue = pro.GetValue(selectSource, null).ToStringExt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
120
X009/src/HZH_Controls/Controls/ComboBox/UCComboxGrid.resx
Normal file
120
X009/src/HZH_Controls/Controls/ComboBox/UCComboxGrid.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
291
X009/src/HZH_Controls/Controls/ComboBox/UCComboxGridPanel.Designer.cs
generated
Normal file
291
X009/src/HZH_Controls/Controls/ComboBox/UCComboxGridPanel.Designer.cs
generated
Normal file
@ -0,0 +1,291 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-28-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCComboxGridPanel.Designer.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCComboxGridPanel.
|
||||
/// Implements the <see cref="System.Windows.Forms.UserControl" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Windows.Forms.UserControl" />
|
||||
partial class UCComboxGridPanel
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.ucControlBase1 = new HZH_Controls.Controls.UCControlBase();
|
||||
this.ucDataGridView1 = new HZH_Controls.Controls.UCDataGridView();
|
||||
this.m_page = new HZH_Controls.Controls.UCPagerControl();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
this.txtSearch = new HZH_Controls.Controls.UCTextBoxEx();
|
||||
this.timer1 = new System.Windows.Forms.Timer(this.components);
|
||||
this.ucSplitLine_V2 = new HZH_Controls.Controls.UCSplitLine_V();
|
||||
this.ucSplitLine_V1 = new HZH_Controls.Controls.UCSplitLine_V();
|
||||
this.ucSplitLine_H2 = new HZH_Controls.Controls.UCSplitLine_H();
|
||||
this.ucSplitLine_H1 = new HZH_Controls.Controls.UCSplitLine_H();
|
||||
this.panel1.SuspendLayout();
|
||||
this.ucControlBase1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.ucControlBase1);
|
||||
this.panel1.Controls.Add(this.panel2);
|
||||
this.panel1.Controls.Add(this.txtSearch);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel1.Location = new System.Drawing.Point(1, 1);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Padding = new System.Windows.Forms.Padding(5);
|
||||
this.panel1.Size = new System.Drawing.Size(447, 333);
|
||||
this.panel1.TabIndex = 4;
|
||||
//
|
||||
// ucControlBase1
|
||||
//
|
||||
this.ucControlBase1.ConerRadius = 5;
|
||||
this.ucControlBase1.Controls.Add(this.ucDataGridView1);
|
||||
this.ucControlBase1.Controls.Add(this.m_page);
|
||||
this.ucControlBase1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ucControlBase1.FillColor = System.Drawing.Color.Transparent;
|
||||
this.ucControlBase1.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.ucControlBase1.IsRadius = false;
|
||||
this.ucControlBase1.IsShowRect = true;
|
||||
this.ucControlBase1.Location = new System.Drawing.Point(5, 62);
|
||||
this.ucControlBase1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.ucControlBase1.Name = "ucControlBase1";
|
||||
this.ucControlBase1.Padding = new System.Windows.Forms.Padding(5);
|
||||
this.ucControlBase1.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
|
||||
this.ucControlBase1.RectWidth = 1;
|
||||
this.ucControlBase1.Size = new System.Drawing.Size(437, 266);
|
||||
this.ucControlBase1.TabIndex = 2;
|
||||
this.ucControlBase1.TabStop = false;
|
||||
//
|
||||
// ucDataGridView1
|
||||
//
|
||||
this.ucDataGridView1.BackColor = System.Drawing.Color.White;
|
||||
this.ucDataGridView1.Columns = null;
|
||||
this.ucDataGridView1.DataSource = null;
|
||||
this.ucDataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ucDataGridView1.HeadFont = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.ucDataGridView1.HeadHeight = 40;
|
||||
this.ucDataGridView1.HeadPadingLeft = 0;
|
||||
this.ucDataGridView1.HeadTextColor = System.Drawing.Color.Black;
|
||||
this.ucDataGridView1.IsShowCheckBox = false;
|
||||
this.ucDataGridView1.IsShowHead = true;
|
||||
this.ucDataGridView1.Location = new System.Drawing.Point(5, 5);
|
||||
this.ucDataGridView1.Name = "ucDataGridView1";
|
||||
this.ucDataGridView1.Padding = new System.Windows.Forms.Padding(0, 40, 0, 0);
|
||||
this.ucDataGridView1.RowHeight = 30;
|
||||
this.ucDataGridView1.RowType = typeof(HZH_Controls.Controls.UCDataGridViewRow);
|
||||
this.ucDataGridView1.Size = new System.Drawing.Size(427, 223);
|
||||
this.ucDataGridView1.TabIndex = 0;
|
||||
this.ucDataGridView1.TabStop = false;
|
||||
//
|
||||
// m_page
|
||||
//
|
||||
this.m_page.DataSource = null;
|
||||
this.m_page.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.m_page.Location = new System.Drawing.Point(5, 228);
|
||||
this.m_page.Name = "m_page";
|
||||
this.m_page.PageCount = 0;
|
||||
this.m_page.PageIndex = 1;
|
||||
this.m_page.PageModel = HZH_Controls.Controls.PageModel.Soure;
|
||||
this.m_page.PageSize = 10;
|
||||
this.m_page.Size = new System.Drawing.Size(427, 33);
|
||||
this.m_page.StartIndex = 0;
|
||||
this.m_page.TabIndex = 1;
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel2.Location = new System.Drawing.Point(5, 47);
|
||||
this.panel2.Name = "panel2";
|
||||
this.panel2.Size = new System.Drawing.Size(437, 15);
|
||||
this.panel2.TabIndex = 1;
|
||||
//
|
||||
// txtSearch
|
||||
//
|
||||
this.txtSearch.BackColor = System.Drawing.Color.Transparent;
|
||||
this.txtSearch.ConerRadius = 5;
|
||||
this.txtSearch.Cursor = System.Windows.Forms.Cursors.IBeam;
|
||||
this.txtSearch.DecLength = 2;
|
||||
this.txtSearch.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.txtSearch.FillColor = System.Drawing.Color.Empty;
|
||||
this.txtSearch.FocusBorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
|
||||
this.txtSearch.Font = new System.Drawing.Font("微软雅黑", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.txtSearch.InputText = "";
|
||||
this.txtSearch.InputType = HZH_Controls.TextInputType.NotControl;
|
||||
this.txtSearch.IsFocusColor = true;
|
||||
this.txtSearch.IsRadius = true;
|
||||
this.txtSearch.IsShowClearBtn = true;
|
||||
this.txtSearch.IsShowKeyboard = false;
|
||||
this.txtSearch.IsShowRect = true;
|
||||
this.txtSearch.IsShowSearchBtn = false;
|
||||
this.txtSearch.KeyBoardType = HZH_Controls.Controls.KeyBoardType.UCKeyBorderAll_EN;
|
||||
this.txtSearch.Location = new System.Drawing.Point(5, 5);
|
||||
this.txtSearch.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.txtSearch.MaxValue = new decimal(new int[] {
|
||||
1000000,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.txtSearch.MinValue = new decimal(new int[] {
|
||||
1000000,
|
||||
0,
|
||||
0,
|
||||
-2147483648});
|
||||
this.txtSearch.Name = "txtSearch";
|
||||
this.txtSearch.Padding = new System.Windows.Forms.Padding(5);
|
||||
this.txtSearch.PromptColor = System.Drawing.Color.Gray;
|
||||
this.txtSearch.PromptFont = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.txtSearch.PromptText = "输入内容模糊搜索";
|
||||
this.txtSearch.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
|
||||
this.txtSearch.RectWidth = 1;
|
||||
this.txtSearch.RegexPattern = "";
|
||||
this.txtSearch.Size = new System.Drawing.Size(437, 42);
|
||||
this.txtSearch.TabIndex = 0;
|
||||
//
|
||||
// timer1
|
||||
//
|
||||
this.timer1.Interval = 1000;
|
||||
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
|
||||
//
|
||||
// ucSplitLine_V2
|
||||
//
|
||||
this.ucSplitLine_V2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(232)))), ((int)(((byte)(232)))));
|
||||
this.ucSplitLine_V2.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.ucSplitLine_V2.Location = new System.Drawing.Point(448, 1);
|
||||
this.ucSplitLine_V2.Name = "ucSplitLine_V2";
|
||||
this.ucSplitLine_V2.Size = new System.Drawing.Size(1, 333);
|
||||
this.ucSplitLine_V2.TabIndex = 3;
|
||||
this.ucSplitLine_V2.TabStop = false;
|
||||
//
|
||||
// ucSplitLine_V1
|
||||
//
|
||||
this.ucSplitLine_V1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(232)))), ((int)(((byte)(232)))));
|
||||
this.ucSplitLine_V1.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.ucSplitLine_V1.Location = new System.Drawing.Point(0, 1);
|
||||
this.ucSplitLine_V1.Name = "ucSplitLine_V1";
|
||||
this.ucSplitLine_V1.Size = new System.Drawing.Size(1, 333);
|
||||
this.ucSplitLine_V1.TabIndex = 2;
|
||||
this.ucSplitLine_V1.TabStop = false;
|
||||
//
|
||||
// ucSplitLine_H2
|
||||
//
|
||||
this.ucSplitLine_H2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(232)))), ((int)(((byte)(232)))));
|
||||
this.ucSplitLine_H2.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.ucSplitLine_H2.Location = new System.Drawing.Point(0, 334);
|
||||
this.ucSplitLine_H2.Name = "ucSplitLine_H2";
|
||||
this.ucSplitLine_H2.Size = new System.Drawing.Size(449, 1);
|
||||
this.ucSplitLine_H2.TabIndex = 1;
|
||||
this.ucSplitLine_H2.TabStop = false;
|
||||
//
|
||||
// ucSplitLine_H1
|
||||
//
|
||||
this.ucSplitLine_H1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(232)))), ((int)(((byte)(232)))));
|
||||
this.ucSplitLine_H1.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.ucSplitLine_H1.Location = new System.Drawing.Point(0, 0);
|
||||
this.ucSplitLine_H1.Name = "ucSplitLine_H1";
|
||||
this.ucSplitLine_H1.Size = new System.Drawing.Size(449, 1);
|
||||
this.ucSplitLine_H1.TabIndex = 0;
|
||||
this.ucSplitLine_H1.TabStop = false;
|
||||
//
|
||||
// UCComboxGridPanel
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Controls.Add(this.ucSplitLine_V2);
|
||||
this.Controls.Add(this.ucSplitLine_V1);
|
||||
this.Controls.Add(this.ucSplitLine_H2);
|
||||
this.Controls.Add(this.ucSplitLine_H1);
|
||||
this.Name = "UCComboxGridPanel";
|
||||
this.Size = new System.Drawing.Size(449, 335);
|
||||
this.Load += new System.EventHandler(this.UCComboxGridPanel_Load);
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.ucControlBase1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// The uc split line h1
|
||||
/// </summary>
|
||||
private UCSplitLine_H ucSplitLine_H1;
|
||||
/// <summary>
|
||||
/// The uc split line h2
|
||||
/// </summary>
|
||||
private UCSplitLine_H ucSplitLine_H2;
|
||||
/// <summary>
|
||||
/// The uc split line v1
|
||||
/// </summary>
|
||||
private UCSplitLine_V ucSplitLine_V1;
|
||||
/// <summary>
|
||||
/// The uc split line v2
|
||||
/// </summary>
|
||||
private UCSplitLine_V ucSplitLine_V2;
|
||||
/// <summary>
|
||||
/// The panel1
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
/// <summary>
|
||||
/// The uc control base1
|
||||
/// </summary>
|
||||
private UCControlBase ucControlBase1;
|
||||
/// <summary>
|
||||
/// The uc data grid view1
|
||||
/// </summary>
|
||||
private UCDataGridView ucDataGridView1;
|
||||
/// <summary>
|
||||
/// The panel2
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Panel panel2;
|
||||
/// <summary>
|
||||
/// The timer1
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Timer timer1;
|
||||
/// <summary>
|
||||
/// The text search
|
||||
/// </summary>
|
||||
private UCTextBoxEx txtSearch;
|
||||
private UCPagerControl m_page;
|
||||
}
|
||||
}
|
206
X009/src/HZH_Controls/Controls/ComboBox/UCComboxGridPanel.cs
Normal file
206
X009/src/HZH_Controls/Controls/ComboBox/UCComboxGridPanel.cs
Normal file
@ -0,0 +1,206 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-28-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCComboxGridPanel.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCComboxGridPanel.
|
||||
/// Implements the <see cref="System.Windows.Forms.UserControl" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Windows.Forms.UserControl" />
|
||||
[ToolboxItem(false)]
|
||||
public partial class UCComboxGridPanel : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// 项点击事件
|
||||
/// </summary>
|
||||
[Description("项点击事件"), Category("自定义")]
|
||||
public event DataGridViewEventHandler ItemClick;
|
||||
/// <summary>
|
||||
/// The m row type
|
||||
/// </summary>
|
||||
private Type m_rowType = typeof(UCDataGridViewRow);
|
||||
/// <summary>
|
||||
/// 行类型
|
||||
/// </summary>
|
||||
/// <value>The type of the row.</value>
|
||||
[Description("行类型"), Category("自定义")]
|
||||
public Type RowType
|
||||
{
|
||||
get { return m_rowType; }
|
||||
set
|
||||
{
|
||||
m_rowType = value;
|
||||
this.ucDataGridView1.RowType = m_rowType;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The m columns
|
||||
/// </summary>
|
||||
private List<DataGridViewColumnEntity> m_columns = null;
|
||||
/// <summary>
|
||||
/// 列
|
||||
/// </summary>
|
||||
/// <value>The columns.</value>
|
||||
[Description("列"), Category("自定义")]
|
||||
public List<DataGridViewColumnEntity> Columns
|
||||
{
|
||||
get { return m_columns; }
|
||||
set
|
||||
{
|
||||
m_columns = value;
|
||||
this.ucDataGridView1.Columns = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The m data source
|
||||
/// </summary>
|
||||
private List<object> m_dataSource = null;
|
||||
/// <summary>
|
||||
/// 数据源
|
||||
/// </summary>
|
||||
/// <value>The data source.</value>
|
||||
[Description("数据源"), Category("自定义")]
|
||||
public List<object> DataSource
|
||||
{
|
||||
get { return m_dataSource; }
|
||||
set
|
||||
{
|
||||
if (m_dataSource != value)
|
||||
{
|
||||
m_dataSource = value;
|
||||
m_page.DataSource = m_dataSource;
|
||||
this.ucDataGridView1.DataSource = m_page.GetCurrentSource();
|
||||
if (m_page.PageCount <= 1)
|
||||
m_page.Visible = false;
|
||||
else
|
||||
m_page.Visible = true;
|
||||
}
|
||||
else
|
||||
m_dataSource = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The string last search text
|
||||
/// </summary>
|
||||
private string strLastSearchText = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCComboxGridPanel" /> class.
|
||||
/// </summary>
|
||||
public UCComboxGridPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.txtSearch.txtInput.TextChanged += txtInput_TextChanged;
|
||||
this.ucDataGridView1.ItemClick += ucDataGridView1_ItemClick;
|
||||
m_page.ShowSourceChanged += m_page_ShowSourceChanged;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Handles the ItemClick event of the ucDataGridView1 control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="DataGridViewEventArgs" /> instance containing the event data.</param>
|
||||
void ucDataGridView1_ItemClick(object sender, DataGridViewEventArgs e)
|
||||
{
|
||||
if (ItemClick != null)
|
||||
{
|
||||
ItemClick((sender as IDataGridViewRow).DataSource, null);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the TextChanged event of the txtInput control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
void txtInput_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
timer1.Enabled = false;
|
||||
timer1.Enabled = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the Load event of the UCComboxGridPanel control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void UCComboxGridPanel_Load(object sender, EventArgs e)
|
||||
{
|
||||
m_page.DataSource = m_dataSource;
|
||||
this.ucDataGridView1.DataSource = m_page.GetCurrentSource();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the Tick event of the timer1 control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void timer1_Tick(object sender, EventArgs e)
|
||||
{
|
||||
if (strLastSearchText == txtSearch.InputText)
|
||||
{
|
||||
timer1.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
strLastSearchText = txtSearch.InputText;
|
||||
Search(txtSearch.InputText);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Searches the specified string text.
|
||||
/// </summary>
|
||||
/// <param name="strText">The string text.</param>
|
||||
private void Search(string strText)
|
||||
{
|
||||
m_page.StartIndex = 0;
|
||||
if (!string.IsNullOrEmpty(strText))
|
||||
{
|
||||
strText = strText.ToLower().Trim();
|
||||
List<object> lst = m_dataSource.FindAll(p => m_columns.Any(c => (c.Format == null ? (p.GetType().GetProperty(c.DataField).GetValue(p, null).ToStringExt()) : c.Format(p.GetType().GetProperty(c.DataField).GetValue(p, null))).ToLower().Contains(strText)));
|
||||
m_page.DataSource = lst;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_page.DataSource = m_dataSource;
|
||||
}
|
||||
m_page.Reload();
|
||||
if (m_page.PageCount <= 1)
|
||||
m_page.Visible = false;
|
||||
else
|
||||
m_page.Visible = true;
|
||||
}
|
||||
|
||||
void m_page_ShowSourceChanged(object currentSource)
|
||||
{
|
||||
this.ucDataGridView1.DataSource = currentSource;
|
||||
}
|
||||
}
|
||||
}
|
123
X009/src/HZH_Controls/Controls/ComboBox/UCComboxGridPanel.resx
Normal file
123
X009/src/HZH_Controls/Controls/ComboBox/UCComboxGridPanel.resx
Normal file
@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
@ -0,0 +1,45 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-09-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="DataGridViewCellEntity.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class DataGridViewCellEntity.
|
||||
/// </summary>
|
||||
public class DataGridViewCellEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the title.
|
||||
/// </summary>
|
||||
/// <value>The title.</value>
|
||||
public string Title { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the width.
|
||||
/// </summary>
|
||||
/// <value>The width.</value>
|
||||
public int Width { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the type of the width.
|
||||
/// </summary>
|
||||
/// <value>The type of the width.</value>
|
||||
public System.Windows.Forms.SizeType WidthType { get; set; }
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-09-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="DataGridViewCellEventArgs.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class DataGridViewEventArgs.
|
||||
/// Implements the <see cref="System.EventArgs" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.EventArgs" />
|
||||
public class DataGridViewEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the cell control.
|
||||
/// </summary>
|
||||
/// <value>The cell control.</value>
|
||||
public Control CellControl { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the index of the cell.
|
||||
/// </summary>
|
||||
/// <value>The index of the cell.</value>
|
||||
public int CellIndex { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the index of the row.
|
||||
/// </summary>
|
||||
/// <value>The index of the row.</value>
|
||||
public int RowIndex { get; set; }
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-09-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="DataGridViewCellEventHandler.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Delegate DataGridViewEventHandler
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender.</param>
|
||||
/// <param name="e">The <see cref="DataGridViewEventArgs" /> instance containing the event data.</param>
|
||||
[Serializable]
|
||||
[ComVisible(true)]
|
||||
public delegate void DataGridViewEventHandler(object sender, DataGridViewEventArgs e);
|
||||
|
||||
/// <summary>
|
||||
/// Delegate DataGridViewRowCustomEventHandler
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender.</param>
|
||||
/// <param name="e">The <see cref="DataGridViewRowCustomEventArgs" /> instance containing the event data.</param>
|
||||
[Serializable]
|
||||
[ComVisible(true)]
|
||||
public delegate void DataGridViewRowCustomEventHandler(object sender, DataGridViewRowCustomEventArgs e);
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-09-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="DataGridViewColumnEntity.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class DataGridViewColumnEntity.
|
||||
/// </summary>
|
||||
public class DataGridViewColumnEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the head text.
|
||||
/// </summary>
|
||||
/// <value>The head text.</value>
|
||||
public string HeadText { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the width.
|
||||
/// </summary>
|
||||
/// <value>The width.</value>
|
||||
public int Width { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the type of the width.
|
||||
/// </summary>
|
||||
/// <value>The type of the width.</value>
|
||||
public System.Windows.Forms.SizeType WidthType { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the data field.
|
||||
/// </summary>
|
||||
/// <value>The data field.</value>
|
||||
public string DataField { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the format.
|
||||
/// </summary>
|
||||
/// <value>The format.</value>
|
||||
public Func<object, string> Format { get; set; }
|
||||
/// <summary>
|
||||
/// The text align
|
||||
/// </summary>
|
||||
private ContentAlignment _TextAlign = ContentAlignment.MiddleCenter;
|
||||
/// <summary>
|
||||
/// Gets or sets the text align.
|
||||
/// </summary>
|
||||
/// <value>The text align.</value>
|
||||
public ContentAlignment TextAlign { get { return _TextAlign; } set { _TextAlign = value; } }
|
||||
/// <summary>
|
||||
/// 自定义的单元格控件,一个实现IDataGridViewCustomCell的Control
|
||||
/// </summary>
|
||||
/// <value>The custom cell.</value>
|
||||
private Type customCellType = null;
|
||||
public Type CustomCellType
|
||||
{
|
||||
get
|
||||
{
|
||||
return customCellType;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!typeof(IDataGridViewCustomCell).IsAssignableFrom(value) || !value.IsSubclassOf(typeof(System.Windows.Forms.Control)))
|
||||
throw new Exception("行控件没有实现IDataGridViewCustomCell接口");
|
||||
customCellType = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-27-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="DataGridViewRowCustomEventArgs.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class DataGridViewRowCustomEventArgs.
|
||||
/// Implements the <see cref="System.EventArgs" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.EventArgs" />
|
||||
public class DataGridViewRowCustomEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the event.
|
||||
/// </summary>
|
||||
/// <value>The name of the event.</value>
|
||||
public string EventName { get; set; }
|
||||
|
||||
public object Data { get; set; }
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
public interface IDataGridViewCustomCell
|
||||
{
|
||||
/// <summary>
|
||||
/// 绑定行关联的数据
|
||||
/// </summary>
|
||||
/// <param name="obj">The object.</param>
|
||||
void SetBindSource(object obj);
|
||||
/// <summary>
|
||||
/// 自定义事件传递,用于单元格向行中传递此事件
|
||||
/// </summary>
|
||||
event DataGridViewRowCustomEventHandler RowCustomEvent;
|
||||
/// <summary>
|
||||
/// 关联数据源
|
||||
/// </summary>
|
||||
object DataSource { get; }
|
||||
}
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-09-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="IDataGridViewRow.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface IDataGridViewRow
|
||||
/// </summary>
|
||||
public interface IDataGridViewRow
|
||||
{
|
||||
/// <summary>
|
||||
/// Occurs when [row custom event].
|
||||
/// </summary>
|
||||
event DataGridViewRowCustomEventHandler RowCustomEvent;
|
||||
/// <summary>
|
||||
/// CheckBox选中事件
|
||||
/// </summary>
|
||||
event DataGridViewEventHandler CheckBoxChangeEvent;
|
||||
/// <summary>
|
||||
/// 点击单元格事件
|
||||
/// </summary>
|
||||
event DataGridViewEventHandler CellClick;
|
||||
/// <summary>
|
||||
/// 数据源改变事件
|
||||
/// </summary>
|
||||
event DataGridViewEventHandler SourceChanged;
|
||||
/// <summary>
|
||||
/// 列参数,用于创建列数和宽度
|
||||
/// </summary>
|
||||
/// <value>The columns.</value>
|
||||
List<DataGridViewColumnEntity> Columns { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this instance is show CheckBox.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is show CheckBox; otherwise, <c>false</c>.</value>
|
||||
bool IsShowCheckBox { get; set; }
|
||||
/// <summary>
|
||||
/// 是否选中
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is checked; otherwise, <c>false</c>.</value>
|
||||
bool IsChecked { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据源
|
||||
/// </summary>
|
||||
/// <value>The data source.</value>
|
||||
object DataSource { get; set; }
|
||||
/// <summary>
|
||||
/// 添加单元格元素,仅做添加控件操作,不做数据绑定,数据绑定使用BindingCells
|
||||
/// </summary>
|
||||
void ReloadCells();
|
||||
/// <summary>
|
||||
/// 绑定数据到Cell
|
||||
/// </summary>
|
||||
/// <returns>返回true则表示已处理过,否则将进行默认绑定(通常只针对有Text值的控件)</returns>
|
||||
void BindingCellData();
|
||||
/// <summary>
|
||||
/// 设置选中状态,通常为设置颜色即可
|
||||
/// </summary>
|
||||
/// <param name="blnSelected">是否选中</param>
|
||||
void SetSelect(bool blnSelected);
|
||||
/// <summary>
|
||||
/// 行高
|
||||
/// </summary>
|
||||
/// <value>The height of the row.</value>
|
||||
int RowHeight { get; set; }
|
||||
/// <summary>
|
||||
/// 行号
|
||||
/// </summary>
|
||||
/// <value>The Index of the row.</value>
|
||||
int RowIndex { get; set; }
|
||||
}
|
||||
}
|
147
X009/src/HZH_Controls/Controls/DataGridView/UCDataGridView.Designer.cs
generated
Normal file
147
X009/src/HZH_Controls/Controls/DataGridView/UCDataGridView.Designer.cs
generated
Normal file
@ -0,0 +1,147 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-09-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCDataGridView.Designer.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCDataGridView.
|
||||
/// Implements the <see cref="System.Windows.Forms.UserControl" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Windows.Forms.UserControl" />
|
||||
partial class UCDataGridView
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.panHead = new System.Windows.Forms.Panel();
|
||||
this.panColumns = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.panHeadLeft = new System.Windows.Forms.Panel();
|
||||
this.panRow = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.ucSplitLine_H1 = new HZH_Controls.Controls.UCSplitLine_H();
|
||||
this.panHead.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panHead
|
||||
//
|
||||
this.panHead.Controls.Add(this.panColumns);
|
||||
this.panHead.Controls.Add(this.panHeadLeft);
|
||||
this.panHead.Controls.Add(this.ucSplitLine_H1);
|
||||
this.panHead.Location = new System.Drawing.Point(0, 0);
|
||||
this.panHead.Name = "panHead";
|
||||
this.panHead.Size = new System.Drawing.Size(1061, 40);
|
||||
this.panHead.TabIndex = 0;
|
||||
//
|
||||
// panColumns
|
||||
//
|
||||
this.panColumns.ColumnCount = 1;
|
||||
this.panColumns.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.panColumns.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panColumns.Location = new System.Drawing.Point(0, 0);
|
||||
this.panColumns.Name = "panColumns";
|
||||
this.panColumns.RowCount = 1;
|
||||
this.panColumns.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.panColumns.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.panColumns.Size = new System.Drawing.Size(1061, 39);
|
||||
this.panColumns.TabIndex = 1;
|
||||
//
|
||||
// panHeadLeft
|
||||
//
|
||||
this.panHeadLeft.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.panHeadLeft.Location = new System.Drawing.Point(0, 0);
|
||||
this.panHeadLeft.Name = "panHeadLeft";
|
||||
this.panHeadLeft.Size = new System.Drawing.Size(0, 39);
|
||||
this.panHeadLeft.TabIndex = 2;
|
||||
//
|
||||
// panRow
|
||||
//
|
||||
this.panRow.AutoScroll = true;
|
||||
this.panRow.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panRow.Location = new System.Drawing.Point(0, 40);
|
||||
this.panRow.Name = "panRow";
|
||||
this.panRow.Size = new System.Drawing.Size(317, 225);
|
||||
this.panRow.TabIndex = 1;
|
||||
this.panRow.Scroll += new System.Windows.Forms.ScrollEventHandler(this.panRow_Scroll);
|
||||
//
|
||||
// ucSplitLine_H1
|
||||
//
|
||||
this.ucSplitLine_H1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(232)))), ((int)(((byte)(232)))));
|
||||
this.ucSplitLine_H1.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.ucSplitLine_H1.Location = new System.Drawing.Point(0, 39);
|
||||
this.ucSplitLine_H1.Name = "ucSplitLine_H1";
|
||||
this.ucSplitLine_H1.Size = new System.Drawing.Size(1061, 1);
|
||||
this.ucSplitLine_H1.TabIndex = 0;
|
||||
this.ucSplitLine_H1.TabStop = false;
|
||||
//
|
||||
// UCDataGridView
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.Controls.Add(this.panRow);
|
||||
this.Controls.Add(this.panHead);
|
||||
this.Name = "UCDataGridView";
|
||||
this.Padding = new System.Windows.Forms.Padding(0, 40, 0, 0);
|
||||
this.Size = new System.Drawing.Size(317, 265);
|
||||
this.Scroll += new System.Windows.Forms.ScrollEventHandler(this.UCDataGridView_Scroll);
|
||||
this.SizeChanged += new System.EventHandler(this.UCDataGridView_SizeChanged);
|
||||
this.panHead.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// The pan head
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Panel panHead;
|
||||
/// <summary>
|
||||
/// The pan columns
|
||||
/// </summary>
|
||||
private System.Windows.Forms.TableLayoutPanel panColumns;
|
||||
/// <summary>
|
||||
/// The uc split line h1
|
||||
/// </summary>
|
||||
private UCSplitLine_H ucSplitLine_H1;
|
||||
/// <summary>
|
||||
/// The pan head left
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Panel panHeadLeft;
|
||||
private System.Windows.Forms.FlowLayoutPanel panRow;
|
||||
|
||||
}
|
||||
}
|
815
X009/src/HZH_Controls/Controls/DataGridView/UCDataGridView.cs
Normal file
815
X009/src/HZH_Controls/Controls/DataGridView/UCDataGridView.cs
Normal file
@ -0,0 +1,815 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-09-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCDataGridView.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Collections;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCDataGridView.
|
||||
/// Implements the <see cref="System.Windows.Forms.UserControl" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Windows.Forms.UserControl" />
|
||||
public partial class UCDataGridView : UserControl
|
||||
{
|
||||
#region 属性
|
||||
/// <summary>
|
||||
/// The m head pading left
|
||||
/// </summary>
|
||||
private int m_headPadingLeft = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the head pading left.
|
||||
/// </summary>
|
||||
/// <value>The head pading left.</value>
|
||||
[Description("标题左侧间距"), Category("自定义")]
|
||||
public int HeadPadingLeft
|
||||
{
|
||||
get { return m_headPadingLeft; }
|
||||
set
|
||||
{
|
||||
m_headPadingLeft = value;
|
||||
this.panHeadLeft.Width = m_headPadingLeft;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The m head font
|
||||
/// </summary>
|
||||
private Font m_headFont = new Font("微软雅黑", 12F);
|
||||
/// <summary>
|
||||
/// 标题字体
|
||||
/// </summary>
|
||||
/// <value>The head font.</value>
|
||||
[Description("标题字体"), Category("自定义")]
|
||||
public Font HeadFont
|
||||
{
|
||||
get { return m_headFont; }
|
||||
set { m_headFont = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The m head text color
|
||||
/// </summary>
|
||||
private Color m_headTextColor = Color.Black;
|
||||
/// <summary>
|
||||
/// 标题字体颜色
|
||||
/// </summary>
|
||||
/// <value>The color of the head text.</value>
|
||||
[Description("标题文字颜色"), Category("自定义")]
|
||||
public Color HeadTextColor
|
||||
{
|
||||
get { return m_headTextColor; }
|
||||
set { m_headTextColor = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The m is show head
|
||||
/// </summary>
|
||||
private bool m_isShowHead = true;
|
||||
/// <summary>
|
||||
/// 是否显示标题
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is show head; otherwise, <c>false</c>.</value>
|
||||
[Description("是否显示标题"), Category("自定义")]
|
||||
public bool IsShowHead
|
||||
{
|
||||
get { return m_isShowHead; }
|
||||
set
|
||||
{
|
||||
if (m_isShowHead != value)
|
||||
{
|
||||
m_isShowHead = value;
|
||||
panHead.Visible = value;
|
||||
if (value)
|
||||
{
|
||||
this.panRow.Location = new Point(0, panHead.Height);
|
||||
this.panRow.Height = this.panRow.Height - panHead.Height;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.panRow.Location = new Point(0, 0);
|
||||
this.panRow.Height = this.panRow.Height + panHead.Height;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The m head height
|
||||
/// </summary>
|
||||
private int m_headHeight = 40;
|
||||
/// <summary>
|
||||
/// 标题高度
|
||||
/// </summary>
|
||||
/// <value>The height of the head.</value>
|
||||
[Description("标题高度"), Category("自定义")]
|
||||
public int HeadHeight
|
||||
{
|
||||
get { return m_headHeight; }
|
||||
set
|
||||
{
|
||||
m_headHeight = value;
|
||||
panHead.Height = value;
|
||||
this.Padding = new Padding(0, value, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The m is show CheckBox
|
||||
/// </summary>
|
||||
private bool m_isShowCheckBox = false;
|
||||
/// <summary>
|
||||
/// 是否显示复选框
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is show CheckBox; otherwise, <c>false</c>.</value>
|
||||
[Description("是否显示选择框"), Category("自定义")]
|
||||
public bool IsShowCheckBox
|
||||
{
|
||||
get { return m_isShowCheckBox; }
|
||||
set
|
||||
{
|
||||
if (value != m_isShowCheckBox)
|
||||
{
|
||||
m_isShowCheckBox = value;
|
||||
LoadColumns();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The m row height
|
||||
/// </summary>
|
||||
private int m_rowHeight = 40;
|
||||
/// <summary>
|
||||
/// 行高
|
||||
/// </summary>
|
||||
/// <value>The height of the row.</value>
|
||||
[Description("数据行高"), Category("自定义")]
|
||||
public int RowHeight
|
||||
{
|
||||
get { return m_rowHeight; }
|
||||
set { m_rowHeight = value; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the show count.
|
||||
/// </summary>
|
||||
/// <value>The show count.</value>
|
||||
[Description("当前高度可显示行个数"), Category("自定义")]
|
||||
public int ShowCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.panRow.Height / (m_rowHeight);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The m columns
|
||||
/// </summary>
|
||||
private List<DataGridViewColumnEntity> m_columns = null;
|
||||
/// <summary>
|
||||
/// 列
|
||||
/// </summary>
|
||||
/// <value>The columns.</value>
|
||||
[Description("列"), Category("自定义")]
|
||||
public List<DataGridViewColumnEntity> Columns
|
||||
{
|
||||
get { return m_columns; }
|
||||
set
|
||||
{
|
||||
m_columns = value;
|
||||
LoadColumns();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The m data source
|
||||
/// </summary>
|
||||
private object m_dataSource = null;
|
||||
/// <summary>
|
||||
/// 数据源,支持列表或table,如果使用翻页控件,请使用翻页控件的DataSource
|
||||
/// </summary>
|
||||
/// <value>The data source.</value>
|
||||
/// <exception cref="Exception">数据源不是有效的数据类型,请使用Datatable或列表</exception>
|
||||
/// <exception cref="System.Exception">数据源不是有效的数据类型,请使用Datatable或列表</exception>
|
||||
[Description("数据源,支持列表或table,如果使用翻页控件,请使用翻页控件的DataSource"), Category("自定义")]
|
||||
public object DataSource
|
||||
{
|
||||
get { return m_dataSource; }
|
||||
set
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
if (!(value is DataTable) && (!typeof(IList).IsAssignableFrom(value.GetType())))
|
||||
{
|
||||
throw new Exception("数据源不是有效的数据类型,请使用Datatable或列表");
|
||||
}
|
||||
}
|
||||
m_dataSource = value;
|
||||
if (m_columns != null && m_columns.Count > 0)
|
||||
{
|
||||
ReloadSource();
|
||||
}
|
||||
if (BindingSourceEvent != null)
|
||||
{
|
||||
BindingSourceEvent(this, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the rows.
|
||||
/// </summary>
|
||||
/// <value>The rows.</value>
|
||||
public List<IDataGridViewRow> Rows { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The m row type
|
||||
/// </summary>
|
||||
private Type m_rowType = typeof(UCDataGridViewRow);
|
||||
/// <summary>
|
||||
/// 行元素类型,默认UCDataGridViewItem
|
||||
/// </summary>
|
||||
/// <value>The type of the row.</value>
|
||||
/// <exception cref="Exception">行控件没有实现IDataGridViewRow接口</exception>
|
||||
/// <exception cref="System.Exception">行控件没有实现IDataGridViewRow接口</exception>
|
||||
[Description("行控件类型,默认UCDataGridViewRow,如果不满足请自定义行控件实现接口IDataGridViewRow"), Category("自定义")]
|
||||
public Type RowType
|
||||
{
|
||||
get { return m_rowType; }
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
return;
|
||||
if (!typeof(IDataGridViewRow).IsAssignableFrom(value) || !value.IsSubclassOf(typeof(Control)))
|
||||
throw new Exception("行控件没有实现IDataGridViewRow接口");
|
||||
m_rowType = value;
|
||||
if (m_columns != null && m_columns.Count > 0)
|
||||
ReloadSource();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The m select row
|
||||
/// </summary>
|
||||
IDataGridViewRow m_selectRow = null;
|
||||
/// <summary>
|
||||
/// 选中的节点
|
||||
/// </summary>
|
||||
/// <value>The select row.</value>
|
||||
[Description("选中行"), Category("自定义")]
|
||||
public IDataGridViewRow SelectRow
|
||||
{
|
||||
get { return m_selectRow; }
|
||||
private set { m_selectRow = value; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 选中的行,如果显示CheckBox,则以CheckBox选中为准
|
||||
/// </summary>
|
||||
/// <value>The select rows.</value>
|
||||
[Description("选中的行,如果显示CheckBox,则以CheckBox选中为准"), Category("自定义")]
|
||||
public List<IDataGridViewRow> SelectRows
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetSelectRows();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the select rows.
|
||||
/// </summary>
|
||||
/// <returns>List<IDataGridViewRow>.</returns>
|
||||
private List<IDataGridViewRow> GetSelectRows()
|
||||
{
|
||||
List<IDataGridViewRow> lst = new List<IDataGridViewRow>();
|
||||
if (m_isShowCheckBox)
|
||||
{
|
||||
if (Rows != null && Rows.Count > 0)
|
||||
lst.AddRange(Rows.FindAll(p => p.IsChecked));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_selectRow != null)
|
||||
lst.AddRange(new List<IDataGridViewRow>() { m_selectRow });
|
||||
}
|
||||
if (Rows != null && Rows.Count > 0 && m_rowType == typeof(UCDataGridViewTreeRow))
|
||||
{
|
||||
foreach (UCDataGridViewTreeRow row in Rows)
|
||||
{
|
||||
lst.AddRange(FindTreeRowSelected(row));
|
||||
}
|
||||
}
|
||||
return lst;
|
||||
}
|
||||
|
||||
private List<IDataGridViewRow> FindTreeRowSelected(UCDataGridViewTreeRow row)
|
||||
{
|
||||
List<IDataGridViewRow> lst = new List<IDataGridViewRow>();
|
||||
var _lst = row.ChildrenRows.FindAll(p => p.IsChecked);
|
||||
lst.AddRange(_lst);
|
||||
foreach (UCDataGridViewTreeRow _row in row.ChildrenRows)
|
||||
{
|
||||
lst.AddRange(FindTreeRowSelected(_row));
|
||||
}
|
||||
return lst;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finds the child grid.
|
||||
/// </summary>
|
||||
/// <param name="c">The c.</param>
|
||||
/// <returns>UCDataGridView.</returns>
|
||||
private UCDataGridView FindChildGrid(Control c)
|
||||
{
|
||||
foreach (Control item in c.Controls)
|
||||
{
|
||||
if (item is UCDataGridView)
|
||||
return item as UCDataGridView;
|
||||
else if (item.Controls.Count > 0)
|
||||
{
|
||||
var grid = FindChildGrid(item);
|
||||
if (grid != null)
|
||||
return grid;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
[Bindable(false)]
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public override bool AutoScroll
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.AutoScroll;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.AutoScroll = value;
|
||||
}
|
||||
}
|
||||
#region 事件
|
||||
/// <summary>
|
||||
/// The head CheckBox change event
|
||||
/// </summary>
|
||||
[Description("选中标题选择框事件"), Category("自定义")]
|
||||
public EventHandler HeadCheckBoxChangeEvent;
|
||||
/// <summary>
|
||||
/// The head column click event
|
||||
/// </summary>
|
||||
[Description("标题点击事件"), Category("自定义")]
|
||||
public EventHandler HeadColumnClickEvent;
|
||||
/// <summary>
|
||||
/// Occurs when [item click].
|
||||
/// </summary>
|
||||
[Description("项点击事件"), Category("自定义")]
|
||||
public event DataGridViewEventHandler ItemClick;
|
||||
/// <summary>
|
||||
/// Occurs when [source changed].
|
||||
/// </summary>
|
||||
[Description("行数据源改变事件"), Category("自定义")]
|
||||
public event DataGridViewEventHandler RowSourceChangedEvent;
|
||||
/// <summary>
|
||||
/// Occurs when [row custom event].
|
||||
/// </summary>
|
||||
[Description("预留的自定义的事件,比如你需要在行上放置删改等按钮时,可以通过此事件传递出来"), Category("自定义")]
|
||||
public event DataGridViewRowCustomEventHandler RowCustomEvent;
|
||||
[Description("绑定数据源后事件"), Category("自定义")]
|
||||
public event EventHandler BindingSourceEvent;
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCDataGridView" /> class.
|
||||
/// </summary>
|
||||
public UCDataGridView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
#region 私有方法
|
||||
#region 加载column
|
||||
/// <summary>
|
||||
/// 功能描述:加载column
|
||||
/// 作 者:HZH
|
||||
/// 创建日期:2019-08-08 17:51:50
|
||||
/// 任务编号:POS
|
||||
/// </summary>
|
||||
private void LoadColumns()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (DesignMode)
|
||||
{ return; }
|
||||
|
||||
ControlHelper.FreezeControl(this.panHead, true);
|
||||
|
||||
this.panRow.Controls.Clear();
|
||||
this.panColumns.Controls.Clear();
|
||||
this.panColumns.ColumnStyles.Clear();
|
||||
|
||||
|
||||
if (m_columns != null && m_columns.Count() > 0)
|
||||
{
|
||||
int _width = 0;
|
||||
m_columns.ForEach(p =>
|
||||
{
|
||||
if (p.WidthType == SizeType.Absolute)
|
||||
{
|
||||
_width += p.Width;
|
||||
}
|
||||
else if (p.WidthType == SizeType.Percent)
|
||||
{
|
||||
_width += (int)((p.Width / 100f) * this.Width);
|
||||
}
|
||||
});
|
||||
if (m_isShowCheckBox)
|
||||
_width += 30;
|
||||
if (_width > this.Width)
|
||||
{
|
||||
//this.panRow.Width = _width;
|
||||
this.panHead.Width = _width;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_columns.Any(p => p.WidthType == SizeType.AutoSize))
|
||||
{
|
||||
//this.panRow.Width = this.Width;
|
||||
this.panHead.Width = this.Width;
|
||||
}
|
||||
else
|
||||
{
|
||||
//this.panRow.Width = _width;
|
||||
this.panHead.Width = _width;
|
||||
}
|
||||
}
|
||||
m_columns.FindAll(p => p.WidthType == SizeType.Absolute);
|
||||
m_columns.FindAll(p => p.WidthType == SizeType.Percent);
|
||||
int intColumnsCount = m_columns.Count();
|
||||
if (m_isShowCheckBox)
|
||||
{
|
||||
intColumnsCount++;
|
||||
}
|
||||
this.panColumns.ColumnCount = intColumnsCount;
|
||||
for (int i = 0; i < intColumnsCount; i++)
|
||||
{
|
||||
Control c = null;
|
||||
if (i == 0 && m_isShowCheckBox)
|
||||
{
|
||||
this.panColumns.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(SizeType.Absolute, 30F));
|
||||
|
||||
UCCheckBox box = new UCCheckBox();
|
||||
box.TextValue = "";
|
||||
box.Size = new Size(30, 30);
|
||||
box.CheckedChangeEvent += (a, b) =>
|
||||
{
|
||||
Rows.ForEach(p => p.IsChecked = box.Checked);
|
||||
if (HeadCheckBoxChangeEvent != null)
|
||||
{
|
||||
HeadCheckBoxChangeEvent(a, b);
|
||||
}
|
||||
};
|
||||
c = box;
|
||||
}
|
||||
else
|
||||
{
|
||||
var item = m_columns[i - (m_isShowCheckBox ? 1 : 0)];
|
||||
this.panColumns.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(item.WidthType, item.Width));
|
||||
Label lbl = new Label();
|
||||
lbl.Name = "dgvColumns_" + i;
|
||||
lbl.Text = item.HeadText;
|
||||
lbl.Font = m_headFont;
|
||||
lbl.ForeColor = m_headTextColor;
|
||||
lbl.TextAlign = ContentAlignment.MiddleCenter;
|
||||
lbl.AutoSize = false;
|
||||
lbl.Dock = DockStyle.Fill;
|
||||
lbl.MouseDown += (a, b) =>
|
||||
{
|
||||
if (HeadColumnClickEvent != null)
|
||||
{
|
||||
HeadColumnClickEvent(a, b);
|
||||
}
|
||||
};
|
||||
c = lbl;
|
||||
}
|
||||
this.panColumns.Controls.Add(c, i, 0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
ControlHelper.FreezeControl(this.panHead, false);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region 公共函数
|
||||
/// <summary>
|
||||
/// 刷新数据
|
||||
/// </summary>
|
||||
public void ReloadSource()
|
||||
{
|
||||
if (DesignMode)
|
||||
{ return; }
|
||||
try
|
||||
{
|
||||
ControlHelper.FreezeControl(this, true);
|
||||
panHead.Location = new Point(0, 0);
|
||||
Rows = new List<IDataGridViewRow>();
|
||||
if (m_columns == null || m_columns.Count <= 0)
|
||||
return;
|
||||
if (m_dataSource != null)
|
||||
{
|
||||
int intIndex = 0;
|
||||
|
||||
int intSourceCount = 0;
|
||||
if (m_dataSource is DataTable)
|
||||
{
|
||||
intSourceCount = (m_dataSource as DataTable).Rows.Count;
|
||||
}
|
||||
else if (typeof(IList).IsAssignableFrom(m_dataSource.GetType()))
|
||||
{
|
||||
intSourceCount = (m_dataSource as IList).Count;
|
||||
}
|
||||
|
||||
foreach (Control item in this.panRow.Controls)
|
||||
{
|
||||
if (intIndex >= intSourceCount)
|
||||
{
|
||||
item.Visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
var row = (item as IDataGridViewRow);
|
||||
row.IsShowCheckBox = m_isShowCheckBox;
|
||||
if (m_dataSource is DataTable)
|
||||
{
|
||||
row.DataSource = (m_dataSource as DataTable).Rows[intIndex];
|
||||
}
|
||||
else
|
||||
{
|
||||
row.DataSource = (m_dataSource as IList)[intIndex];
|
||||
}
|
||||
row.BindingCellData();
|
||||
if (row.RowHeight != m_rowHeight)
|
||||
row.RowHeight = m_rowHeight;
|
||||
item.Visible = true;
|
||||
item.Width = panHead.Width;
|
||||
|
||||
Rows.Add(row);
|
||||
row.RowIndex = Rows.IndexOf(row);
|
||||
}
|
||||
intIndex++;
|
||||
}
|
||||
|
||||
if (intIndex < intSourceCount)
|
||||
{
|
||||
for (int i = intIndex; i < intSourceCount; i++)
|
||||
{
|
||||
IDataGridViewRow row = (IDataGridViewRow)Activator.CreateInstance(m_rowType);
|
||||
if (m_dataSource is DataTable)
|
||||
{
|
||||
row.DataSource = (m_dataSource as DataTable).Rows[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
row.DataSource = (m_dataSource as IList)[i];
|
||||
}
|
||||
row.Columns = m_columns;
|
||||
List<Control> lstCells = new List<Control>();
|
||||
row.IsShowCheckBox = m_isShowCheckBox;
|
||||
row.ReloadCells();
|
||||
row.BindingCellData();
|
||||
|
||||
Control rowControl = (row as Control);
|
||||
rowControl.Width = panHead.Width;
|
||||
row.RowHeight = m_rowHeight;
|
||||
row.CellClick += (a, b) => { this.FindForm().ActiveControl = this; rowControl.Focus(); SetSelectRow(rowControl, b); };
|
||||
row.CheckBoxChangeEvent += (a, b) => { SetSelectRow(rowControl, b); };
|
||||
row.RowCustomEvent += (a, b) => { if (RowCustomEvent != null) { RowCustomEvent(a, b); } };
|
||||
row.SourceChanged += RowSourceChanged;
|
||||
Rows.Add(row);
|
||||
row.RowIndex = Rows.IndexOf(row);
|
||||
this.panRow.Controls.Add(rowControl);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//this.panRow.Height = intSourceCount * RowHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (Control item in this.panRow.Controls)
|
||||
{
|
||||
item.Visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
ControlHelper.FreezeControl(this, false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 快捷键
|
||||
/// </summary>
|
||||
/// <param name="msg">通过引用传递的 <see cref="T:System.Windows.Forms.Message" />,它表示要处理的窗口消息。</param>
|
||||
/// <param name="keyData"><see cref="T:System.Windows.Forms.Keys" /> 值之一,它表示要处理的键。</param>
|
||||
/// <returns>如果字符已由控件处理,则为 true;否则为 false。</returns>
|
||||
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
|
||||
{
|
||||
if (keyData == Keys.Up)
|
||||
{
|
||||
Previous();
|
||||
}
|
||||
else if (keyData == Keys.Down)
|
||||
{
|
||||
Next();
|
||||
}
|
||||
else if (keyData == Keys.Home)
|
||||
{
|
||||
First();
|
||||
}
|
||||
else if (keyData == Keys.End)
|
||||
{
|
||||
End();
|
||||
}
|
||||
return base.ProcessCmdKey(ref msg, keyData);
|
||||
}
|
||||
/// <summary>
|
||||
/// 选中第一个
|
||||
/// </summary>
|
||||
public void First()
|
||||
{
|
||||
if (Rows == null || Rows.Count <= 0)
|
||||
return;
|
||||
Control c = null;
|
||||
c = (Rows[0] as Control);
|
||||
SetSelectRow(c, new DataGridViewEventArgs() { RowIndex = 0 });
|
||||
}
|
||||
/// <summary>
|
||||
/// 选中上一个
|
||||
/// </summary>
|
||||
public void Previous()
|
||||
{
|
||||
if (Rows == null || Rows.Count <= 0)
|
||||
return;
|
||||
Control c = null;
|
||||
|
||||
int index = Rows.IndexOf(m_selectRow);
|
||||
if (index - 1 >= 0)
|
||||
{
|
||||
c = (Rows[index - 1] as Control);
|
||||
SetSelectRow(c, new DataGridViewEventArgs() { RowIndex = index - 1 });
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 选中下一个
|
||||
/// </summary>
|
||||
public void Next()
|
||||
{
|
||||
if (Rows == null || Rows.Count <= 0)
|
||||
return;
|
||||
Control c = null;
|
||||
|
||||
int index = Rows.IndexOf(m_selectRow);
|
||||
if (index + 1 < Rows.Count)
|
||||
{
|
||||
c = (Rows[index + 1] as Control);
|
||||
SetSelectRow(c, new DataGridViewEventArgs() { RowIndex = index + 1 });
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 选中最后一个
|
||||
/// </summary>
|
||||
public void End()
|
||||
{
|
||||
if (Rows == null || Rows.Count <= 0)
|
||||
return;
|
||||
Control c = null;
|
||||
c = (Rows[Rows.Count - 1] as Control);
|
||||
SetSelectRow(c, new DataGridViewEventArgs() { RowIndex = Rows.Count - 1 });
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 事件
|
||||
/// <summary>
|
||||
/// Rows the source changed.
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender.</param>
|
||||
/// <param name="e">The <see cref="DataGridViewEventArgs" /> instance containing the event data.</param>
|
||||
void RowSourceChanged(object sender, DataGridViewEventArgs e)
|
||||
{
|
||||
if (RowSourceChangedEvent != null)
|
||||
RowSourceChangedEvent(sender, e);
|
||||
}
|
||||
/// <summary>
|
||||
/// Sets the select row.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="e">The <see cref="DataGridViewEventArgs" /> instance containing the event data.</param>
|
||||
private void SetSelectRow(Control item, DataGridViewEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
ControlHelper.FreezeControl(this, true);
|
||||
if (item == null)
|
||||
return;
|
||||
if (item.Visible == false)
|
||||
return;
|
||||
this.FindForm().ActiveControl = this;
|
||||
this.FindForm().ActiveControl = item;
|
||||
if (m_selectRow != item)
|
||||
{
|
||||
if (m_selectRow != null)
|
||||
{
|
||||
m_selectRow.SetSelect(false);
|
||||
}
|
||||
m_selectRow = item as IDataGridViewRow;
|
||||
m_selectRow.SetSelect(true);
|
||||
|
||||
if (this.panRow.Controls.Count > 0)
|
||||
{
|
||||
if (item.Location.Y < 0)
|
||||
{
|
||||
this.panRow.AutoScrollPosition = new Point(0, Math.Abs(this.panRow.Controls[this.panRow.Controls.Count - 1].Location.Y) + item.Location.Y);
|
||||
}
|
||||
else if (item.Location.Y + m_rowHeight > this.panRow.Height)
|
||||
{
|
||||
this.panRow.AutoScrollPosition = new Point(0, Math.Abs(this.panRow.AutoScrollPosition.Y) + item.Location.Y - this.panRow.Height + m_rowHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (ItemClick != null)
|
||||
{
|
||||
ItemClick(item, e);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
ControlHelper.FreezeControl(this, false);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void UCDataGridView_SizeChanged(object sender, EventArgs e)
|
||||
{
|
||||
//LoadColumns();
|
||||
//ReloadSource();
|
||||
}
|
||||
|
||||
private void UCDataGridView_Scroll(object sender, ScrollEventArgs e)
|
||||
{
|
||||
//if (e.ScrollOrientation == ScrollOrientation.VerticalScroll)
|
||||
//{
|
||||
// panHead.Location = new Point(0, this.VerticalScroll.Value + this.panRow.Location.Y - panHead.Height - 2);
|
||||
//}
|
||||
}
|
||||
|
||||
private void panRow_Scroll(object sender, ScrollEventArgs e)
|
||||
{
|
||||
if (e.ScrollOrientation == ScrollOrientation.HorizontalScroll && this.panRow.Controls.Count > 0)
|
||||
{
|
||||
Console.WriteLine(this.panRow.HorizontalScroll.Value);
|
||||
Console.WriteLine(this.panRow.Controls[0].Location.X);
|
||||
panHead.Location = new Point(this.panRow.HorizontalScroll.Value * -1, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
120
X009/src/HZH_Controls/Controls/DataGridView/UCDataGridView.resx
Normal file
120
X009/src/HZH_Controls/Controls/DataGridView/UCDataGridView.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
102
X009/src/HZH_Controls/Controls/DataGridView/UCDataGridViewRow.Designer.cs
generated
Normal file
102
X009/src/HZH_Controls/Controls/DataGridView/UCDataGridViewRow.Designer.cs
generated
Normal file
@ -0,0 +1,102 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-09-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCDataGridViewRow.Designer.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCDataGridViewRow.
|
||||
/// Implements the <see cref="System.Windows.Forms.UserControl" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Windows.Forms.UserControl" />
|
||||
partial class UCDataGridViewRow
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.ucSplitLine_H1 = new HZH_Controls.Controls.UCSplitLine_H();
|
||||
this.panCells = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// ucSplitLine_H1
|
||||
//
|
||||
this.ucSplitLine_H1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(232)))), ((int)(((byte)(232)))));
|
||||
this.ucSplitLine_H1.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.ucSplitLine_H1.Location = new System.Drawing.Point(0, 55);
|
||||
this.ucSplitLine_H1.Name = "ucSplitLine_H1";
|
||||
this.ucSplitLine_H1.Size = new System.Drawing.Size(661, 1);
|
||||
this.ucSplitLine_H1.TabIndex = 0;
|
||||
this.ucSplitLine_H1.TabStop = false;
|
||||
//
|
||||
// panCells
|
||||
//
|
||||
this.panCells.ColumnCount = 1;
|
||||
this.panCells.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.panCells.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.panCells.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panCells.Location = new System.Drawing.Point(0, 0);
|
||||
this.panCells.Name = "panCells";
|
||||
this.panCells.RowCount = 1;
|
||||
this.panCells.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.panCells.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.panCells.Size = new System.Drawing.Size(661, 55);
|
||||
this.panCells.TabIndex = 1;
|
||||
//
|
||||
// UCDataGridViewItem
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.Controls.Add(this.panCells);
|
||||
this.Controls.Add(this.ucSplitLine_H1);
|
||||
this.Name = "UCDataGridViewItem";
|
||||
this.Size = new System.Drawing.Size(661, 56);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// The uc split line h1
|
||||
/// </summary>
|
||||
private UCSplitLine_H ucSplitLine_H1;
|
||||
/// <summary>
|
||||
/// The pan cells
|
||||
/// </summary>
|
||||
private System.Windows.Forms.TableLayoutPanel panCells;
|
||||
}
|
||||
}
|
332
X009/src/HZH_Controls/Controls/DataGridView/UCDataGridViewRow.cs
Normal file
332
X009/src/HZH_Controls/Controls/DataGridView/UCDataGridViewRow.cs
Normal file
@ -0,0 +1,332 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-09-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCDataGridViewRow.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCDataGridViewRow.
|
||||
/// Implements the <see cref="System.Windows.Forms.UserControl" />
|
||||
/// Implements the <see cref="HZH_Controls.Controls.IDataGridViewRow" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Windows.Forms.UserControl" />
|
||||
/// <seealso cref="HZH_Controls.Controls.IDataGridViewRow" />
|
||||
[ToolboxItem(false)]
|
||||
public partial class UCDataGridViewRow : UserControl, IDataGridViewRow
|
||||
{
|
||||
|
||||
#region 属性
|
||||
/// <summary>
|
||||
/// CheckBox选中事件
|
||||
/// </summary>
|
||||
public event DataGridViewEventHandler CheckBoxChangeEvent;
|
||||
/// <summary>
|
||||
/// Occurs when [row custom event].
|
||||
/// </summary>
|
||||
public event DataGridViewRowCustomEventHandler RowCustomEvent;
|
||||
/// <summary>
|
||||
/// 点击单元格事件
|
||||
/// </summary>
|
||||
public event DataGridViewEventHandler CellClick;
|
||||
|
||||
/// <summary>
|
||||
/// 数据源改变事件
|
||||
/// </summary>
|
||||
public event DataGridViewEventHandler SourceChanged;
|
||||
|
||||
/// <summary>
|
||||
/// 列参数,用于创建列数和宽度
|
||||
/// </summary>
|
||||
/// <value>The columns.</value>
|
||||
public List<DataGridViewColumnEntity> Columns
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 数据源
|
||||
/// </summary>
|
||||
/// <value>The data source.</value>
|
||||
public object DataSource
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 行号
|
||||
/// </summary>
|
||||
/// <value>The Index of the row.</value>
|
||||
public int RowIndex { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this instance is show CheckBox.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is show CheckBox; otherwise, <c>false</c>.</value>
|
||||
public bool IsShowCheckBox
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
/// <summary>
|
||||
/// The m is checked
|
||||
/// </summary>
|
||||
private bool m_isChecked;
|
||||
/// <summary>
|
||||
/// 是否选中
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is checked; otherwise, <c>false</c>.</value>
|
||||
public bool IsChecked
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_isChecked;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (m_isChecked != value)
|
||||
{
|
||||
m_isChecked = value;
|
||||
(this.panCells.Controls.Find("check", false)[0] as UCCheckBox).Checked = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The m row height
|
||||
/// </summary>
|
||||
int m_rowHeight = 40;
|
||||
/// <summary>
|
||||
/// 行高
|
||||
/// </summary>
|
||||
/// <value>The height of the row.</value>
|
||||
public int RowHeight
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_rowHeight;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_rowHeight = value;
|
||||
this.Height = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCDataGridViewRow" /> class.
|
||||
/// </summary>
|
||||
public UCDataGridViewRow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 绑定数据到Cell
|
||||
/// </summary>
|
||||
/// <returns>返回true则表示已处理过,否则将进行默认绑定(通常只针对有Text值的控件)</returns>
|
||||
public void BindingCellData()
|
||||
{
|
||||
if (DataSource != null)
|
||||
{
|
||||
for (int i = 0; i < Columns.Count; i++)
|
||||
{
|
||||
DataGridViewColumnEntity com = Columns[i];
|
||||
var cs = this.panCells.Controls.Find("lbl_" + com.DataField, false);
|
||||
if (cs != null && cs.Length > 0)
|
||||
{
|
||||
if (DataSource is DataRow)
|
||||
{
|
||||
DataRow row=DataSource as DataRow;
|
||||
if (com.Format != null)
|
||||
{
|
||||
cs[0].Text = com.Format(row[com.DataField]);
|
||||
}
|
||||
else
|
||||
{
|
||||
cs[0].Text = row[com.DataField].ToStringExt();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var pro = DataSource.GetType().GetProperty(com.DataField);
|
||||
|
||||
if (pro != null)
|
||||
{
|
||||
var value = pro.GetValue(DataSource, null);
|
||||
if (com.Format != null)
|
||||
{
|
||||
cs[0].Text = com.Format(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
cs[0].Text = value.ToStringExt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (Control item in this.panCells.Controls)
|
||||
{
|
||||
if (item is IDataGridViewCustomCell)
|
||||
{
|
||||
IDataGridViewCustomCell cell = item as IDataGridViewCustomCell;
|
||||
cell.RowCustomEvent += cell_RowCustomEvent;
|
||||
cell.SetBindSource(DataSource);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cell_RowCustomEvent(object sender, DataGridViewRowCustomEventArgs e)
|
||||
{
|
||||
if (RowCustomEvent != null)
|
||||
{
|
||||
RowCustomEvent(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the MouseDown event of the Item control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
|
||||
void Item_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (CellClick != null)
|
||||
{
|
||||
CellClick(this, new DataGridViewEventArgs()
|
||||
{
|
||||
CellControl = this,
|
||||
CellIndex = (sender as Control).Tag.ToInt(),
|
||||
RowIndex = this.RowIndex
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置选中状态,通常为设置颜色即可
|
||||
/// </summary>
|
||||
/// <param name="blnSelected">是否选中</param>
|
||||
public void SetSelect(bool blnSelected)
|
||||
{
|
||||
if (blnSelected)
|
||||
{
|
||||
this.BackColor = Color.FromArgb(255, 247, 245);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.BackColor = Color.Transparent;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reloads the cells.
|
||||
/// </summary>
|
||||
public void ReloadCells()
|
||||
{
|
||||
try
|
||||
{
|
||||
ControlHelper.FreezeControl(this, true);
|
||||
this.panCells.Controls.Clear();
|
||||
this.panCells.ColumnStyles.Clear();
|
||||
|
||||
int intColumnsCount = Columns.Count();
|
||||
if (Columns != null && intColumnsCount > 0)
|
||||
{
|
||||
if (IsShowCheckBox)
|
||||
{
|
||||
intColumnsCount++;
|
||||
}
|
||||
this.panCells.ColumnCount = intColumnsCount;
|
||||
for (int i = 0; i < intColumnsCount; i++)
|
||||
{
|
||||
Control c = null;
|
||||
if (i == 0 && IsShowCheckBox)
|
||||
{
|
||||
this.panCells.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(SizeType.Absolute, 30F));
|
||||
|
||||
UCCheckBox box = new UCCheckBox();
|
||||
box.Name = "check";
|
||||
box.TextValue = "";
|
||||
box.Size = new Size(30, 30);
|
||||
box.Dock = DockStyle.Fill;
|
||||
box.CheckedChangeEvent += (a, b) =>
|
||||
{
|
||||
IsChecked = box.Checked;
|
||||
if (CheckBoxChangeEvent != null)
|
||||
{
|
||||
CheckBoxChangeEvent(a, new DataGridViewEventArgs()
|
||||
{
|
||||
RowIndex = this.RowIndex,
|
||||
CellControl = box,
|
||||
CellIndex = 0
|
||||
});
|
||||
}
|
||||
};
|
||||
c = box;
|
||||
}
|
||||
else
|
||||
{
|
||||
var item = Columns[i - (IsShowCheckBox ? 1 : 0)];
|
||||
this.panCells.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(item.WidthType, item.Width));
|
||||
|
||||
if (item.CustomCellType == null)
|
||||
{
|
||||
Label lbl = new Label();
|
||||
lbl.Tag = i - (IsShowCheckBox ? 1 : 0);
|
||||
lbl.Name = "lbl_" + item.DataField;
|
||||
lbl.Font = new Font("微软雅黑", 12);
|
||||
lbl.ForeColor = Color.Black;
|
||||
lbl.AutoSize = false;
|
||||
lbl.Dock = DockStyle.Fill;
|
||||
lbl.TextAlign = item.TextAlign;
|
||||
lbl.MouseDown += (a, b) =>
|
||||
{
|
||||
Item_MouseDown(a, b);
|
||||
};
|
||||
c = lbl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Control cc = (Control)Activator.CreateInstance(item.CustomCellType);
|
||||
cc.Dock = DockStyle.Fill;
|
||||
c = cc;
|
||||
}
|
||||
}
|
||||
this.panCells.Controls.Add(c, i, 0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
ControlHelper.FreezeControl(this, false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
149
X009/src/HZH_Controls/Controls/DataGridView/UCDataGridViewTreeRow.Designer.cs
generated
Normal file
149
X009/src/HZH_Controls/Controls/DataGridView/UCDataGridViewTreeRow.Designer.cs
generated
Normal file
@ -0,0 +1,149 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-23-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCDataGridViewTreeRow.Designer.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCDataGridViewTreeRow.
|
||||
/// Implements the <see cref="System.Windows.Forms.UserControl" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Windows.Forms.UserControl" />
|
||||
partial class UCDataGridViewTreeRow
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.panCells = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.panLeft = new System.Windows.Forms.Panel();
|
||||
this.panMain = new System.Windows.Forms.Panel();
|
||||
this.ucSplitLine_H1 = new HZH_Controls.Controls.UCSplitLine_H();
|
||||
this.ucSplitLine_V1 = new HZH_Controls.Controls.UCSplitLine_V();
|
||||
this.panMain.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panCells
|
||||
//
|
||||
this.panCells.ColumnCount = 1;
|
||||
this.panCells.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.panCells.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.panCells.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panCells.Location = new System.Drawing.Point(24, 0);
|
||||
this.panCells.Name = "panCells";
|
||||
this.panCells.RowCount = 1;
|
||||
this.panCells.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.panCells.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 55F));
|
||||
this.panCells.Size = new System.Drawing.Size(636, 64);
|
||||
this.panCells.TabIndex = 2;
|
||||
//
|
||||
// panLeft
|
||||
//
|
||||
this.panLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
|
||||
this.panLeft.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.panLeft.Location = new System.Drawing.Point(0, 0);
|
||||
this.panLeft.Name = "panLeft";
|
||||
this.panLeft.Size = new System.Drawing.Size(24, 64);
|
||||
this.panLeft.TabIndex = 0;
|
||||
this.panLeft.Tag = "0";
|
||||
this.panLeft.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panLeft_MouseDown);
|
||||
//
|
||||
// panMain
|
||||
//
|
||||
this.panMain.Controls.Add(this.panCells);
|
||||
this.panMain.Controls.Add(this.panLeft);
|
||||
this.panMain.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panMain.Location = new System.Drawing.Point(1, 0);
|
||||
this.panMain.Name = "panMain";
|
||||
this.panMain.Size = new System.Drawing.Size(660, 64);
|
||||
this.panMain.TabIndex = 0;
|
||||
//
|
||||
// ucSplitLine_H1
|
||||
//
|
||||
this.ucSplitLine_H1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(232)))), ((int)(((byte)(232)))));
|
||||
this.ucSplitLine_H1.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.ucSplitLine_H1.Location = new System.Drawing.Point(1, 64);
|
||||
this.ucSplitLine_H1.Name = "ucSplitLine_H1";
|
||||
this.ucSplitLine_H1.Size = new System.Drawing.Size(660, 1);
|
||||
this.ucSplitLine_H1.TabIndex = 1;
|
||||
this.ucSplitLine_H1.TabStop = false;
|
||||
//
|
||||
// ucSplitLine_V1
|
||||
//
|
||||
this.ucSplitLine_V1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(232)))), ((int)(((byte)(232)))));
|
||||
this.ucSplitLine_V1.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.ucSplitLine_V1.Location = new System.Drawing.Point(0, 0);
|
||||
this.ucSplitLine_V1.Name = "ucSplitLine_V1";
|
||||
this.ucSplitLine_V1.Size = new System.Drawing.Size(1, 65);
|
||||
this.ucSplitLine_V1.TabIndex = 0;
|
||||
this.ucSplitLine_V1.TabStop = false;
|
||||
this.ucSplitLine_V1.Visible = false;
|
||||
//
|
||||
// UCDataGridViewTreeRow
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.Controls.Add(this.panMain);
|
||||
this.Controls.Add(this.ucSplitLine_H1);
|
||||
this.Controls.Add(this.ucSplitLine_V1);
|
||||
this.Name = "UCDataGridViewTreeRow";
|
||||
this.Size = new System.Drawing.Size(661, 65);
|
||||
this.panMain.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// The pan cells
|
||||
/// </summary>
|
||||
private System.Windows.Forms.TableLayoutPanel panCells;
|
||||
/// <summary>
|
||||
/// The uc split line h1
|
||||
/// </summary>
|
||||
private UCSplitLine_H ucSplitLine_H1;
|
||||
/// <summary>
|
||||
/// The pan left
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Panel panLeft;
|
||||
/// <summary>
|
||||
/// The pan main
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Panel panMain;
|
||||
private UCSplitLine_V ucSplitLine_V1;
|
||||
}
|
||||
}
|
@ -0,0 +1,475 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-23-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCDataGridViewTreeRow.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Collections;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCDataGridViewTreeRow.
|
||||
/// Implements the <see cref="System.Windows.Forms.UserControl" />
|
||||
/// Implements the <see cref="HZH_Controls.Controls.IDataGridViewRow" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Windows.Forms.UserControl" />
|
||||
/// <seealso cref="HZH_Controls.Controls.IDataGridViewRow" />
|
||||
[ToolboxItem(false)]
|
||||
public partial class UCDataGridViewTreeRow : UserControl, IDataGridViewRow
|
||||
{
|
||||
#region 属性
|
||||
/// <summary>
|
||||
/// CheckBox选中事件
|
||||
/// </summary>
|
||||
public event DataGridViewEventHandler CheckBoxChangeEvent;
|
||||
|
||||
/// <summary>
|
||||
/// 点击单元格事件
|
||||
/// </summary>
|
||||
public event DataGridViewEventHandler CellClick;
|
||||
|
||||
/// <summary>
|
||||
/// 数据源改变事件
|
||||
/// </summary>
|
||||
public event DataGridViewEventHandler SourceChanged;
|
||||
/// <summary>
|
||||
/// Occurs when [row custom event].
|
||||
/// </summary>
|
||||
public event DataGridViewRowCustomEventHandler RowCustomEvent;
|
||||
/// <summary>
|
||||
/// 列参数,用于创建列数和宽度
|
||||
/// </summary>
|
||||
/// <value>The columns.</value>
|
||||
public List<DataGridViewColumnEntity> Columns
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 数据源
|
||||
/// </summary>
|
||||
/// <value>The data source.</value>
|
||||
public object DataSource
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
private int rowLevel = 0;
|
||||
/// <summary>
|
||||
/// 折叠的第几层,用于缩进
|
||||
/// </summary>
|
||||
public int RowLevel
|
||||
{
|
||||
get { return rowLevel; }
|
||||
set
|
||||
{
|
||||
rowLevel = value;
|
||||
this.Padding = new Padding(this.panLeft.Width / 2 * value, this.Padding.Top, this.panLeft.Right, this.Padding.Bottom);
|
||||
this.ucSplitLine_V1.Visible = value > 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 行号,树状图目前没有给予行号
|
||||
/// </summary>
|
||||
/// <value>The Index of the row.</value>
|
||||
public int RowIndex { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this instance is show CheckBox.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is show CheckBox; otherwise, <c>false</c>.</value>
|
||||
public bool IsShowCheckBox
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
/// <summary>
|
||||
/// The m is checked
|
||||
/// </summary>
|
||||
private bool m_isChecked;
|
||||
/// <summary>
|
||||
/// 是否选中
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is checked; otherwise, <c>false</c>.</value>
|
||||
public bool IsChecked
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_isChecked;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (m_isChecked != value)
|
||||
{
|
||||
m_isChecked = value;
|
||||
(this.panCells.Controls.Find("check", false)[0] as UCCheckBox).Checked = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The m row height
|
||||
/// </summary>
|
||||
int m_rowHeight = 40;
|
||||
/// <summary>
|
||||
/// 行高
|
||||
/// </summary>
|
||||
/// <value>The height of the row.</value>
|
||||
public int RowHeight
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_rowHeight;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_rowHeight = value;
|
||||
this.Height = value;
|
||||
}
|
||||
}
|
||||
private List<UCDataGridViewTreeRow> childrenRows = new List<UCDataGridViewTreeRow>();
|
||||
|
||||
public List<UCDataGridViewTreeRow> ChildrenRows
|
||||
{
|
||||
get { return childrenRows; }
|
||||
set { childrenRows = value; }
|
||||
}
|
||||
private bool? isOpened = false;
|
||||
/// <summary>
|
||||
/// 是否打开状态
|
||||
/// </summary>
|
||||
public bool? IsOpened
|
||||
{
|
||||
get { return isOpened; }
|
||||
set
|
||||
{
|
||||
isOpened = value;
|
||||
if (value.HasValue)
|
||||
{
|
||||
panLeft.Enabled = true;
|
||||
if (value.Value)
|
||||
{
|
||||
panLeft.BackgroundImage = Properties.Resources.caret_down;
|
||||
}
|
||||
else
|
||||
{
|
||||
panLeft.BackgroundImage = Properties.Resources.caret_right;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
panLeft.BackgroundImage = null;
|
||||
panLeft.Enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCDataGridViewTreeRow" /> class.
|
||||
/// </summary>
|
||||
public UCDataGridViewTreeRow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 绑定数据到Cell
|
||||
/// </summary>
|
||||
public void BindingCellData()
|
||||
{
|
||||
for (int i = 0; i < Columns.Count; i++)
|
||||
{
|
||||
DataGridViewColumnEntity com = Columns[i];
|
||||
var cs = this.panCells.Controls.Find("lbl_" + com.DataField, false);
|
||||
if (cs != null && cs.Length > 0)
|
||||
{
|
||||
var pro = DataSource.GetType().GetProperty(com.DataField);
|
||||
if (pro != null)
|
||||
{
|
||||
var value = pro.GetValue(DataSource, null);
|
||||
if (com.Format != null)
|
||||
{
|
||||
cs[0].Text = com.Format(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
cs[0].Text = value.ToStringExt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (Control item in this.panCells.Controls)
|
||||
{
|
||||
if (item is IDataGridViewCustomCell)
|
||||
{
|
||||
IDataGridViewCustomCell cell = item as IDataGridViewCustomCell;
|
||||
cell.RowCustomEvent += cell_RowCustomEvent;
|
||||
cell.SetBindSource(DataSource);
|
||||
}
|
||||
}
|
||||
IsOpened = false;
|
||||
var proChildrens = DataSource.GetType().GetProperty("Childrens");
|
||||
if (proChildrens != null)
|
||||
{
|
||||
var value = proChildrens.GetValue(DataSource, null);
|
||||
if (value != null)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
IsOpened = null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
IsOpened = null;
|
||||
}
|
||||
}
|
||||
|
||||
void cell_RowCustomEvent(object sender, DataGridViewRowCustomEventArgs e)
|
||||
{
|
||||
if (RowCustomEvent != null)
|
||||
RowCustomEvent(sender, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the MouseDown event of the Item control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
|
||||
void Item_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (CellClick != null)
|
||||
{
|
||||
CellClick(this, new DataGridViewEventArgs()
|
||||
{
|
||||
CellControl = this,
|
||||
CellIndex = (sender as Control).Tag.ToInt()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置选中状态,通常为设置颜色即可
|
||||
/// </summary>
|
||||
/// <param name="blnSelected">是否选中</param>
|
||||
public void SetSelect(bool blnSelected)
|
||||
{
|
||||
if (blnSelected)
|
||||
{
|
||||
this.panMain.BackColor = Color.FromArgb(255, 247, 245);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.panMain.BackColor = Color.Transparent;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加单元格元素,仅做添加控件操作,不做数据绑定,数据绑定使用BindingCells
|
||||
/// </summary>
|
||||
public void ReloadCells()
|
||||
{
|
||||
try
|
||||
{
|
||||
ControlHelper.FreezeControl(this, true);
|
||||
this.panCells.Controls.Clear();
|
||||
this.panCells.ColumnStyles.Clear();
|
||||
|
||||
int intColumnsCount = Columns.Count();
|
||||
if (Columns != null && intColumnsCount > 0)
|
||||
{
|
||||
if (IsShowCheckBox)
|
||||
{
|
||||
intColumnsCount++;
|
||||
}
|
||||
this.panCells.ColumnCount = intColumnsCount;
|
||||
bool blnFirst = true;
|
||||
for (int i = 0; i < intColumnsCount; i++)
|
||||
{
|
||||
Control c = null;
|
||||
if (i == 0 && IsShowCheckBox)
|
||||
{
|
||||
this.panCells.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(SizeType.Absolute, 30F));
|
||||
|
||||
UCCheckBox box = new UCCheckBox();
|
||||
box.Name = "check";
|
||||
box.TextValue = "";
|
||||
box.Size = new Size(30, 30);
|
||||
box.Dock = DockStyle.Fill;
|
||||
box.CheckedChangeEvent += box_CheckedChangeEvent;
|
||||
c = box;
|
||||
}
|
||||
else
|
||||
{
|
||||
var item = Columns[i - (IsShowCheckBox ? 1 : 0)];
|
||||
var w = item.Width - (blnFirst ? (this.panLeft.Width / 2 * rowLevel) : 0);
|
||||
if (w < 5)
|
||||
w = 5;
|
||||
this.panCells.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(item.WidthType, w));
|
||||
blnFirst = false;
|
||||
if (item.CustomCellType == null)
|
||||
{
|
||||
Label lbl = new Label();
|
||||
lbl.Tag = i - (IsShowCheckBox ? 1 : 0);
|
||||
lbl.Name = "lbl_" + item.DataField;
|
||||
lbl.Font = new Font("微软雅黑", 12);
|
||||
lbl.ForeColor = Color.Black;
|
||||
lbl.AutoSize = false;
|
||||
lbl.Dock = DockStyle.Fill;
|
||||
lbl.TextAlign = item.TextAlign;
|
||||
lbl.MouseDown += (a, b) =>
|
||||
{
|
||||
Item_MouseDown(a, b);
|
||||
};
|
||||
c = lbl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Control cc = (Control)Activator.CreateInstance(item.CustomCellType);
|
||||
cc.Dock = DockStyle.Fill;
|
||||
c = cc;
|
||||
}
|
||||
}
|
||||
this.panCells.Controls.Add(c, i, 0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
ControlHelper.FreezeControl(this, false);
|
||||
}
|
||||
}
|
||||
|
||||
void box_CheckedChangeEvent(object sender, EventArgs e)
|
||||
{
|
||||
IsChecked = ((UCCheckBox)sender).Checked;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Handles the MouseDown event of the panLeft control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
|
||||
private void panLeft_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!IsOpened.HasValue)
|
||||
return;
|
||||
ControlHelper.FreezeControl(this.FindForm(), true);
|
||||
if (!IsOpened.Value)
|
||||
{
|
||||
|
||||
IsOpened = !IsOpened;
|
||||
if (childrenRows.Count > 0)
|
||||
{
|
||||
childrenRows.ForEach(p =>
|
||||
{
|
||||
p.IsChecked = IsChecked;
|
||||
p.Visible = true;
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
var proChildrens = DataSource.GetType().GetProperty("Childrens");
|
||||
if (proChildrens != null)
|
||||
{
|
||||
var value = proChildrens.GetValue(DataSource, null);
|
||||
int intSourceCount = 0;
|
||||
if (value is DataTable)
|
||||
{
|
||||
intSourceCount = (value as DataTable).Rows.Count;
|
||||
}
|
||||
else if (typeof(IList).IsAssignableFrom(value.GetType()))
|
||||
{
|
||||
intSourceCount = (value as IList).Count;
|
||||
}
|
||||
for (int i = intSourceCount - 1; i >= 0; i--)
|
||||
{
|
||||
UCDataGridViewTreeRow row = new UCDataGridViewTreeRow();
|
||||
if (value is DataTable)
|
||||
{
|
||||
row.DataSource = (value as DataTable).Rows[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
row.DataSource = (value as IList)[i];
|
||||
}
|
||||
row.RowLevel = RowLevel + 1;
|
||||
row.Columns = Columns;
|
||||
row.IsShowCheckBox = IsShowCheckBox;
|
||||
row.ReloadCells();
|
||||
row.BindingCellData();
|
||||
|
||||
Control rowControl = (row as Control);
|
||||
row.RowHeight = m_rowHeight;
|
||||
rowControl.Width = this.Width;
|
||||
//rowControl.Dock = DockStyle.Top;
|
||||
row.CellClick += (a, b) => { CellClick(rowControl, b); };
|
||||
row.CheckBoxChangeEvent += (a, b) => { CheckBoxChangeEvent(rowControl, b); };
|
||||
row.RowCustomEvent += (a, b) => { if (RowCustomEvent != null) { RowCustomEvent(a, b); } };
|
||||
row.SourceChanged += SourceChanged;
|
||||
ChildrenRows.Add(row);
|
||||
row.RowIndex = ChildrenRows.IndexOf(row);
|
||||
|
||||
this.Parent.Controls.Add(rowControl);
|
||||
var index = this.Parent.Controls.GetChildIndex(this);
|
||||
this.Parent.Controls.SetChildIndex(row, index+1);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
HideChildrenRows(this);
|
||||
this.Height = m_rowHeight;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
ControlHelper.FreezeControl(this.FindForm(), false);
|
||||
}
|
||||
}
|
||||
|
||||
private void HideChildrenRows(UCDataGridViewTreeRow row)
|
||||
{
|
||||
if (row.ChildrenRows.Count > 0)
|
||||
{
|
||||
foreach (var item in row.ChildrenRows)
|
||||
{
|
||||
HideChildrenRows(item);
|
||||
item.Hide();
|
||||
}
|
||||
row.IsOpened = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -0,0 +1,41 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-08-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="DateTimePickerType.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Enum DateTimePickerType
|
||||
/// </summary>
|
||||
public enum DateTimePickerType
|
||||
{
|
||||
/// <summary>
|
||||
/// The date time
|
||||
/// </summary>
|
||||
DateTime = 1,
|
||||
/// <summary>
|
||||
/// The date
|
||||
/// </summary>
|
||||
Date = 2,
|
||||
/// <summary>
|
||||
/// The time
|
||||
/// </summary>
|
||||
Time = 4
|
||||
}
|
||||
}
|
1582
X009/src/HZH_Controls/Controls/DateTime/UCCalendarNotes.Designer.cs
generated
Normal file
1582
X009/src/HZH_Controls/Controls/DateTime/UCCalendarNotes.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
417
X009/src/HZH_Controls/Controls/DateTime/UCCalendarNotes.cs
Normal file
417
X009/src/HZH_Controls/Controls/DateTime/UCCalendarNotes.cs
Normal file
@ -0,0 +1,417 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
public partial class UCCalendarNotes : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// 点击节点委托
|
||||
/// </summary>
|
||||
/// <param name="note">节点</param>
|
||||
/// <returns>是否刷新列表显示</returns>
|
||||
public delegate bool ClickNoteEvent(NoteEntity note);
|
||||
/// <summary>
|
||||
/// 点击节点时间
|
||||
/// </summary>
|
||||
[Description("点击节点事件"), Category("自定义")]
|
||||
public event ClickNoteEvent ClickNote;
|
||||
[Description("点击添加按钮事件"), Category("自定义")]
|
||||
public event UCCalendarNotes_Week.AddNoteEvent AddClick;
|
||||
private object dataSource;
|
||||
|
||||
List<NoteEntity> _dataSource;
|
||||
|
||||
[Description("数据源List<NoteEntity>"), Category("自定义")]
|
||||
public object DataSource
|
||||
{
|
||||
get { return dataSource; }
|
||||
set
|
||||
{
|
||||
dataSource = value;
|
||||
if (value != null)
|
||||
{
|
||||
if (value is List<NoteEntity>)
|
||||
{
|
||||
_dataSource = (List<NoteEntity>)value;
|
||||
this.panDay.Invalidate();
|
||||
this.ucCalendarNotes_Week1.DataSource = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("不是有效的数据源类型");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DateTime m_dt = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the current time.
|
||||
/// </summary>
|
||||
/// <value>The current time.</value>
|
||||
[Description("当前日期"), Category("自定义")]
|
||||
public DateTime CurrentTime
|
||||
{
|
||||
get { return m_dt; }
|
||||
set
|
||||
{
|
||||
m_dt = value;
|
||||
SetTimeToControl();
|
||||
ucCalendarNotes_Week1.CurrentTime = value;
|
||||
}
|
||||
}
|
||||
private Color tipColor = Color.Green;
|
||||
|
||||
[Description("Tip颜色"), Category("自定义")]
|
||||
public Color TipColor
|
||||
{
|
||||
get { return tipColor; }
|
||||
set { tipColor = value; }
|
||||
}
|
||||
|
||||
private Color selectColor = Color.FromArgb(255, 77, 59);
|
||||
|
||||
[Description("选中颜色"), Category("自定义")]
|
||||
public Color SelectColor
|
||||
{
|
||||
get { return selectColor; }
|
||||
set
|
||||
{
|
||||
selectColor = value;
|
||||
panTop.BackColor = value;
|
||||
foreach (Label lbl in panWeek.Controls)
|
||||
{
|
||||
lbl.ForeColor = value;
|
||||
}
|
||||
panSelectYear.BackColor = value;
|
||||
panSelectMonth.BackColor = value;
|
||||
foreach (Control item in panTop.Controls)
|
||||
{
|
||||
if (item is UCBtnExt)
|
||||
((UCBtnExt)item).FillColor = value;
|
||||
}
|
||||
ucSplitLine_H2.BackColor = value;
|
||||
ucSplitLine_V4.BackColor = value;
|
||||
ucSplitLine_V5.BackColor = value;
|
||||
}
|
||||
}
|
||||
|
||||
[Description("文字字体"), Category("自定义")]
|
||||
public override Font Font
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Font;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Font = value;
|
||||
foreach (Label lblDay in panDay.Controls)
|
||||
{
|
||||
lblDay.Font = Font;
|
||||
}
|
||||
}
|
||||
}
|
||||
public UCCalendarNotes()
|
||||
{
|
||||
InitializeComponent();
|
||||
foreach (Label lblDay in panDay.Controls)
|
||||
{
|
||||
lblDay.MouseClick += lblDay_MouseClick;
|
||||
lblDay.Paint += lblDay_Paint;
|
||||
}
|
||||
foreach (Label lblMonthItem in panSelectMonthList.Controls)
|
||||
{
|
||||
lblMonthItem.MouseClick += lblMonthItem_MouseClick;
|
||||
}
|
||||
foreach (Label lblYearItem in panSelectYearList.Controls)
|
||||
{
|
||||
lblYearItem.MouseClick += lblYearItem_MouseClick;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void lblDay_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
Label lbl = (Label)sender;
|
||||
string data = DateTime.Parse(m_dt.Year + "-" + lbl.Tag).ToString("yyyy-MM-dd");
|
||||
if (_dataSource != null && _dataSource.Count > 0)
|
||||
{
|
||||
if (_dataSource.Any(p => p.BeginTimeStr == data || p.EndTimeStr == data))
|
||||
{
|
||||
e.Graphics.SetGDIHigh();
|
||||
e.Graphics.FillEllipse(new SolidBrush(tipColor), new Rectangle(lbl.ClientRectangle.Right - 13, lbl.ClientRectangle.Top + 3, 10, 10));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
void lblYearItem_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
panSelectYear.Visible = false;
|
||||
CurrentTime = DateTime.Parse(((Label)sender).Tag + "-" + m_dt.Month + "-" + m_dt.Day);
|
||||
}
|
||||
|
||||
void lblMonthItem_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
panSelectMonth.Visible = false;
|
||||
CurrentTime = DateTime.Parse(m_dt.Year + "-" + ((Label)sender).Tag + "-" + m_dt.Day);
|
||||
}
|
||||
|
||||
void lblDay_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
Label lbl = (Label)sender;
|
||||
if (m_dt.Month + "-" + m_dt.Day != lbl.Tag.ToString())
|
||||
{
|
||||
CurrentTime = DateTime.Parse(m_dt.Year + "-" + lbl.Tag);
|
||||
}
|
||||
ucCalendarNotes_Week1.Visible = true;
|
||||
ucCalendarNotes_Week1.BringToFront();
|
||||
}
|
||||
private void SetTimeToControl()
|
||||
{
|
||||
if (lblYear.Tag.ToInt() != m_dt.Year)
|
||||
{
|
||||
lblYear.Tag = m_dt.Year;
|
||||
lblYear.Text = m_dt.Year + "年 ▼";
|
||||
}
|
||||
if (lblMouth.Tag.ToInt() != m_dt.Month)
|
||||
{
|
||||
lblMouth.Tag = m_dt.Month;
|
||||
lblMouth.Text = m_dt.Month.ToString().PadLeft(2, '0') + "月 ▼";
|
||||
}
|
||||
|
||||
//if (panDay.Tag.ToInt() != m_dt.Day)
|
||||
//{
|
||||
panDay.Tag = m_dt.Day;
|
||||
panDay.Controls.ToArray().ToList().ForEach(p =>
|
||||
{
|
||||
Label lbl = (Label)p;
|
||||
if (p.Tag.ToStringExt() == (m_dt.Month + "-" + m_dt.Day))
|
||||
{
|
||||
lbl.BackColor = selectColor;
|
||||
lbl.ForeColor = Color.White;
|
||||
}
|
||||
else
|
||||
{
|
||||
lbl.BackColor = Color.White;
|
||||
if (p.Tag.ToStringExt().Split('-')[0].ToInt() != m_dt.Month)
|
||||
{
|
||||
lbl.ForeColor = Color.FromArgb(153, 153, 153);
|
||||
}
|
||||
else
|
||||
{
|
||||
lbl.ForeColor = selectColor;
|
||||
}
|
||||
}
|
||||
});
|
||||
//}
|
||||
//btnDay.Tag = m_dt.Day;
|
||||
//btnDay.BtnText = m_dt.Day.ToString().PadLeft(2, '0') + "日";
|
||||
|
||||
|
||||
}
|
||||
private void lblYear_Click(object sender, EventArgs e)
|
||||
{
|
||||
panSelectMonth.Visible = false;
|
||||
panSelectYear.Visible = !panSelectYear.Visible;
|
||||
}
|
||||
|
||||
private void panSelectYear_VisibleChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (panSelectYear.Visible)
|
||||
{
|
||||
BindYearList(CurrentTime.Year);
|
||||
}
|
||||
}
|
||||
|
||||
private void BindYearList(int year)
|
||||
{
|
||||
List<int> lst = new List<int>();
|
||||
for (int i = year - 7; i < year + 7; i++)
|
||||
{
|
||||
lst.Add(i);
|
||||
}
|
||||
for (int i = 0; i < lst.Count; i++)
|
||||
{
|
||||
((Label)this.panSelectYearList.Controls[this.panSelectYearList.Controls.Count - i - 1]).Text = lst[i] + "年";
|
||||
this.panSelectYearList.Controls[this.panSelectYearList.Controls.Count - i - 1].Tag = lst[i];
|
||||
}
|
||||
}
|
||||
|
||||
private void lblMouth_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
int mouth = ((Label)sender).Tag.ToInt();
|
||||
CurrentTime = DateTime.Parse(m_dt.Year + "-" + mouth + "-" + m_dt.Day);
|
||||
int intDayCount = DateTime.DaysInMonth(m_dt.Year, m_dt.Month);
|
||||
DateTime dtlastMonth = m_dt.AddMonths(-1);
|
||||
int intlasyMonthDayCount = DateTime.DaysInMonth(dtlastMonth.Year, dtlastMonth.Month);
|
||||
DateTime dt1 = DateTime.Parse(m_dt.Year + "-" + m_dt.Month + "-01");
|
||||
int intIndex = (int)(dt1.DayOfWeek);
|
||||
int haveLastDay = 0;//需要上月补充几天
|
||||
haveLastDay = intIndex;
|
||||
|
||||
List<KeyValuePair<int, int>> lst = new List<KeyValuePair<int, int>>();
|
||||
for (int i = 0; i < haveLastDay; i++)
|
||||
{
|
||||
lst.Add(new KeyValuePair<int, int>(dtlastMonth.Month, intlasyMonthDayCount - (haveLastDay - i) + 1));
|
||||
}
|
||||
for (int i = 0; i < intDayCount; i++)
|
||||
{
|
||||
lst.Add(new KeyValuePair<int, int>(mouth, i + 1));
|
||||
}
|
||||
if (lst.Count < 42)
|
||||
{
|
||||
DateTime dtNextMonth = m_dt.AddMonths(1);
|
||||
int cha = 42 - lst.Count;
|
||||
for (int i = 0; i < cha; i++)
|
||||
{
|
||||
lst.Add(new KeyValuePair<int, int>(dtNextMonth.Month, i + 1));
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < lst.Count; i++)
|
||||
{
|
||||
var lbl = (Label)this.panDay.Controls[this.panDay.Controls.Count - i - 1];
|
||||
lbl.Text = lst[i].Value.ToString();
|
||||
if (lst[i].Key != mouth)
|
||||
{
|
||||
lbl.ForeColor = Color.FromArgb(153, 153, 153);
|
||||
}
|
||||
else
|
||||
{
|
||||
lbl.ForeColor = selectColor;
|
||||
}
|
||||
if (lst[i].Key + ":" + lst[i].Value != m_dt.Month + "-" + m_dt.Day)
|
||||
{
|
||||
lbl.BackColor = Color.White;
|
||||
}
|
||||
else
|
||||
{
|
||||
lbl.BackColor = selectColor;
|
||||
lbl.ForeColor = Color.White;
|
||||
}
|
||||
lbl.Tag = lst[i].Key + "-" + lst[i].Value;
|
||||
}
|
||||
}
|
||||
|
||||
private void lblMouth_Click(object sender, EventArgs e)
|
||||
{
|
||||
panSelectMonth.Visible = !panSelectMonth.Visible;
|
||||
panSelectYear.Visible = false;
|
||||
}
|
||||
|
||||
private void ucCalendarNotes_Week1_CloseClick(object sender, EventArgs e)
|
||||
{
|
||||
this.ucCalendarNotes_Week1.Visible = false;
|
||||
}
|
||||
|
||||
private bool ucCalendarNotes_Week1_ClickNote(NoteEntity note)
|
||||
{
|
||||
if (ClickNote != null)
|
||||
{
|
||||
return ClickNote(note);
|
||||
}
|
||||
return default(bool);
|
||||
}
|
||||
|
||||
private void ucCalendarNotes_Week1_AddClick(DateTime beginTime)
|
||||
{
|
||||
if (AddClick != null)
|
||||
AddClick(beginTime);
|
||||
}
|
||||
|
||||
}
|
||||
[Serializable]
|
||||
public class NoteEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
public string Key { get; set; }
|
||||
/// <summary>
|
||||
/// 备忘开始时间
|
||||
/// </summary>
|
||||
public DateTime BeginTime { get; set; }
|
||||
/// <summary>
|
||||
/// 备忘开始日期字符串
|
||||
/// </summary>
|
||||
public string BeginTimeStr
|
||||
{
|
||||
get
|
||||
{
|
||||
return BeginTime.ToString("yyyy-MM-dd");
|
||||
}
|
||||
}
|
||||
DateTime? endTime;
|
||||
/// <summary>
|
||||
/// 备忘结束时间
|
||||
/// </summary>
|
||||
public DateTime? EndTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return endTime ?? BeginTime.AddHours(1);
|
||||
}
|
||||
set { endTime = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 备忘结束日期字符串
|
||||
/// </summary>
|
||||
public string EndTimeStr
|
||||
{
|
||||
get
|
||||
{
|
||||
return (EndTime ?? BeginTime.AddHours(1)).ToString("yyyy-MM-dd");
|
||||
}
|
||||
}
|
||||
private Color _noteColor = Color.FromArgb(150, Color.Orange);
|
||||
/// <summary>
|
||||
/// 备忘颜色
|
||||
/// </summary>
|
||||
public Color NoteColor { get { return _noteColor; } set { _noteColor = value; } }
|
||||
|
||||
private Color _noteLeftLineColor = Color.Green;
|
||||
/// <summary>
|
||||
/// 备忘左侧线条颜色
|
||||
/// </summary>
|
||||
public Color NoteLeftLineColor
|
||||
{
|
||||
get { return _noteLeftLineColor; }
|
||||
set { _noteLeftLineColor = value; }
|
||||
}
|
||||
|
||||
private Color noteForeColor = Color.Black;
|
||||
/// <summary>
|
||||
/// 备忘文字颜色
|
||||
/// </summary>
|
||||
public Color NoteForeColor
|
||||
{
|
||||
get { return noteForeColor; }
|
||||
set { noteForeColor = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 备忘标题
|
||||
/// </summary>
|
||||
public string Title { get; set; }
|
||||
/// <summary>
|
||||
/// 备忘内容
|
||||
/// </summary>
|
||||
public string Note { get; set; }
|
||||
/// <summary>
|
||||
/// 关联数据
|
||||
/// </summary>
|
||||
public object DataSource { get; set; }
|
||||
|
||||
}
|
||||
}
|
120
X009/src/HZH_Controls/Controls/DateTime/UCCalendarNotes.resx
Normal file
120
X009/src/HZH_Controls/Controls/DateTime/UCCalendarNotes.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
289
X009/src/HZH_Controls/Controls/DateTime/UCCalendarNotes_Week.Designer.cs
generated
Normal file
289
X009/src/HZH_Controls/Controls/DateTime/UCCalendarNotes_Week.Designer.cs
generated
Normal file
@ -0,0 +1,289 @@
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
partial class UCCalendarNotes_Week
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.panWeek = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.lblRight = new System.Windows.Forms.Label();
|
||||
this.lblWeek_7 = new System.Windows.Forms.Label();
|
||||
this.lblWeek_6 = new System.Windows.Forms.Label();
|
||||
this.lblWeek_5 = new System.Windows.Forms.Label();
|
||||
this.lblWeek_4 = new System.Windows.Forms.Label();
|
||||
this.lblWeek_3 = new System.Windows.Forms.Label();
|
||||
this.lblWeek_2 = new System.Windows.Forms.Label();
|
||||
this.lblWeek_1 = new System.Windows.Forms.Label();
|
||||
this.lblLeft = new System.Windows.Forms.Label();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.panMain = new System.Windows.Forms.Panel();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
this.lblClose = new System.Windows.Forms.Label();
|
||||
this.lblAdd = new System.Windows.Forms.Label();
|
||||
this.panWeek.SuspendLayout();
|
||||
this.panel1.SuspendLayout();
|
||||
this.panel2.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panWeek
|
||||
//
|
||||
this.panWeek.BackColor = System.Drawing.Color.White;
|
||||
this.panWeek.ColumnCount = 9;
|
||||
this.panWeek.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.panWeek.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 14.28571F));
|
||||
this.panWeek.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 14.28572F));
|
||||
this.panWeek.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 14.28572F));
|
||||
this.panWeek.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 14.28572F));
|
||||
this.panWeek.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 14.28572F));
|
||||
this.panWeek.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 14.28572F));
|
||||
this.panWeek.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 14.28572F));
|
||||
this.panWeek.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 22F));
|
||||
this.panWeek.Controls.Add(this.lblRight, 8, 0);
|
||||
this.panWeek.Controls.Add(this.lblWeek_7, 7, 0);
|
||||
this.panWeek.Controls.Add(this.lblWeek_6, 6, 0);
|
||||
this.panWeek.Controls.Add(this.lblWeek_5, 5, 0);
|
||||
this.panWeek.Controls.Add(this.lblWeek_4, 4, 0);
|
||||
this.panWeek.Controls.Add(this.lblWeek_3, 3, 0);
|
||||
this.panWeek.Controls.Add(this.lblWeek_2, 2, 0);
|
||||
this.panWeek.Controls.Add(this.lblWeek_1, 1, 0);
|
||||
this.panWeek.Controls.Add(this.lblLeft, 0, 0);
|
||||
this.panWeek.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panWeek.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
|
||||
this.panWeek.Location = new System.Drawing.Point(0, 0);
|
||||
this.panWeek.Name = "panWeek";
|
||||
this.panWeek.RowCount = 1;
|
||||
this.panWeek.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.panWeek.Size = new System.Drawing.Size(394, 51);
|
||||
this.panWeek.TabIndex = 3;
|
||||
//
|
||||
// lblRight
|
||||
//
|
||||
this.lblRight.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lblRight.Font = new System.Drawing.Font("宋体", 15F);
|
||||
this.lblRight.Location = new System.Drawing.Point(373, 0);
|
||||
this.lblRight.Name = "lblRight";
|
||||
this.lblRight.Size = new System.Drawing.Size(18, 51);
|
||||
this.lblRight.TabIndex = 8;
|
||||
this.lblRight.Text = "▶";
|
||||
this.lblRight.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.lblRight.MouseClick += new System.Windows.Forms.MouseEventHandler(this.lblRight_MouseClick);
|
||||
//
|
||||
// lblWeek_7
|
||||
//
|
||||
this.lblWeek_7.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lblWeek_7.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.lblWeek_7.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
|
||||
this.lblWeek_7.Location = new System.Drawing.Point(323, 0);
|
||||
this.lblWeek_7.Name = "lblWeek_7";
|
||||
this.lblWeek_7.Size = new System.Drawing.Size(44, 51);
|
||||
this.lblWeek_7.TabIndex = 6;
|
||||
this.lblWeek_7.Text = "六";
|
||||
this.lblWeek_7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.lblWeek_7.Click += new System.EventHandler(this.lblWeek_Click);
|
||||
//
|
||||
// lblWeek_6
|
||||
//
|
||||
this.lblWeek_6.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lblWeek_6.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.lblWeek_6.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
|
||||
this.lblWeek_6.Location = new System.Drawing.Point(273, 0);
|
||||
this.lblWeek_6.Name = "lblWeek_6";
|
||||
this.lblWeek_6.Size = new System.Drawing.Size(44, 51);
|
||||
this.lblWeek_6.TabIndex = 5;
|
||||
this.lblWeek_6.Text = "五";
|
||||
this.lblWeek_6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.lblWeek_6.Click += new System.EventHandler(this.lblWeek_Click);
|
||||
//
|
||||
// lblWeek_5
|
||||
//
|
||||
this.lblWeek_5.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lblWeek_5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.lblWeek_5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
|
||||
this.lblWeek_5.Location = new System.Drawing.Point(223, 0);
|
||||
this.lblWeek_5.Name = "lblWeek_5";
|
||||
this.lblWeek_5.Size = new System.Drawing.Size(44, 51);
|
||||
this.lblWeek_5.TabIndex = 4;
|
||||
this.lblWeek_5.Text = "四";
|
||||
this.lblWeek_5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.lblWeek_5.Click += new System.EventHandler(this.lblWeek_Click);
|
||||
//
|
||||
// lblWeek_4
|
||||
//
|
||||
this.lblWeek_4.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lblWeek_4.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.lblWeek_4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
|
||||
this.lblWeek_4.Location = new System.Drawing.Point(173, 0);
|
||||
this.lblWeek_4.Name = "lblWeek_4";
|
||||
this.lblWeek_4.Size = new System.Drawing.Size(44, 51);
|
||||
this.lblWeek_4.TabIndex = 3;
|
||||
this.lblWeek_4.Text = "三";
|
||||
this.lblWeek_4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.lblWeek_4.Click += new System.EventHandler(this.lblWeek_Click);
|
||||
//
|
||||
// lblWeek_3
|
||||
//
|
||||
this.lblWeek_3.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lblWeek_3.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.lblWeek_3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
|
||||
this.lblWeek_3.Location = new System.Drawing.Point(123, 0);
|
||||
this.lblWeek_3.Name = "lblWeek_3";
|
||||
this.lblWeek_3.Size = new System.Drawing.Size(44, 51);
|
||||
this.lblWeek_3.TabIndex = 2;
|
||||
this.lblWeek_3.Text = "二";
|
||||
this.lblWeek_3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.lblWeek_3.Click += new System.EventHandler(this.lblWeek_Click);
|
||||
//
|
||||
// lblWeek_2
|
||||
//
|
||||
this.lblWeek_2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lblWeek_2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.lblWeek_2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
|
||||
this.lblWeek_2.Location = new System.Drawing.Point(73, 0);
|
||||
this.lblWeek_2.Name = "lblWeek_2";
|
||||
this.lblWeek_2.Size = new System.Drawing.Size(44, 51);
|
||||
this.lblWeek_2.TabIndex = 1;
|
||||
this.lblWeek_2.Text = "一";
|
||||
this.lblWeek_2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.lblWeek_2.Click += new System.EventHandler(this.lblWeek_Click);
|
||||
//
|
||||
// lblWeek_1
|
||||
//
|
||||
this.lblWeek_1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lblWeek_1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.lblWeek_1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
|
||||
this.lblWeek_1.Location = new System.Drawing.Point(23, 0);
|
||||
this.lblWeek_1.Name = "lblWeek_1";
|
||||
this.lblWeek_1.Size = new System.Drawing.Size(44, 51);
|
||||
this.lblWeek_1.TabIndex = 0;
|
||||
this.lblWeek_1.Text = "日";
|
||||
this.lblWeek_1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.lblWeek_1.Click += new System.EventHandler(this.lblWeek_Click);
|
||||
//
|
||||
// lblLeft
|
||||
//
|
||||
this.lblLeft.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lblLeft.Font = new System.Drawing.Font("宋体", 15F);
|
||||
this.lblLeft.Location = new System.Drawing.Point(3, 0);
|
||||
this.lblLeft.Name = "lblLeft";
|
||||
this.lblLeft.Size = new System.Drawing.Size(14, 51);
|
||||
this.lblLeft.TabIndex = 7;
|
||||
this.lblLeft.Text = "◀";
|
||||
this.lblLeft.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.lblLeft.MouseClick += new System.Windows.Forms.MouseEventHandler(this.lblLeft_MouseClick);
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.AutoScroll = true;
|
||||
this.panel1.Controls.Add(this.panMain);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 51);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(482, 354);
|
||||
this.panel1.TabIndex = 4;
|
||||
//
|
||||
// panMain
|
||||
//
|
||||
this.panMain.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.panMain.Location = new System.Drawing.Point(0, 0);
|
||||
this.panMain.Name = "panMain";
|
||||
this.panMain.Size = new System.Drawing.Size(482, 1220);
|
||||
this.panMain.TabIndex = 5;
|
||||
this.panMain.Paint += new System.Windows.Forms.PaintEventHandler(this.panMain_Paint);
|
||||
this.panMain.MouseClick += new System.Windows.Forms.MouseEventHandler(this.panMain_MouseClick);
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
this.panel2.Controls.Add(this.panWeek);
|
||||
this.panel2.Controls.Add(this.lblAdd);
|
||||
this.panel2.Controls.Add(this.lblClose);
|
||||
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel2.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel2.Name = "panel2";
|
||||
this.panel2.Size = new System.Drawing.Size(482, 51);
|
||||
this.panel2.TabIndex = 0;
|
||||
//
|
||||
// lblClose
|
||||
//
|
||||
this.lblClose.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.lblClose.Font = new System.Drawing.Font("微软雅黑", 13F);
|
||||
this.lblClose.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.lblClose.Location = new System.Drawing.Point(438, 0);
|
||||
this.lblClose.Name = "lblClose";
|
||||
this.lblClose.Size = new System.Drawing.Size(44, 51);
|
||||
this.lblClose.TabIndex = 7;
|
||||
this.lblClose.Text = "✖";
|
||||
this.lblClose.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.lblClose.Click += new System.EventHandler(this.lblClose_Click);
|
||||
//
|
||||
// lblAdd
|
||||
//
|
||||
this.lblAdd.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.lblAdd.Font = new System.Drawing.Font("微软雅黑", 9F);
|
||||
this.lblAdd.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
|
||||
this.lblAdd.Location = new System.Drawing.Point(394, 0);
|
||||
this.lblAdd.Name = "lblAdd";
|
||||
this.lblAdd.Size = new System.Drawing.Size(44, 51);
|
||||
this.lblAdd.TabIndex = 8;
|
||||
this.lblAdd.Text = "添加\r\n日程";
|
||||
this.lblAdd.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.lblAdd.Click += new System.EventHandler(this.lblAdd_Click);
|
||||
//
|
||||
// UCCalendarNotes_Week
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Controls.Add(this.panel2);
|
||||
this.Name = "UCCalendarNotes_Week";
|
||||
this.Size = new System.Drawing.Size(482, 405);
|
||||
this.VisibleChanged += new System.EventHandler(this.UCCalendarNotes_Week_VisibleChanged);
|
||||
this.panWeek.ResumeLayout(false);
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.panel2.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TableLayoutPanel panWeek;
|
||||
private System.Windows.Forms.Label lblRight;
|
||||
private System.Windows.Forms.Label lblWeek_7;
|
||||
private System.Windows.Forms.Label lblWeek_6;
|
||||
private System.Windows.Forms.Label lblWeek_5;
|
||||
private System.Windows.Forms.Label lblWeek_4;
|
||||
private System.Windows.Forms.Label lblWeek_3;
|
||||
private System.Windows.Forms.Label lblWeek_2;
|
||||
private System.Windows.Forms.Label lblWeek_1;
|
||||
private System.Windows.Forms.Label lblLeft;
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.Panel panMain;
|
||||
private System.Windows.Forms.Panel panel2;
|
||||
private System.Windows.Forms.Label lblClose;
|
||||
private System.Windows.Forms.Label lblAdd;
|
||||
}
|
||||
}
|
370
X009/src/HZH_Controls/Controls/DateTime/UCCalendarNotes_Week.cs
Normal file
370
X009/src/HZH_Controls/Controls/DateTime/UCCalendarNotes_Week.cs
Normal file
@ -0,0 +1,370 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
[DefaultEvent("ClickNote")]
|
||||
public partial class UCCalendarNotes_Week : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// 点击节点委托
|
||||
/// </summary>
|
||||
/// <param name="note">节点</param>
|
||||
/// <returns>是否刷新列表显示</returns>
|
||||
public delegate bool ClickNoteEvent(NoteEntity note);
|
||||
public delegate void AddNoteEvent(DateTime beginTime);
|
||||
/// <summary>
|
||||
/// 点击节点时间
|
||||
/// </summary>
|
||||
[Description("点击节点事件"), Category("自定义")]
|
||||
public event ClickNoteEvent ClickNote;
|
||||
|
||||
[Description("点击关闭按钮事件"), Category("自定义")]
|
||||
public event EventHandler CloseClick;
|
||||
|
||||
[Description("点击添加按钮事件"), Category("自定义")]
|
||||
public event AddNoteEvent AddClick;
|
||||
private object dataSource;
|
||||
|
||||
List<NoteEntity> _dataSource;
|
||||
List<NoteEntity> _currentDataSource;
|
||||
/// <summary>
|
||||
/// 每个时间点的数据
|
||||
/// </summary>
|
||||
Dictionary<int, List<NoteEntity>> m_lstHourSource = new Dictionary<int, List<NoteEntity>>();
|
||||
Dictionary<int, Rectangle> m_lstAddRect = new Dictionary<int, Rectangle>();
|
||||
Dictionary<NoteEntity, Rectangle> m_lstRects = new Dictionary<NoteEntity, Rectangle>();
|
||||
int maxSplit = 1;
|
||||
int splitWidth = 1;
|
||||
[Description("数据源List<NoteEntity>"), Category("自定义")]
|
||||
public object DataSource
|
||||
{
|
||||
get { return dataSource; }
|
||||
set
|
||||
{
|
||||
dataSource = value;
|
||||
if (value != null)
|
||||
{
|
||||
if (value is List<NoteEntity>)
|
||||
{
|
||||
_dataSource = (List<NoteEntity>)value;
|
||||
ResetCurrentDataSource();
|
||||
Invalidate();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("不是有效的数据源类型");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
[Description("是否显示关闭按钮"), Category("自定义")]
|
||||
public bool ShowCloseButton { get { return lblClose.Visible; } set { lblClose.Visible = value; } }
|
||||
[Description("是否显示添加按钮"), Category("自定义")]
|
||||
public bool ShowAddButton { get { return lblAdd.Visible; } set { lblAdd.Visible = value; } }
|
||||
DateTime m_dt = DateTime.Now;
|
||||
|
||||
[Description("当前日期"), Category("自定义")]
|
||||
public DateTime CurrentTime
|
||||
{
|
||||
get { return m_dt; }
|
||||
set
|
||||
{
|
||||
string old = m_dt.ToString("yyyy-MM-dd");
|
||||
string newStr = value.ToString("yyyy-MM-dd");
|
||||
bool blnRefresh = false;
|
||||
if (old != newStr)
|
||||
{
|
||||
blnRefresh = true;
|
||||
}
|
||||
m_dt = value;
|
||||
SetTimeToControl();
|
||||
ResetCurrentDataSource();
|
||||
if (blnRefresh)
|
||||
panMain.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private Color splitLineColor = Color.FromArgb(153, 153, 153);
|
||||
|
||||
[Description("分割线颜色"), Category("自定义")]
|
||||
public Color SplitLineColor
|
||||
{
|
||||
get { return splitLineColor; }
|
||||
set
|
||||
{
|
||||
splitLineColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private Color splitTimeForeColor = Color.FromArgb(153, 153, 153);
|
||||
|
||||
[Description("分割时间文字颜色"), Category("自定义")]
|
||||
public Color SplitTimeForeColor
|
||||
{
|
||||
get { return splitTimeForeColor; }
|
||||
set
|
||||
{
|
||||
splitTimeForeColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private void ResetCurrentDataSource()
|
||||
{
|
||||
string newStr = m_dt.ToString("yyyy-MM-dd");
|
||||
m_lstHourSource.Clear();
|
||||
m_lstRects.Clear();
|
||||
maxSplit = 1;
|
||||
if (_dataSource != null)
|
||||
{
|
||||
_currentDataSource = _dataSource.FindAll(p => p.BeginTimeStr == newStr || p.EndTimeStr == newStr || (CurrentTime >= p.BeginTime && CurrentTime <= p.EndTime));
|
||||
foreach (var item in _currentDataSource)
|
||||
{
|
||||
DateTime dt2 = DateTime.Parse(item.EndTime.Value.ToString("yyyy-MM-dd") + " " + item.EndTime.Value.Hour + ":00:00");
|
||||
int beginHour = 0;
|
||||
if (item.BeginTime.Day == CurrentTime.Day)
|
||||
beginHour = item.BeginTime.Hour;
|
||||
for (int i = beginHour; i < 24; i++)
|
||||
{
|
||||
DateTime dt1 = DateTime.Parse(item.BeginTime.ToString("yyyy-MM-dd") + " " + i + ":00:00");
|
||||
if (dt1 <= dt2)
|
||||
{
|
||||
if (!m_lstHourSource.ContainsKey(i))
|
||||
m_lstHourSource[i] = new List<NoteEntity>();
|
||||
m_lstHourSource[i].Add(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m_lstHourSource.Count > 0)
|
||||
maxSplit = m_lstHourSource.Max(p => p.Value.Count);
|
||||
CheckCom();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public UCCalendarNotes_Week()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
||||
this.SetStyle(ControlStyles.DoubleBuffer, true);
|
||||
this.SetStyle(ControlStyles.ResizeRedraw, true);
|
||||
this.SetStyle(ControlStyles.Selectable, true);
|
||||
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||||
this.SetStyle(ControlStyles.UserPaint, true);
|
||||
this.SizeChanged += UCCalendarNotes_Week_SizeChanged;
|
||||
}
|
||||
|
||||
void UCCalendarNotes_Week_SizeChanged(object sender, EventArgs e)
|
||||
{
|
||||
splitWidth = this.Width / maxSplit;
|
||||
CheckCom();
|
||||
}
|
||||
|
||||
private void CheckCom()
|
||||
{
|
||||
splitWidth = this.Width / maxSplit;
|
||||
for (int i = 0; i < 24; i++)
|
||||
{
|
||||
if (m_lstHourSource.ContainsKey(i))
|
||||
{
|
||||
int index = 0;
|
||||
var lst = m_lstHourSource[i].OrderBy(p => p.BeginTime);
|
||||
foreach (var item in lst)
|
||||
{
|
||||
if ((item.BeginTime.Hour == i && item.BeginTime.Day == CurrentTime.Day) || i == 0)//如果开始时间在当前区间测画矩形
|
||||
{
|
||||
int y1 = (int)((item.BeginTime.Day == CurrentTime.Day ? item.BeginTime.Minute : 0) / 60.000f * 50.0000f);
|
||||
int rectY = 10 + i * 50 + 1 + y1;
|
||||
int h1 = (int)((item.EndTime.Value - (item.BeginTime.Day == CurrentTime.Day ? item.BeginTime : DateTime.Parse(CurrentTime.ToString("yyyy-MM-dd 00:00:00")))).TotalMinutes);
|
||||
int h2 = (int)((DateTime.Parse(CurrentTime.ToString("yyyy-MM-dd 23:59:59")) - (item.BeginTime.Day == CurrentTime.Day ? item.BeginTime : DateTime.Parse(CurrentTime.ToString("yyyy-MM-dd 00:00:00")))).TotalMinutes);
|
||||
int h = h1;
|
||||
if (h1 > h2)
|
||||
h = h2;
|
||||
int height = (int)(h / 60.000f * 50.0000f);
|
||||
m_lstRects[item] = new Rectangle(40 + index * splitWidth, rectY, splitWidth - 5, height);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle rectAdd = new Rectangle(5, 20 + i * 50, 35, 30);
|
||||
m_lstAddRect[i] = rectAdd;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void SetTimeToControl()
|
||||
{
|
||||
int week = (int)m_dt.DayOfWeek;
|
||||
DateTime _dt = m_dt.AddDays(-week);
|
||||
|
||||
lblWeek_1.Text = "周日\n\r" + _dt.ToString("M-d");
|
||||
lblWeek_1.Tag = _dt;
|
||||
_dt = _dt.AddDays(1);
|
||||
lblWeek_2.Text = "周一\n\r" + _dt.ToString("M-d");
|
||||
lblWeek_2.Tag = _dt;
|
||||
_dt = _dt.AddDays(1);
|
||||
lblWeek_3.Text = "周二\n\r" + _dt.ToString("M-d");
|
||||
lblWeek_3.Tag = _dt;
|
||||
_dt = _dt.AddDays(1);
|
||||
lblWeek_4.Text = "周三\n\r" + _dt.ToString("M-d");
|
||||
lblWeek_4.Tag = _dt;
|
||||
_dt = _dt.AddDays(1);
|
||||
lblWeek_5.Text = "周四\n\r" + _dt.ToString("M-d");
|
||||
lblWeek_5.Tag = _dt;
|
||||
_dt = _dt.AddDays(1);
|
||||
lblWeek_6.Text = "周五\n\r" + _dt.ToString("M-d");
|
||||
lblWeek_6.Tag = _dt;
|
||||
_dt = _dt.AddDays(1);
|
||||
lblWeek_7.Text = "周六\n\r" + _dt.ToString("M-d");
|
||||
lblWeek_7.Tag = _dt;
|
||||
|
||||
foreach (Control item in this.panWeek.Controls)
|
||||
{
|
||||
if (item.Name.StartsWith("lblWeek_"))
|
||||
{
|
||||
if (item.Name == "lblWeek_" + (week + 1))
|
||||
{
|
||||
item.ForeColor = Color.White;
|
||||
item.BackColor = Color.FromArgb(255, 77, 59);
|
||||
}
|
||||
else
|
||||
{
|
||||
item.BackColor = Color.White;
|
||||
item.ForeColor = Color.FromArgb(255, 77, 59);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void panMain_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
var g = e.Graphics;
|
||||
g.SetGDIHigh();
|
||||
//画基础线
|
||||
for (int i = 0; i < 24; i++)
|
||||
{
|
||||
g.DrawString(i.ToString().PadLeft(2, '0') + ":00", new Font("Arial Unicode MS", 9), new SolidBrush(splitTimeForeColor), new PointF(5, 2 + i * 50));
|
||||
g.DrawLine(new Pen(new SolidBrush(splitLineColor), 1), new Point(40, 10 + i * 50), new Point(panMain.Width, 10 + i * 50));
|
||||
|
||||
}
|
||||
g.DrawString("00:00", new Font("Arial Unicode MS", 9), new SolidBrush(splitTimeForeColor), new PointF(5, 2 + 24 * 50));
|
||||
g.DrawLine(new Pen(new SolidBrush(splitLineColor), 1), new Point(40, 10 + 24 * 50), new Point(panMain.Width, 10 + 24 * 50));
|
||||
|
||||
foreach (var item in m_lstRects)
|
||||
{
|
||||
g.FillPath(new SolidBrush(item.Key.NoteColor), item.Value.CreateRoundedRectanglePath(5));
|
||||
g.DrawLine(new Pen(new SolidBrush(item.Key.NoteLeftLineColor), 2), new Point(item.Value.Left + 1, item.Value.Top + 2), new Point(item.Value.Left + 1, item.Value.Bottom - 2));
|
||||
g.DrawString(item.Key.Title, new Font("微软雅黑", 9), new SolidBrush(item.Key.NoteForeColor), new Rectangle(item.Value.Left + 4, item.Value.Top + 1, item.Value.Width - 4, item.Value.Height - 1));
|
||||
}
|
||||
|
||||
foreach (var item in m_lstAddRect)
|
||||
{
|
||||
g.DrawString("+", new Font("微软雅黑", 15), new SolidBrush(splitTimeForeColor), item.Value, new StringFormat() { Alignment= StringAlignment.Center, LineAlignment= StringAlignment.Center});
|
||||
}
|
||||
}
|
||||
|
||||
private void lblLeft_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
CurrentTime = CurrentTime.AddDays(-7);
|
||||
}
|
||||
|
||||
private void lblRight_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
CurrentTime = CurrentTime.AddDays(7);
|
||||
}
|
||||
|
||||
private void panMain_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (!this.panMain.Focused)
|
||||
{
|
||||
//this.FindForm().ActiveControl = this;
|
||||
//this.ActiveControl = panMain;
|
||||
panMain.Focus();
|
||||
}
|
||||
|
||||
if (e.Button == System.Windows.Forms.MouseButtons.Left)
|
||||
{
|
||||
foreach (var item in m_lstAddRect)
|
||||
{
|
||||
if (item.Value.Contains(e.Location))
|
||||
{
|
||||
if (AddClick != null)
|
||||
{
|
||||
AddClick(DateTime.Parse(CurrentTime.ToString("yyyy-MM-dd") + " " + item.Key + ":00:00"));
|
||||
panMain.Invalidate();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var item in m_lstRects)
|
||||
{
|
||||
if (item.Value.Contains(e.Location))
|
||||
{
|
||||
if (ClickNote != null)
|
||||
{
|
||||
int y = panel1.VerticalScroll.Value;
|
||||
ControlHelper.FreezeControl(panel1, true);
|
||||
if (ClickNote(item.Key))
|
||||
{
|
||||
panMain.Invalidate();
|
||||
}
|
||||
if (y != panel1.VerticalScroll.Value)
|
||||
{
|
||||
panel1.VerticalScroll.Value = y;
|
||||
panel1.VerticalScroll.Value = y;
|
||||
}
|
||||
ControlHelper.FreezeControl(panel1, false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void lblWeek_Click(object sender, EventArgs e)
|
||||
{
|
||||
Control c = (Control)sender;
|
||||
CurrentTime = (DateTime)c.Tag;
|
||||
}
|
||||
|
||||
private void lblClose_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (CloseClick != null)
|
||||
CloseClick(this, e);
|
||||
}
|
||||
|
||||
private void UCCalendarNotes_Week_VisibleChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (this.Visible)
|
||||
{
|
||||
//this.FindForm().ActiveControl = this;
|
||||
//this.ActiveControl = panMain;
|
||||
panMain.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
private void lblAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (AddClick != null)
|
||||
{
|
||||
AddClick(DateTime.Parse(CurrentTime.ToString("yyyy-MM-dd")));
|
||||
panMain.Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
384
X009/src/HZH_Controls/Controls/DateTime/UCDatePickerExt.Designer.cs
generated
Normal file
384
X009/src/HZH_Controls/Controls/DateTime/UCDatePickerExt.Designer.cs
generated
Normal file
@ -0,0 +1,384 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-08-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCDatePickerExt.Designer.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCDatePickerExt.
|
||||
/// Implements the <see cref="HZH_Controls.Controls.UCControlBase" />
|
||||
/// </summary>
|
||||
/// <seealso cref="HZH_Controls.Controls.UCControlBase" />
|
||||
partial class UCDatePickerExt
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.txtMinute = new HZH_Controls.Controls.TextBoxEx();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.txtHour = new HZH_Controls.Controls.TextBoxEx();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.txtDay = new HZH_Controls.Controls.TextBoxEx();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.txtMonth = new HZH_Controls.Controls.TextBoxEx();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.txtYear = new HZH_Controls.Controls.TextBoxEx();
|
||||
this.panel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.panel1.Controls.Add(this.label5);
|
||||
this.panel1.Controls.Add(this.txtMinute);
|
||||
this.panel1.Controls.Add(this.label4);
|
||||
this.panel1.Controls.Add(this.txtHour);
|
||||
this.panel1.Controls.Add(this.label3);
|
||||
this.panel1.Controls.Add(this.txtDay);
|
||||
this.panel1.Controls.Add(this.label2);
|
||||
this.panel1.Controls.Add(this.txtMonth);
|
||||
this.panel1.Controls.Add(this.label1);
|
||||
this.panel1.Controls.Add(this.txtYear);
|
||||
this.panel1.Location = new System.Drawing.Point(3, 6);
|
||||
this.panel1.MaximumSize = new System.Drawing.Size(0, 27);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(330, 27);
|
||||
this.panel1.TabIndex = 9;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.label5.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.label5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
|
||||
this.label5.Location = new System.Drawing.Point(301, 0);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(32, 27);
|
||||
this.label5.TabIndex = 17;
|
||||
this.label5.Text = "分";
|
||||
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// txtMinute
|
||||
//
|
||||
this.txtMinute.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.txtMinute.DecLength = 2;
|
||||
this.txtMinute.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.txtMinute.Font = new System.Drawing.Font("Arial Unicode MS", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.txtMinute.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
|
||||
this.txtMinute.InputType = HZH_Controls.TextInputType.Integer;
|
||||
this.txtMinute.Location = new System.Drawing.Point(272, 0);
|
||||
this.txtMinute.MaxValue = new decimal(new int[] {
|
||||
59,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.txtMinute.MinValue = new decimal(new int[] {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.txtMinute.MyRectangle = new System.Drawing.Rectangle(0, 0, 0, 0);
|
||||
this.txtMinute.Name = "txtMinute";
|
||||
this.txtMinute.OldText = null;
|
||||
this.txtMinute.PromptColor = System.Drawing.Color.Gray;
|
||||
this.txtMinute.PromptFont = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.txtMinute.PromptText = "";
|
||||
this.txtMinute.RegexPattern = "";
|
||||
this.txtMinute.Size = new System.Drawing.Size(29, 27);
|
||||
this.txtMinute.TabIndex = 5;
|
||||
this.txtMinute.Text = "59";
|
||||
this.txtMinute.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
this.txtMinute.SizeChanged += new System.EventHandler(this.txt_SizeChanged);
|
||||
this.txtMinute.Leave += new System.EventHandler(this.txtMinute_Leave);
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.label4.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.label4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
|
||||
this.label4.Location = new System.Drawing.Point(240, 0);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(32, 27);
|
||||
this.label4.TabIndex = 16;
|
||||
this.label4.Text = "时";
|
||||
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// txtHour
|
||||
//
|
||||
this.txtHour.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.txtHour.DecLength = 2;
|
||||
this.txtHour.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.txtHour.Font = new System.Drawing.Font("Arial Unicode MS", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.txtHour.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
|
||||
this.txtHour.InputType = HZH_Controls.TextInputType.Integer;
|
||||
this.txtHour.Location = new System.Drawing.Point(211, 0);
|
||||
this.txtHour.MaxValue = new decimal(new int[] {
|
||||
23,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.txtHour.MinValue = new decimal(new int[] {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.txtHour.MyRectangle = new System.Drawing.Rectangle(0, 0, 0, 0);
|
||||
this.txtHour.Name = "txtHour";
|
||||
this.txtHour.OldText = null;
|
||||
this.txtHour.PromptColor = System.Drawing.Color.Gray;
|
||||
this.txtHour.PromptFont = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.txtHour.PromptText = "";
|
||||
this.txtHour.RegexPattern = "";
|
||||
this.txtHour.Size = new System.Drawing.Size(29, 27);
|
||||
this.txtHour.TabIndex = 4;
|
||||
this.txtHour.Text = "23";
|
||||
this.txtHour.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
this.txtHour.SizeChanged += new System.EventHandler(this.txt_SizeChanged);
|
||||
this.txtHour.TextChanged += new System.EventHandler(this.txtHour_TextChanged);
|
||||
this.txtHour.Leave += new System.EventHandler(this.txtHour_Leave);
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.label3.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.label3.Location = new System.Drawing.Point(173, 0);
|
||||
this.label3.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(38, 27);
|
||||
this.label3.TabIndex = 14;
|
||||
this.label3.Text = " 日";
|
||||
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// txtDay
|
||||
//
|
||||
this.txtDay.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.txtDay.DecLength = 2;
|
||||
this.txtDay.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.txtDay.Font = new System.Drawing.Font("Arial Unicode MS", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.txtDay.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
|
||||
this.txtDay.InputType = HZH_Controls.TextInputType.Integer;
|
||||
this.txtDay.Location = new System.Drawing.Point(144, 0);
|
||||
this.txtDay.MaxValue = new decimal(new int[] {
|
||||
31,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.txtDay.MinValue = new decimal(new int[] {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.txtDay.MyRectangle = new System.Drawing.Rectangle(0, 0, 0, 0);
|
||||
this.txtDay.Name = "txtDay";
|
||||
this.txtDay.OldText = null;
|
||||
this.txtDay.PromptColor = System.Drawing.Color.Gray;
|
||||
this.txtDay.PromptFont = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.txtDay.PromptText = "";
|
||||
this.txtDay.RegexPattern = "";
|
||||
this.txtDay.Size = new System.Drawing.Size(29, 27);
|
||||
this.txtDay.TabIndex = 3;
|
||||
this.txtDay.Text = "12";
|
||||
this.txtDay.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
this.txtDay.SizeChanged += new System.EventHandler(this.txt_SizeChanged);
|
||||
this.txtDay.TextChanged += new System.EventHandler(this.txtDay_TextChanged);
|
||||
this.txtDay.Leave += new System.EventHandler(this.txtDay_Leave);
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.label2.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
|
||||
this.label2.Location = new System.Drawing.Point(112, 0);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(32, 27);
|
||||
this.label2.TabIndex = 12;
|
||||
this.label2.Text = "月";
|
||||
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// txtMonth
|
||||
//
|
||||
this.txtMonth.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.txtMonth.DecLength = 2;
|
||||
this.txtMonth.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.txtMonth.Font = new System.Drawing.Font("Arial Unicode MS", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.txtMonth.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
|
||||
this.txtMonth.InputType = HZH_Controls.TextInputType.Integer;
|
||||
this.txtMonth.Location = new System.Drawing.Point(83, 0);
|
||||
this.txtMonth.MaxValue = new decimal(new int[] {
|
||||
12,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.txtMonth.MinValue = new decimal(new int[] {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.txtMonth.MyRectangle = new System.Drawing.Rectangle(0, 0, 0, 0);
|
||||
this.txtMonth.Name = "txtMonth";
|
||||
this.txtMonth.OldText = null;
|
||||
this.txtMonth.PromptColor = System.Drawing.Color.Gray;
|
||||
this.txtMonth.PromptFont = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.txtMonth.PromptText = "";
|
||||
this.txtMonth.RegexPattern = "";
|
||||
this.txtMonth.Size = new System.Drawing.Size(29, 27);
|
||||
this.txtMonth.TabIndex = 2;
|
||||
this.txtMonth.Text = "12";
|
||||
this.txtMonth.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
this.txtMonth.SizeChanged += new System.EventHandler(this.txt_SizeChanged);
|
||||
this.txtMonth.TextChanged += new System.EventHandler(this.txtMonth_TextChanged);
|
||||
this.txtMonth.Leave += new System.EventHandler(this.txtMonth_Leave);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.label1.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
|
||||
this.label1.Location = new System.Drawing.Point(51, 0);
|
||||
this.label1.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(32, 27);
|
||||
this.label1.TabIndex = 10;
|
||||
this.label1.Text = "年";
|
||||
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// txtYear
|
||||
//
|
||||
this.txtYear.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.txtYear.DecLength = 2;
|
||||
this.txtYear.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.txtYear.Font = new System.Drawing.Font("Arial Unicode MS", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.txtYear.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
|
||||
this.txtYear.InputType = HZH_Controls.TextInputType.Integer;
|
||||
this.txtYear.Location = new System.Drawing.Point(0, 0);
|
||||
this.txtYear.MaxValue = new decimal(new int[] {
|
||||
2099,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.txtYear.MinValue = new decimal(new int[] {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.txtYear.MyRectangle = new System.Drawing.Rectangle(0, 0, 0, 0);
|
||||
this.txtYear.Name = "txtYear";
|
||||
this.txtYear.OldText = null;
|
||||
this.txtYear.PromptColor = System.Drawing.Color.Gray;
|
||||
this.txtYear.PromptFont = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.txtYear.PromptText = "";
|
||||
this.txtYear.RegexPattern = "";
|
||||
this.txtYear.Size = new System.Drawing.Size(51, 27);
|
||||
this.txtYear.TabIndex = 1;
|
||||
this.txtYear.Text = "2019";
|
||||
this.txtYear.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
this.txtYear.SizeChanged += new System.EventHandler(this.txt_SizeChanged);
|
||||
this.txtYear.TextChanged += new System.EventHandler(this.txtYear_TextChanged);
|
||||
this.txtYear.Leave += new System.EventHandler(this.txtYear_Leave);
|
||||
//
|
||||
// UCDatePickerExt
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.ConerRadius = 5;
|
||||
this.Controls.Add(this.panel1);
|
||||
this.IsRadius = true;
|
||||
this.IsShowRect = true;
|
||||
this.Name = "UCDatePickerExt";
|
||||
this.Padding = new System.Windows.Forms.Padding(0, 10, 0, 0);
|
||||
this.Size = new System.Drawing.Size(336, 39);
|
||||
this.Load += new System.EventHandler(this.UCDatePickerExt_Load);
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.panel1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// The panel1
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
/// <summary>
|
||||
/// The label4
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Label label4;
|
||||
/// <summary>
|
||||
/// The label3
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Label label3;
|
||||
/// <summary>
|
||||
/// The label2
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Label label2;
|
||||
/// <summary>
|
||||
/// The label1
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Label label1;
|
||||
/// <summary>
|
||||
/// The text minute
|
||||
/// </summary>
|
||||
private TextBoxEx txtMinute;
|
||||
/// <summary>
|
||||
/// The text hour
|
||||
/// </summary>
|
||||
private TextBoxEx txtHour;
|
||||
/// <summary>
|
||||
/// The text day
|
||||
/// </summary>
|
||||
private TextBoxEx txtDay;
|
||||
/// <summary>
|
||||
/// The text month
|
||||
/// </summary>
|
||||
private TextBoxEx txtMonth;
|
||||
/// <summary>
|
||||
/// The text year
|
||||
/// </summary>
|
||||
private TextBoxEx txtYear;
|
||||
/// <summary>
|
||||
/// The label5
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Label label5;
|
||||
}
|
||||
}
|
382
X009/src/HZH_Controls/Controls/DateTime/UCDatePickerExt.cs
Normal file
382
X009/src/HZH_Controls/Controls/DateTime/UCDatePickerExt.cs
Normal file
@ -0,0 +1,382 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-08-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCDatePickerExt.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCDatePickerExt.
|
||||
/// Implements the <see cref="HZH_Controls.Controls.UCControlBase" />
|
||||
/// </summary>
|
||||
/// <seealso cref="HZH_Controls.Controls.UCControlBase" />
|
||||
public partial class UCDatePickerExt : UCControlBase
|
||||
{
|
||||
/// <summary>
|
||||
/// The m FRM anchor
|
||||
/// </summary>
|
||||
Forms.FrmAnchor m_frmAnchor;
|
||||
/// <summary>
|
||||
/// The m select pan
|
||||
/// </summary>
|
||||
UCDateTimeSelectPan m_selectPan = null;
|
||||
/// <summary>
|
||||
/// The m type
|
||||
/// </summary>
|
||||
DateTimePickerType m_type = DateTimePickerType.DateTime;
|
||||
/// <summary>
|
||||
/// Gets or sets the type of the time.
|
||||
/// </summary>
|
||||
/// <value>The type of the time.</value>
|
||||
[Description("时间类型"), Category("自定义")]
|
||||
public DateTimePickerType TimeType
|
||||
{
|
||||
get { return m_type; }
|
||||
set
|
||||
{
|
||||
m_type = value;
|
||||
if (value == DateTimePickerType.DateTime)
|
||||
{
|
||||
txtYear.Visible = true;
|
||||
label1.Visible = true;
|
||||
txtMonth.Visible = true;
|
||||
label2.Visible = true;
|
||||
txtDay.Visible = true;
|
||||
label3.Visible = true;
|
||||
txtHour.Visible = true;
|
||||
label4.Visible = true;
|
||||
txtMinute.Visible = true;
|
||||
label5.Visible = true;
|
||||
}
|
||||
else if (value == DateTimePickerType.Date)
|
||||
{
|
||||
txtYear.Visible = true;
|
||||
label1.Visible = true;
|
||||
txtMonth.Visible = true;
|
||||
label2.Visible = true;
|
||||
txtDay.Visible = true;
|
||||
label3.Visible = true;
|
||||
txtHour.Visible = false;
|
||||
label4.Visible = false;
|
||||
txtMinute.Visible = false;
|
||||
label5.Visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
txtYear.Visible = false;
|
||||
label1.Visible = false;
|
||||
txtMonth.Visible = false;
|
||||
label2.Visible = false;
|
||||
txtDay.Visible = false;
|
||||
label3.Visible = false;
|
||||
txtHour.Visible = true;
|
||||
label4.Visible = true;
|
||||
txtMinute.Visible = true;
|
||||
label5.Visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The current time
|
||||
/// </summary>
|
||||
private DateTime currentTime = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// The time font size
|
||||
/// </summary>
|
||||
private int timeFontSize = 20;
|
||||
/// <summary>
|
||||
/// Gets or sets the size of the time font.
|
||||
/// </summary>
|
||||
/// <value>The size of the time font.</value>
|
||||
[Description("时间字体大小"), Category("自定义")]
|
||||
public int TimeFontSize
|
||||
{
|
||||
get { return timeFontSize; }
|
||||
set
|
||||
{
|
||||
if (timeFontSize != value)
|
||||
{
|
||||
timeFontSize = value;
|
||||
foreach (Control c in panel1.Controls)
|
||||
{
|
||||
c.Font = new Font(c.Font.Name, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the current time.
|
||||
/// </summary>
|
||||
/// <value>The current time.</value>
|
||||
[Description("时间"), Category("自定义")]
|
||||
[Localizable(true)]
|
||||
public DateTime CurrentTime
|
||||
{
|
||||
get { return currentTime; }
|
||||
set
|
||||
{
|
||||
currentTime = value;
|
||||
SetTimeToControl();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the time to control.
|
||||
/// </summary>
|
||||
private void SetTimeToControl()
|
||||
{
|
||||
var y = CurrentTime.Year;
|
||||
var M = CurrentTime.Month;
|
||||
var d = CurrentTime.Day;
|
||||
var h = CurrentTime.Hour;
|
||||
var m = CurrentTime.Minute;
|
||||
this.txtYear.Text = y.ToString();
|
||||
this.txtMonth.Text = M.ToString().PadLeft(2, '0');
|
||||
this.txtDay.Text = d.ToString().PadLeft(2, '0');
|
||||
this.txtHour.Text = h.ToString().PadLeft(2, '0');
|
||||
this.txtMinute.Text = m.ToString().PadLeft(2, '0');
|
||||
}
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCDatePickerExt" /> class.
|
||||
/// </summary>
|
||||
public UCDatePickerExt()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.SizeChanged += UCDatePickerExt_SizeChanged;
|
||||
}
|
||||
|
||||
void UCDatePickerExt_SizeChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the Load event of the UCDatePickerExt control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void UCDatePickerExt_Load(object sender, EventArgs e)
|
||||
{
|
||||
SetTimeToControl();
|
||||
panel1.Height = this.txtDay.Height;
|
||||
|
||||
panel1.Width = this.Width - 6;
|
||||
SetEvent(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the event.
|
||||
/// </summary>
|
||||
/// <param name="c">The c.</param>
|
||||
private void SetEvent(Control c)
|
||||
{
|
||||
if (c != null)
|
||||
{
|
||||
c.MouseDown += c_MouseDown;
|
||||
foreach (Control item in c.Controls)
|
||||
{
|
||||
SetEvent(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the MouseDown event of the c control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
|
||||
void c_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (m_selectPan == null)
|
||||
{
|
||||
m_selectPan = new UCDateTimeSelectPan();
|
||||
m_selectPan.SelectedTimeEvent += uc_SelectedTimeEvent;
|
||||
m_selectPan.CancelTimeEvent += m_selectPan_CancelTimeEvent;
|
||||
}
|
||||
m_selectPan.CurrentTime = currentTime;
|
||||
m_selectPan.TimeType = m_type;
|
||||
m_frmAnchor = new Forms.FrmAnchor(this, m_selectPan);
|
||||
m_frmAnchor.Show(this.FindForm());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the CancelTimeEvent event of the m_selectPan control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
void m_selectPan_CancelTimeEvent(object sender, EventArgs e)
|
||||
{
|
||||
m_frmAnchor.Hide();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the SelectedTimeEvent event of the uc control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
void uc_SelectedTimeEvent(object sender, EventArgs e)
|
||||
{
|
||||
CurrentTime = m_selectPan.CurrentTime;
|
||||
m_frmAnchor.Hide();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the TextChanged event of the txtYear control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void txtYear_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (txtYear.Text.Length == 4)
|
||||
this.ActiveControl = txtMonth;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the TextChanged event of the txtMonth control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void txtMonth_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (txtMonth.Text.Length == 2 || txtMonth.Text.ToInt() >= 3)
|
||||
{
|
||||
this.ActiveControl = txtDay;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the TextChanged event of the txtDay control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void txtDay_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (m_type == DateTimePickerType.Date)
|
||||
return;
|
||||
if (txtDay.Text.Length == 2 || txtDay.Text.ToInt() >= 4)
|
||||
{
|
||||
this.ActiveControl = txtHour;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the TextChanged event of the txtHour control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void txtHour_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (txtHour.Text.Length == 2 || txtHour.Text.ToInt() >= 3)
|
||||
{
|
||||
this.ActiveControl = txtMinute;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the Leave event of the txtYear control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void txtYear_Leave(object sender, EventArgs e)
|
||||
{
|
||||
if (txtYear.Text.ToInt() < 1990)
|
||||
{
|
||||
txtYear.Text = currentTime.Year.ToString();
|
||||
}
|
||||
currentTime = (txtYear.Text + currentTime.ToString("-MM-dd HH:mm:ss")).ToDate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the Leave event of the txtMonth control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void txtMonth_Leave(object sender, EventArgs e)
|
||||
{
|
||||
if (txtMonth.Text.ToInt() < 1)
|
||||
{
|
||||
txtMonth.Text = currentTime.Month.ToString().PadLeft(2, '0');
|
||||
}
|
||||
txtMonth.Text = txtMonth.Text.PadLeft(2, '0');
|
||||
currentTime = (currentTime.ToString("yyyy-" + txtMonth.Text + "-dd HH:mm:ss")).ToDate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the Leave event of the txtDay control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void txtDay_Leave(object sender, EventArgs e)
|
||||
{
|
||||
if (txtDay.Text.ToInt() < 1 || txtDay.Text.ToInt() > DateTime.DaysInMonth(currentTime.Year, currentTime.Month))
|
||||
{
|
||||
txtDay.Text = currentTime.Day.ToString().PadLeft(2, '0');
|
||||
}
|
||||
txtDay.Text = txtDay.Text.PadLeft(2, '0');
|
||||
currentTime = (currentTime.ToString("yyyy-MM-" + txtDay.Text + " HH:mm:ss")).ToDate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the Leave event of the txtHour control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void txtHour_Leave(object sender, EventArgs e)
|
||||
{
|
||||
if (txtHour.Text.ToInt() < 1)
|
||||
{
|
||||
txtHour.Text = currentTime.Hour.ToString().PadLeft(2, '0');
|
||||
}
|
||||
txtHour.Text = txtHour.Text.PadLeft(2, '0');
|
||||
currentTime = (currentTime.ToString("yyyy-MM-dd " + txtHour.Text + ":mm:ss")).ToDate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the Leave event of the txtMinute control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void txtMinute_Leave(object sender, EventArgs e)
|
||||
{
|
||||
if (txtMinute.Text.ToInt() < 1)
|
||||
{
|
||||
txtMinute.Text = currentTime.Minute.ToString().PadLeft(2, '0');
|
||||
}
|
||||
txtMinute.Text = txtMinute.Text.PadLeft(2, '0');
|
||||
currentTime = (currentTime.ToString("yyyy-MM-dd HH:" + txtMinute.Text + ":ss")).ToDate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the SizeChanged event of the txt control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void txt_SizeChanged(object sender, EventArgs e)
|
||||
{
|
||||
panel1.Height = (sender as TextBoxEx).Height;
|
||||
}
|
||||
}
|
||||
}
|
120
X009/src/HZH_Controls/Controls/DateTime/UCDatePickerExt.resx
Normal file
120
X009/src/HZH_Controls/Controls/DateTime/UCDatePickerExt.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
337
X009/src/HZH_Controls/Controls/DateTime/UCDatePickerExt2.Designer.cs
generated
Normal file
337
X009/src/HZH_Controls/Controls/DateTime/UCDatePickerExt2.Designer.cs
generated
Normal file
@ -0,0 +1,337 @@
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
partial class UCDatePickerExt2
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.txtMinute = new HZH_Controls.Controls.TextBoxEx();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.txtHour = new HZH_Controls.Controls.TextBoxEx();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.txtDay = new HZH_Controls.Controls.TextBoxEx();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.txtMonth = new HZH_Controls.Controls.TextBoxEx();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.txtYear = new HZH_Controls.Controls.TextBoxEx();
|
||||
this.panel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.panel1.Controls.Add(this.label5);
|
||||
this.panel1.Controls.Add(this.txtMinute);
|
||||
this.panel1.Controls.Add(this.label4);
|
||||
this.panel1.Controls.Add(this.txtHour);
|
||||
this.panel1.Controls.Add(this.label3);
|
||||
this.panel1.Controls.Add(this.txtDay);
|
||||
this.panel1.Controls.Add(this.label2);
|
||||
this.panel1.Controls.Add(this.txtMonth);
|
||||
this.panel1.Controls.Add(this.label1);
|
||||
this.panel1.Controls.Add(this.txtYear);
|
||||
this.panel1.Location = new System.Drawing.Point(3, 6);
|
||||
this.panel1.MaximumSize = new System.Drawing.Size(0, 27);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(330, 27);
|
||||
this.panel1.TabIndex = 10;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.BackColor = System.Drawing.Color.White;
|
||||
this.label5.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.label5.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.label5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
|
||||
this.label5.Location = new System.Drawing.Point(301, 0);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(32, 27);
|
||||
this.label5.TabIndex = 17;
|
||||
this.label5.Text = "分";
|
||||
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// txtMinute
|
||||
//
|
||||
this.txtMinute.BackColor = System.Drawing.Color.White;
|
||||
this.txtMinute.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.txtMinute.DecLength = 2;
|
||||
this.txtMinute.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.txtMinute.Font = new System.Drawing.Font("Arial Unicode MS", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.txtMinute.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
|
||||
this.txtMinute.InputType = HZH_Controls.TextInputType.Integer;
|
||||
this.txtMinute.Location = new System.Drawing.Point(272, 0);
|
||||
this.txtMinute.MaxValue = new decimal(new int[] {
|
||||
59,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.txtMinute.MinValue = new decimal(new int[] {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.txtMinute.MyRectangle = new System.Drawing.Rectangle(0, 0, 0, 0);
|
||||
this.txtMinute.Name = "txtMinute";
|
||||
this.txtMinute.OldText = null;
|
||||
this.txtMinute.PromptColor = System.Drawing.Color.Gray;
|
||||
this.txtMinute.PromptFont = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.txtMinute.PromptText = "";
|
||||
this.txtMinute.RegexPattern = "";
|
||||
this.txtMinute.Size = new System.Drawing.Size(29, 27);
|
||||
this.txtMinute.TabIndex = 5;
|
||||
this.txtMinute.Text = "59";
|
||||
this.txtMinute.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
this.txtMinute.Leave += new System.EventHandler(this.txtMinute_Leave);
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.BackColor = System.Drawing.Color.White;
|
||||
this.label4.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.label4.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.label4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
|
||||
this.label4.Location = new System.Drawing.Point(240, 0);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(32, 27);
|
||||
this.label4.TabIndex = 16;
|
||||
this.label4.Text = "时";
|
||||
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// txtHour
|
||||
//
|
||||
this.txtHour.BackColor = System.Drawing.Color.White;
|
||||
this.txtHour.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.txtHour.DecLength = 2;
|
||||
this.txtHour.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.txtHour.Font = new System.Drawing.Font("Arial Unicode MS", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.txtHour.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
|
||||
this.txtHour.InputType = HZH_Controls.TextInputType.Integer;
|
||||
this.txtHour.Location = new System.Drawing.Point(211, 0);
|
||||
this.txtHour.MaxValue = new decimal(new int[] {
|
||||
23,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.txtHour.MinValue = new decimal(new int[] {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.txtHour.MyRectangle = new System.Drawing.Rectangle(0, 0, 0, 0);
|
||||
this.txtHour.Name = "txtHour";
|
||||
this.txtHour.OldText = null;
|
||||
this.txtHour.PromptColor = System.Drawing.Color.Gray;
|
||||
this.txtHour.PromptFont = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.txtHour.PromptText = "";
|
||||
this.txtHour.RegexPattern = "";
|
||||
this.txtHour.Size = new System.Drawing.Size(29, 27);
|
||||
this.txtHour.TabIndex = 4;
|
||||
this.txtHour.Text = "23";
|
||||
this.txtHour.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
this.txtHour.TextChanged += new System.EventHandler(this.txtHour_TextChanged);
|
||||
this.txtHour.Leave += new System.EventHandler(this.txtHour_Leave);
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.BackColor = System.Drawing.Color.White;
|
||||
this.label3.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.label3.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.label3.Location = new System.Drawing.Point(173, 0);
|
||||
this.label3.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(38, 27);
|
||||
this.label3.TabIndex = 14;
|
||||
this.label3.Text = " 日";
|
||||
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// txtDay
|
||||
//
|
||||
this.txtDay.BackColor = System.Drawing.Color.White;
|
||||
this.txtDay.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.txtDay.DecLength = 2;
|
||||
this.txtDay.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.txtDay.Font = new System.Drawing.Font("Arial Unicode MS", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.txtDay.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
|
||||
this.txtDay.InputType = HZH_Controls.TextInputType.Integer;
|
||||
this.txtDay.Location = new System.Drawing.Point(144, 0);
|
||||
this.txtDay.MaxValue = new decimal(new int[] {
|
||||
31,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.txtDay.MinValue = new decimal(new int[] {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.txtDay.MyRectangle = new System.Drawing.Rectangle(0, 0, 0, 0);
|
||||
this.txtDay.Name = "txtDay";
|
||||
this.txtDay.OldText = null;
|
||||
this.txtDay.PromptColor = System.Drawing.Color.Gray;
|
||||
this.txtDay.PromptFont = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.txtDay.PromptText = "";
|
||||
this.txtDay.RegexPattern = "";
|
||||
this.txtDay.Size = new System.Drawing.Size(29, 27);
|
||||
this.txtDay.TabIndex = 3;
|
||||
this.txtDay.Text = "12";
|
||||
this.txtDay.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
this.txtDay.TextChanged += new System.EventHandler(this.txtDay_TextChanged);
|
||||
this.txtDay.Leave += new System.EventHandler(this.txtDay_Leave);
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.BackColor = System.Drawing.Color.White;
|
||||
this.label2.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.label2.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
|
||||
this.label2.Location = new System.Drawing.Point(112, 0);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(32, 27);
|
||||
this.label2.TabIndex = 12;
|
||||
this.label2.Text = "月";
|
||||
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// txtMonth
|
||||
//
|
||||
this.txtMonth.BackColor = System.Drawing.Color.White;
|
||||
this.txtMonth.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.txtMonth.DecLength = 2;
|
||||
this.txtMonth.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.txtMonth.Font = new System.Drawing.Font("Arial Unicode MS", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.txtMonth.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
|
||||
this.txtMonth.InputType = HZH_Controls.TextInputType.Integer;
|
||||
this.txtMonth.Location = new System.Drawing.Point(83, 0);
|
||||
this.txtMonth.MaxValue = new decimal(new int[] {
|
||||
12,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.txtMonth.MinValue = new decimal(new int[] {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.txtMonth.MyRectangle = new System.Drawing.Rectangle(0, 0, 0, 0);
|
||||
this.txtMonth.Name = "txtMonth";
|
||||
this.txtMonth.OldText = null;
|
||||
this.txtMonth.PromptColor = System.Drawing.Color.Gray;
|
||||
this.txtMonth.PromptFont = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.txtMonth.PromptText = "";
|
||||
this.txtMonth.RegexPattern = "";
|
||||
this.txtMonth.Size = new System.Drawing.Size(29, 27);
|
||||
this.txtMonth.TabIndex = 2;
|
||||
this.txtMonth.Text = "12";
|
||||
this.txtMonth.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
this.txtMonth.TextChanged += new System.EventHandler(this.txtMonth_TextChanged);
|
||||
this.txtMonth.Leave += new System.EventHandler(this.txtMonth_Leave);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.BackColor = System.Drawing.Color.White;
|
||||
this.label1.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.label1.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
|
||||
this.label1.Location = new System.Drawing.Point(51, 0);
|
||||
this.label1.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(32, 27);
|
||||
this.label1.TabIndex = 10;
|
||||
this.label1.Text = "年";
|
||||
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// txtYear
|
||||
//
|
||||
this.txtYear.BackColor = System.Drawing.Color.White;
|
||||
this.txtYear.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.txtYear.DecLength = 2;
|
||||
this.txtYear.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.txtYear.Font = new System.Drawing.Font("Arial Unicode MS", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.txtYear.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
|
||||
this.txtYear.InputType = HZH_Controls.TextInputType.Integer;
|
||||
this.txtYear.Location = new System.Drawing.Point(0, 0);
|
||||
this.txtYear.MaxValue = new decimal(new int[] {
|
||||
2099,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.txtYear.MinValue = new decimal(new int[] {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.txtYear.MyRectangle = new System.Drawing.Rectangle(0, 0, 0, 0);
|
||||
this.txtYear.Name = "txtYear";
|
||||
this.txtYear.OldText = null;
|
||||
this.txtYear.PromptColor = System.Drawing.Color.Gray;
|
||||
this.txtYear.PromptFont = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.txtYear.PromptText = "";
|
||||
this.txtYear.RegexPattern = "";
|
||||
this.txtYear.Size = new System.Drawing.Size(51, 27);
|
||||
this.txtYear.TabIndex = 1;
|
||||
this.txtYear.Text = "2019";
|
||||
this.txtYear.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
this.txtYear.TextChanged += new System.EventHandler(this.txtYear_TextChanged);
|
||||
this.txtYear.Leave += new System.EventHandler(this.txtYear_Leave);
|
||||
//
|
||||
// UCDatePickerExt2
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackColor = System.Drawing.Color.Transparent;
|
||||
this.ConerRadius = 5;
|
||||
this.Controls.Add(this.panel1);
|
||||
this.FillColor = System.Drawing.Color.White;
|
||||
this.IsRadius = true;
|
||||
this.IsShowRect = true;
|
||||
this.Name = "UCDatePickerExt2";
|
||||
this.Size = new System.Drawing.Size(336, 39);
|
||||
this.Load += new System.EventHandler(this.UCDatePickerExt2_Load);
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.panel1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private TextBoxEx txtMinute;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private TextBoxEx txtHour;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private TextBoxEx txtDay;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private TextBoxEx txtMonth;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private TextBoxEx txtYear;
|
||||
|
||||
}
|
||||
}
|
360
X009/src/HZH_Controls/Controls/DateTime/UCDatePickerExt2.cs
Normal file
360
X009/src/HZH_Controls/Controls/DateTime/UCDatePickerExt2.cs
Normal file
@ -0,0 +1,360 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2020-07-11
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCDatePickerExt2.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
public partial class UCDatePickerExt2 : UCControlBase
|
||||
{
|
||||
/// <summary>
|
||||
/// The m FRM anchor
|
||||
/// </summary>
|
||||
Forms.FrmAnchor m_frmAnchor;
|
||||
UCDateTimeSelectPan2 m_selectPan = null;
|
||||
/// <summary>
|
||||
/// The m type
|
||||
/// </summary>
|
||||
DateTimePickerType m_type = DateTimePickerType.DateTime;
|
||||
/// <summary>
|
||||
/// Gets or sets the type of the time.
|
||||
/// </summary>
|
||||
/// <value>The type of the time.</value>
|
||||
[Description("时间类型"), Category("自定义")]
|
||||
public DateTimePickerType TimeType
|
||||
{
|
||||
get { return m_type; }
|
||||
set
|
||||
{
|
||||
m_type = value;
|
||||
if (value == DateTimePickerType.DateTime)
|
||||
{
|
||||
txtYear.Visible = true;
|
||||
label1.Visible = true;
|
||||
txtMonth.Visible = true;
|
||||
label2.Visible = true;
|
||||
txtDay.Visible = true;
|
||||
label3.Visible = true;
|
||||
txtHour.Visible = true;
|
||||
label4.Visible = true;
|
||||
txtMinute.Visible = true;
|
||||
label5.Visible = true;
|
||||
}
|
||||
else if (value == DateTimePickerType.Date)
|
||||
{
|
||||
txtYear.Visible = true;
|
||||
label1.Visible = true;
|
||||
txtMonth.Visible = true;
|
||||
label2.Visible = true;
|
||||
txtDay.Visible = true;
|
||||
label3.Visible = true;
|
||||
txtHour.Visible = false;
|
||||
label4.Visible = false;
|
||||
txtMinute.Visible = false;
|
||||
label5.Visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
txtYear.Visible = false;
|
||||
label1.Visible = false;
|
||||
txtMonth.Visible = false;
|
||||
label2.Visible = false;
|
||||
txtDay.Visible = false;
|
||||
label3.Visible = false;
|
||||
txtHour.Visible = true;
|
||||
label4.Visible = true;
|
||||
txtMinute.Visible = true;
|
||||
label5.Visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The current time
|
||||
/// </summary>
|
||||
private DateTime currentTime = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// The time font size
|
||||
/// </summary>
|
||||
private int timeFontSize = 20;
|
||||
/// <summary>
|
||||
/// Gets or sets the size of the time font.
|
||||
/// </summary>
|
||||
/// <value>The size of the time font.</value>
|
||||
[Description("时间字体大小"), Category("自定义")]
|
||||
public int TimeFontSize
|
||||
{
|
||||
get { return timeFontSize; }
|
||||
set
|
||||
{
|
||||
if (timeFontSize != value)
|
||||
{
|
||||
timeFontSize = value;
|
||||
foreach (Control c in panel1.Controls)
|
||||
{
|
||||
c.Font = new Font(c.Font.Name, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets or sets the current time.
|
||||
/// </summary>
|
||||
/// <value>The current time.</value>
|
||||
[Description("时间"), Category("自定义")]
|
||||
[Localizable(true)]
|
||||
public DateTime CurrentTime
|
||||
{
|
||||
get { return currentTime; }
|
||||
set
|
||||
{
|
||||
currentTime = value;
|
||||
SetTimeToControl();
|
||||
}
|
||||
}
|
||||
private Color selectColor = Color.FromArgb(255, 77, 59);
|
||||
/// <summary>
|
||||
/// 选中颜色
|
||||
/// </summary>
|
||||
public Color SelectColor
|
||||
{
|
||||
get { return selectColor; }
|
||||
set { selectColor = value; }
|
||||
}
|
||||
public UCDatePickerExt2()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
/// <summary>
|
||||
/// Sets the time to control.
|
||||
/// </summary>
|
||||
private void SetTimeToControl()
|
||||
{
|
||||
var y = CurrentTime.Year;
|
||||
var M = CurrentTime.Month;
|
||||
var d = CurrentTime.Day;
|
||||
var h = CurrentTime.Hour;
|
||||
var m = CurrentTime.Minute;
|
||||
this.txtYear.Text = y.ToString();
|
||||
this.txtMonth.Text = M.ToString().PadLeft(2, '0');
|
||||
this.txtDay.Text = d.ToString().PadLeft(2, '0');
|
||||
this.txtHour.Text = h.ToString().PadLeft(2, '0');
|
||||
this.txtMinute.Text = m.ToString().PadLeft(2, '0');
|
||||
}
|
||||
|
||||
private void UCDatePickerExt2_Load(object sender, EventArgs e)
|
||||
{
|
||||
SetTimeToControl();
|
||||
panel1.Height = this.txtDay.Height;
|
||||
|
||||
panel1.Width = this.Width - 6;
|
||||
SetEvent(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the event.
|
||||
/// </summary>
|
||||
/// <param name="c">The c.</param>
|
||||
private void SetEvent(Control c)
|
||||
{
|
||||
if (c != null)
|
||||
{
|
||||
c.MouseDown += c_MouseDown;
|
||||
foreach (Control item in c.Controls)
|
||||
{
|
||||
SetEvent(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the MouseDown event of the c control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
|
||||
void c_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (m_selectPan == null)
|
||||
{
|
||||
m_selectPan = new UCDateTimeSelectPan2();
|
||||
m_selectPan.SelectedTimeEvent += uc_SelectedTimeEvent;
|
||||
m_selectPan.CancelTimeEvent += m_selectPan_CancelTimeEvent;
|
||||
m_selectPan.SelectColor = selectColor;
|
||||
}
|
||||
m_selectPan.CurrentTime = currentTime;
|
||||
m_selectPan.TimeType = m_type;
|
||||
m_frmAnchor = new Forms.FrmAnchor(this, m_selectPan);
|
||||
m_frmAnchor.Show(this.FindForm());
|
||||
}
|
||||
/// <summary>
|
||||
/// Handles the CancelTimeEvent event of the m_selectPan control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
void m_selectPan_CancelTimeEvent(object sender, EventArgs e)
|
||||
{
|
||||
m_frmAnchor.Hide();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the SelectedTimeEvent event of the uc control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
void uc_SelectedTimeEvent(object sender, EventArgs e)
|
||||
{
|
||||
CurrentTime = m_selectPan.CurrentTime;
|
||||
m_frmAnchor.Hide();
|
||||
}
|
||||
/// <summary>
|
||||
/// Handles the TextChanged event of the txtYear control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void txtYear_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (txtYear.Text.Length == 4)
|
||||
this.ActiveControl = txtMonth;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the TextChanged event of the txtMonth control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void txtMonth_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (txtMonth.Text.Length == 2 || txtMonth.Text.ToInt() >= 3)
|
||||
{
|
||||
this.ActiveControl = txtDay;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the TextChanged event of the txtDay control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void txtDay_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (m_type == DateTimePickerType.Date)
|
||||
return;
|
||||
if (txtDay.Text.Length == 2 || txtDay.Text.ToInt() >= 4)
|
||||
{
|
||||
this.ActiveControl = txtHour;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the TextChanged event of the txtHour control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void txtHour_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (txtHour.Text.Length == 2 || txtHour.Text.ToInt() >= 3)
|
||||
{
|
||||
this.ActiveControl = txtMinute;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the Leave event of the txtYear control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void txtYear_Leave(object sender, EventArgs e)
|
||||
{
|
||||
if (txtYear.Text.ToInt() < 1990)
|
||||
{
|
||||
txtYear.Text = currentTime.Year.ToString();
|
||||
}
|
||||
currentTime = (txtYear.Text + currentTime.ToString("-MM-dd HH:mm:ss")).ToDate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the Leave event of the txtMonth control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void txtMonth_Leave(object sender, EventArgs e)
|
||||
{
|
||||
if (txtMonth.Text.ToInt() < 1)
|
||||
{
|
||||
txtMonth.Text = currentTime.Month.ToString().PadLeft(2, '0');
|
||||
}
|
||||
txtMonth.Text = txtMonth.Text.PadLeft(2, '0');
|
||||
currentTime = (currentTime.ToString("yyyy-" + txtMonth.Text + "-dd HH:mm:ss")).ToDate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the Leave event of the txtDay control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void txtDay_Leave(object sender, EventArgs e)
|
||||
{
|
||||
if (txtDay.Text.ToInt() < 1 || txtDay.Text.ToInt() > DateTime.DaysInMonth(currentTime.Year, currentTime.Month))
|
||||
{
|
||||
txtDay.Text = currentTime.Day.ToString().PadLeft(2, '0');
|
||||
}
|
||||
txtDay.Text = txtDay.Text.PadLeft(2, '0');
|
||||
currentTime = (currentTime.ToString("yyyy-MM-" + txtDay.Text + " HH:mm:ss")).ToDate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the Leave event of the txtHour control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void txtHour_Leave(object sender, EventArgs e)
|
||||
{
|
||||
if (txtHour.Text.ToInt() < 1)
|
||||
{
|
||||
txtHour.Text = currentTime.Hour.ToString().PadLeft(2, '0');
|
||||
}
|
||||
txtHour.Text = txtHour.Text.PadLeft(2, '0');
|
||||
currentTime = (currentTime.ToString("yyyy-MM-dd " + txtHour.Text + ":mm:ss")).ToDate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the Leave event of the txtMinute control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void txtMinute_Leave(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the SizeChanged event of the txt control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void txt_SizeChanged(object sender, EventArgs e)
|
||||
{
|
||||
panel1.Height = (sender as TextBoxEx).Height;
|
||||
}
|
||||
}
|
||||
}
|
120
X009/src/HZH_Controls/Controls/DateTime/UCDatePickerExt2.resx
Normal file
120
X009/src/HZH_Controls/Controls/DateTime/UCDatePickerExt2.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
519
X009/src/HZH_Controls/Controls/DateTime/UCDateTimeSelectPan.Designer.cs
generated
Normal file
519
X009/src/HZH_Controls/Controls/DateTime/UCDateTimeSelectPan.Designer.cs
generated
Normal file
@ -0,0 +1,519 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-08-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCDateTimeSelectPan.Designer.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCDateTimeSelectPan.
|
||||
/// Implements the <see cref="System.Windows.Forms.UserControl" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Windows.Forms.UserControl" />
|
||||
public partial class UCDateTimeSelectPan
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.btnMinute = new HZH_Controls.Controls.UCBtnExt();
|
||||
this.sp4 = new System.Windows.Forms.Panel();
|
||||
this.btnHour = new HZH_Controls.Controls.UCBtnExt();
|
||||
this.sp3 = new System.Windows.Forms.Panel();
|
||||
this.btnDay = new HZH_Controls.Controls.UCBtnExt();
|
||||
this.sp2 = new System.Windows.Forms.Panel();
|
||||
this.btnMonth = new HZH_Controls.Controls.UCBtnExt();
|
||||
this.sp1 = new System.Windows.Forms.Panel();
|
||||
this.btnYear = new HZH_Controls.Controls.UCBtnExt();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
this.btnCancel = new HZH_Controls.Controls.UCBtnExt();
|
||||
this.btnOk = new HZH_Controls.Controls.UCBtnExt();
|
||||
this.panMian = new System.Windows.Forms.Panel();
|
||||
this.panTime = new HZH_Controls.Controls.UCTimePanel();
|
||||
this.panRight = new System.Windows.Forms.Panel();
|
||||
this.panLeft = new System.Windows.Forms.Panel();
|
||||
this.ucSplitLine_H2 = new HZH_Controls.Controls.UCSplitLine_H();
|
||||
this.ucSplitLine_H1 = new HZH_Controls.Controls.UCSplitLine_H();
|
||||
this.panel3 = new System.Windows.Forms.Panel();
|
||||
this.panel1.SuspendLayout();
|
||||
this.panel2.SuspendLayout();
|
||||
this.panMian.SuspendLayout();
|
||||
this.panel3.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.btnMinute);
|
||||
this.panel1.Controls.Add(this.sp4);
|
||||
this.panel1.Controls.Add(this.btnHour);
|
||||
this.panel1.Controls.Add(this.sp3);
|
||||
this.panel1.Controls.Add(this.btnDay);
|
||||
this.panel1.Controls.Add(this.sp2);
|
||||
this.panel1.Controls.Add(this.btnMonth);
|
||||
this.panel1.Controls.Add(this.sp1);
|
||||
this.panel1.Controls.Add(this.btnYear);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel1.Location = new System.Drawing.Point(9, 9);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Padding = new System.Windows.Forms.Padding(10, 7, 10, 7);
|
||||
this.panel1.Size = new System.Drawing.Size(497, 45);
|
||||
this.panel1.TabIndex = 0;
|
||||
//
|
||||
// btnMinute
|
||||
//
|
||||
this.btnMinute.BackColor = System.Drawing.Color.Transparent;
|
||||
this.btnMinute.BtnBackColor = System.Drawing.Color.Transparent;
|
||||
this.btnMinute.BtnFont = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.btnMinute.BtnForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
|
||||
this.btnMinute.BtnText = "30分";
|
||||
this.btnMinute.ConerRadius = 5;
|
||||
this.btnMinute.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnMinute.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.btnMinute.EnabledMouseEffect = false;
|
||||
this.btnMinute.FillColor = System.Drawing.Color.White;
|
||||
this.btnMinute.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.btnMinute.IsRadius = true;
|
||||
this.btnMinute.IsShowRect = true;
|
||||
this.btnMinute.IsShowTips = false;
|
||||
this.btnMinute.Location = new System.Drawing.Point(406, 7);
|
||||
this.btnMinute.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
|
||||
this.btnMinute.Name = "btnMinute";
|
||||
this.btnMinute.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
|
||||
this.btnMinute.RectWidth = 1;
|
||||
this.btnMinute.Size = new System.Drawing.Size(80, 31);
|
||||
this.btnMinute.TabIndex = 1;
|
||||
this.btnMinute.TabStop = false;
|
||||
this.btnMinute.TipsColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(30)))), ((int)(((byte)(99)))));
|
||||
this.btnMinute.TipsText = "";
|
||||
this.btnMinute.BtnClick += new System.EventHandler(this.btnTime_BtnClick);
|
||||
//
|
||||
// sp4
|
||||
//
|
||||
this.sp4.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.sp4.Location = new System.Drawing.Point(387, 7);
|
||||
this.sp4.Name = "sp4";
|
||||
this.sp4.Size = new System.Drawing.Size(19, 31);
|
||||
this.sp4.TabIndex = 5;
|
||||
//
|
||||
// btnHour
|
||||
//
|
||||
this.btnHour.BackColor = System.Drawing.Color.Transparent;
|
||||
this.btnHour.BtnBackColor = System.Drawing.Color.Transparent;
|
||||
this.btnHour.BtnFont = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.btnHour.BtnForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
|
||||
this.btnHour.BtnText = "12时";
|
||||
this.btnHour.ConerRadius = 5;
|
||||
this.btnHour.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnHour.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.btnHour.EnabledMouseEffect = false;
|
||||
this.btnHour.FillColor = System.Drawing.Color.White;
|
||||
this.btnHour.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.btnHour.IsRadius = true;
|
||||
this.btnHour.IsShowRect = true;
|
||||
this.btnHour.IsShowTips = false;
|
||||
this.btnHour.Location = new System.Drawing.Point(307, 7);
|
||||
this.btnHour.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
|
||||
this.btnHour.Name = "btnHour";
|
||||
this.btnHour.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
|
||||
this.btnHour.RectWidth = 1;
|
||||
this.btnHour.Size = new System.Drawing.Size(80, 31);
|
||||
this.btnHour.TabIndex = 1;
|
||||
this.btnHour.TabStop = false;
|
||||
this.btnHour.TipsColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(30)))), ((int)(((byte)(99)))));
|
||||
this.btnHour.TipsText = "";
|
||||
this.btnHour.BtnClick += new System.EventHandler(this.btnTime_BtnClick);
|
||||
//
|
||||
// sp3
|
||||
//
|
||||
this.sp3.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.sp3.Location = new System.Drawing.Point(288, 7);
|
||||
this.sp3.Name = "sp3";
|
||||
this.sp3.Size = new System.Drawing.Size(19, 31);
|
||||
this.sp3.TabIndex = 4;
|
||||
//
|
||||
// btnDay
|
||||
//
|
||||
this.btnDay.BackColor = System.Drawing.Color.Transparent;
|
||||
this.btnDay.BtnBackColor = System.Drawing.Color.Transparent;
|
||||
this.btnDay.BtnFont = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.btnDay.BtnForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
|
||||
this.btnDay.BtnText = "30日";
|
||||
this.btnDay.ConerRadius = 5;
|
||||
this.btnDay.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnDay.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.btnDay.EnabledMouseEffect = false;
|
||||
this.btnDay.FillColor = System.Drawing.Color.White;
|
||||
this.btnDay.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.btnDay.IsRadius = true;
|
||||
this.btnDay.IsShowRect = true;
|
||||
this.btnDay.IsShowTips = false;
|
||||
this.btnDay.Location = new System.Drawing.Point(208, 7);
|
||||
this.btnDay.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
|
||||
this.btnDay.Name = "btnDay";
|
||||
this.btnDay.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
|
||||
this.btnDay.RectWidth = 1;
|
||||
this.btnDay.Size = new System.Drawing.Size(80, 31);
|
||||
this.btnDay.TabIndex = 1;
|
||||
this.btnDay.TabStop = false;
|
||||
this.btnDay.TipsColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(30)))), ((int)(((byte)(99)))));
|
||||
this.btnDay.TipsText = "";
|
||||
this.btnDay.BtnClick += new System.EventHandler(this.btnTime_BtnClick);
|
||||
//
|
||||
// sp2
|
||||
//
|
||||
this.sp2.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.sp2.Location = new System.Drawing.Point(189, 7);
|
||||
this.sp2.Name = "sp2";
|
||||
this.sp2.Size = new System.Drawing.Size(19, 31);
|
||||
this.sp2.TabIndex = 3;
|
||||
//
|
||||
// btnMonth
|
||||
//
|
||||
this.btnMonth.BackColor = System.Drawing.Color.Transparent;
|
||||
this.btnMonth.BtnBackColor = System.Drawing.Color.Transparent;
|
||||
this.btnMonth.BtnFont = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.btnMonth.BtnForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
|
||||
this.btnMonth.BtnText = "12月";
|
||||
this.btnMonth.ConerRadius = 5;
|
||||
this.btnMonth.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnMonth.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.btnMonth.EnabledMouseEffect = false;
|
||||
this.btnMonth.FillColor = System.Drawing.Color.White;
|
||||
this.btnMonth.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.btnMonth.IsRadius = true;
|
||||
this.btnMonth.IsShowRect = true;
|
||||
this.btnMonth.IsShowTips = false;
|
||||
this.btnMonth.Location = new System.Drawing.Point(109, 7);
|
||||
this.btnMonth.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
|
||||
this.btnMonth.Name = "btnMonth";
|
||||
this.btnMonth.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
|
||||
this.btnMonth.RectWidth = 1;
|
||||
this.btnMonth.Size = new System.Drawing.Size(80, 31);
|
||||
this.btnMonth.TabIndex = 1;
|
||||
this.btnMonth.TabStop = false;
|
||||
this.btnMonth.TipsColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(30)))), ((int)(((byte)(99)))));
|
||||
this.btnMonth.TipsText = "";
|
||||
this.btnMonth.BtnClick += new System.EventHandler(this.btnTime_BtnClick);
|
||||
//
|
||||
// sp1
|
||||
//
|
||||
this.sp1.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.sp1.Location = new System.Drawing.Point(90, 7);
|
||||
this.sp1.Name = "sp1";
|
||||
this.sp1.Size = new System.Drawing.Size(19, 31);
|
||||
this.sp1.TabIndex = 2;
|
||||
//
|
||||
// btnYear
|
||||
//
|
||||
this.btnYear.BackColor = System.Drawing.Color.Transparent;
|
||||
this.btnYear.BtnBackColor = System.Drawing.Color.Transparent;
|
||||
this.btnYear.BtnFont = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.btnYear.BtnForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
|
||||
this.btnYear.BtnText = "2019年";
|
||||
this.btnYear.ConerRadius = 5;
|
||||
this.btnYear.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnYear.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.btnYear.EnabledMouseEffect = false;
|
||||
this.btnYear.FillColor = System.Drawing.Color.White;
|
||||
this.btnYear.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.btnYear.IsRadius = true;
|
||||
this.btnYear.IsShowRect = true;
|
||||
this.btnYear.IsShowTips = false;
|
||||
this.btnYear.Location = new System.Drawing.Point(10, 7);
|
||||
this.btnYear.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
|
||||
this.btnYear.Name = "btnYear";
|
||||
this.btnYear.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
|
||||
this.btnYear.RectWidth = 1;
|
||||
this.btnYear.Size = new System.Drawing.Size(80, 31);
|
||||
this.btnYear.TabIndex = 1;
|
||||
this.btnYear.TabStop = false;
|
||||
this.btnYear.TipsColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(30)))), ((int)(((byte)(99)))));
|
||||
this.btnYear.TipsText = "";
|
||||
this.btnYear.BtnClick += new System.EventHandler(this.btnTime_BtnClick);
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
this.panel2.Controls.Add(this.btnCancel);
|
||||
this.panel2.Controls.Add(this.btnOk);
|
||||
this.panel2.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.panel2.Location = new System.Drawing.Point(9, 300);
|
||||
this.panel2.Name = "panel2";
|
||||
this.panel2.Size = new System.Drawing.Size(497, 54);
|
||||
this.panel2.TabIndex = 2;
|
||||
//
|
||||
// btnCancel
|
||||
//
|
||||
this.btnCancel.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.btnCancel.BackColor = System.Drawing.Color.Transparent;
|
||||
this.btnCancel.BtnBackColor = System.Drawing.Color.Transparent;
|
||||
this.btnCancel.BtnFont = new System.Drawing.Font("微软雅黑", 13F);
|
||||
this.btnCancel.BtnForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
|
||||
this.btnCancel.BtnText = "取 消";
|
||||
this.btnCancel.ConerRadius = 5;
|
||||
this.btnCancel.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnCancel.EnabledMouseEffect = false;
|
||||
this.btnCancel.FillColor = System.Drawing.Color.White;
|
||||
this.btnCancel.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.btnCancel.IsRadius = true;
|
||||
this.btnCancel.IsShowRect = true;
|
||||
this.btnCancel.IsShowTips = false;
|
||||
this.btnCancel.Location = new System.Drawing.Point(89, 9);
|
||||
this.btnCancel.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
|
||||
this.btnCancel.Name = "btnCancel";
|
||||
this.btnCancel.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
|
||||
this.btnCancel.RectWidth = 1;
|
||||
this.btnCancel.Size = new System.Drawing.Size(129, 36);
|
||||
this.btnCancel.TabIndex = 2;
|
||||
this.btnCancel.TabStop = false;
|
||||
this.btnCancel.TipsColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(30)))), ((int)(((byte)(99)))));
|
||||
this.btnCancel.TipsText = "";
|
||||
this.btnCancel.BtnClick += new System.EventHandler(this.btnCancel_BtnClick);
|
||||
//
|
||||
// btnOk
|
||||
//
|
||||
this.btnOk.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.btnOk.BackColor = System.Drawing.Color.Transparent;
|
||||
this.btnOk.BtnBackColor = System.Drawing.Color.Transparent;
|
||||
this.btnOk.BtnFont = new System.Drawing.Font("微软雅黑", 13F);
|
||||
this.btnOk.BtnForeColor = System.Drawing.Color.White;
|
||||
this.btnOk.BtnText = "确 定";
|
||||
this.btnOk.ConerRadius = 5;
|
||||
this.btnOk.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnOk.EnabledMouseEffect = false;
|
||||
this.btnOk.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
|
||||
this.btnOk.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.btnOk.IsRadius = true;
|
||||
this.btnOk.IsShowRect = true;
|
||||
this.btnOk.IsShowTips = false;
|
||||
this.btnOk.Location = new System.Drawing.Point(307, 9);
|
||||
this.btnOk.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
|
||||
this.btnOk.Name = "btnOk";
|
||||
this.btnOk.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
|
||||
this.btnOk.RectWidth = 1;
|
||||
this.btnOk.Size = new System.Drawing.Size(129, 36);
|
||||
this.btnOk.TabIndex = 1;
|
||||
this.btnOk.TabStop = false;
|
||||
this.btnOk.TipsColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(30)))), ((int)(((byte)(99)))));
|
||||
this.btnOk.TipsText = "";
|
||||
this.btnOk.BtnClick += new System.EventHandler(this.btnOk_BtnClick);
|
||||
//
|
||||
// panMian
|
||||
//
|
||||
this.panMian.Controls.Add(this.panTime);
|
||||
this.panMian.Controls.Add(this.panRight);
|
||||
this.panMian.Controls.Add(this.panLeft);
|
||||
this.panMian.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panMian.Location = new System.Drawing.Point(9, 55);
|
||||
this.panMian.Name = "panMian";
|
||||
this.panMian.Size = new System.Drawing.Size(497, 244);
|
||||
this.panMian.TabIndex = 4;
|
||||
//
|
||||
// panTime
|
||||
//
|
||||
this.panTime.BackColor = System.Drawing.Color.White;
|
||||
this.panTime.Column = 0;
|
||||
this.panTime.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panTime.FirstEvent = false;
|
||||
this.panTime.IsShowBorder = false;
|
||||
this.panTime.Location = new System.Drawing.Point(48, 0);
|
||||
this.panTime.Name = "panTime";
|
||||
this.panTime.Row = 0;
|
||||
this.panTime.SelectBtn = null;
|
||||
this.panTime.Size = new System.Drawing.Size(401, 244);
|
||||
this.panTime.Source = null;
|
||||
this.panTime.TabIndex = 0;
|
||||
//
|
||||
// panRight
|
||||
//
|
||||
this.panRight.BackgroundImage = global::HZH_Controls.Properties.Resources.dateRight;
|
||||
this.panRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
|
||||
this.panRight.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.panRight.Location = new System.Drawing.Point(449, 0);
|
||||
this.panRight.Name = "panRight";
|
||||
this.panRight.Size = new System.Drawing.Size(48, 244);
|
||||
this.panRight.TabIndex = 2;
|
||||
this.panRight.Visible = false;
|
||||
this.panRight.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panRight_MouseDown);
|
||||
//
|
||||
// panLeft
|
||||
//
|
||||
this.panLeft.BackgroundImage = global::HZH_Controls.Properties.Resources.datetLeft;
|
||||
this.panLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
|
||||
this.panLeft.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.panLeft.Location = new System.Drawing.Point(0, 0);
|
||||
this.panLeft.Name = "panLeft";
|
||||
this.panLeft.Size = new System.Drawing.Size(48, 244);
|
||||
this.panLeft.TabIndex = 1;
|
||||
this.panLeft.Visible = false;
|
||||
this.panLeft.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panLeft_MouseDown);
|
||||
//
|
||||
// ucSplitLine_H2
|
||||
//
|
||||
this.ucSplitLine_H2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(238)))), ((int)(((byte)(238)))));
|
||||
this.ucSplitLine_H2.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.ucSplitLine_H2.Location = new System.Drawing.Point(9, 299);
|
||||
this.ucSplitLine_H2.Name = "ucSplitLine_H2";
|
||||
this.ucSplitLine_H2.Size = new System.Drawing.Size(497, 1);
|
||||
this.ucSplitLine_H2.TabIndex = 3;
|
||||
this.ucSplitLine_H2.TabStop = false;
|
||||
//
|
||||
// ucSplitLine_H1
|
||||
//
|
||||
this.ucSplitLine_H1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(238)))), ((int)(((byte)(238)))));
|
||||
this.ucSplitLine_H1.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.ucSplitLine_H1.Location = new System.Drawing.Point(9, 54);
|
||||
this.ucSplitLine_H1.Name = "ucSplitLine_H1";
|
||||
this.ucSplitLine_H1.Size = new System.Drawing.Size(497, 1);
|
||||
this.ucSplitLine_H1.TabIndex = 1;
|
||||
this.ucSplitLine_H1.TabStop = false;
|
||||
//
|
||||
// panel3
|
||||
//
|
||||
this.panel3.BackColor = System.Drawing.Color.White;
|
||||
this.panel3.Controls.Add(this.panMian);
|
||||
this.panel3.Controls.Add(this.ucSplitLine_H2);
|
||||
this.panel3.Controls.Add(this.panel2);
|
||||
this.panel3.Controls.Add(this.ucSplitLine_H1);
|
||||
this.panel3.Controls.Add(this.panel1);
|
||||
this.panel3.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel3.Location = new System.Drawing.Point(1, 1);
|
||||
this.panel3.Name = "panel3";
|
||||
this.panel3.Padding = new System.Windows.Forms.Padding(9);
|
||||
this.panel3.Size = new System.Drawing.Size(515, 363);
|
||||
this.panel3.TabIndex = 5;
|
||||
//
|
||||
// UCDateTimeSelectPan
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
|
||||
this.Controls.Add(this.panel3);
|
||||
this.Name = "UCDateTimeSelectPan";
|
||||
this.Padding = new System.Windows.Forms.Padding(1);
|
||||
this.Size = new System.Drawing.Size(517, 365);
|
||||
this.Load += new System.EventHandler(this.UCDateTimePickerExt_Load);
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.panel2.ResumeLayout(false);
|
||||
this.panMian.ResumeLayout(false);
|
||||
this.panel3.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// The panel1
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
/// <summary>
|
||||
/// The uc split line h1
|
||||
/// </summary>
|
||||
private UCSplitLine_H ucSplitLine_H1;
|
||||
/// <summary>
|
||||
/// The panel2
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Panel panel2;
|
||||
/// <summary>
|
||||
/// The uc split line h2
|
||||
/// </summary>
|
||||
private UCSplitLine_H ucSplitLine_H2;
|
||||
/// <summary>
|
||||
/// The pan mian
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Panel panMian;
|
||||
/// <summary>
|
||||
/// The BTN minute
|
||||
/// </summary>
|
||||
private UCBtnExt btnMinute;
|
||||
/// <summary>
|
||||
/// The BTN day
|
||||
/// </summary>
|
||||
private UCBtnExt btnDay;
|
||||
/// <summary>
|
||||
/// The BTN hour
|
||||
/// </summary>
|
||||
private UCBtnExt btnHour;
|
||||
/// <summary>
|
||||
/// The BTN month
|
||||
/// </summary>
|
||||
private UCBtnExt btnMonth;
|
||||
/// <summary>
|
||||
/// The BTN year
|
||||
/// </summary>
|
||||
private UCBtnExt btnYear;
|
||||
/// <summary>
|
||||
/// The pan time
|
||||
/// </summary>
|
||||
private UCTimePanel panTime;
|
||||
/// <summary>
|
||||
/// The BTN cancel
|
||||
/// </summary>
|
||||
private UCBtnExt btnCancel;
|
||||
/// <summary>
|
||||
/// The BTN ok
|
||||
/// </summary>
|
||||
private UCBtnExt btnOk;
|
||||
/// <summary>
|
||||
/// The pan right
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Panel panRight;
|
||||
/// <summary>
|
||||
/// The pan left
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Panel panLeft;
|
||||
/// <summary>
|
||||
/// The SP4
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Panel sp4;
|
||||
/// <summary>
|
||||
/// The SP3
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Panel sp3;
|
||||
/// <summary>
|
||||
/// The SP2
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Panel sp2;
|
||||
/// <summary>
|
||||
/// The SP1
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Panel sp1;
|
||||
/// <summary>
|
||||
/// The panel3
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Panel panel3;
|
||||
|
||||
}
|
||||
}
|
398
X009/src/HZH_Controls/Controls/DateTime/UCDateTimeSelectPan.cs
Normal file
398
X009/src/HZH_Controls/Controls/DateTime/UCDateTimeSelectPan.cs
Normal file
@ -0,0 +1,398 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-08-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCDateTimeSelectPan.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCDateTimeSelectPan.
|
||||
/// Implements the <see cref="System.Windows.Forms.UserControl" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Windows.Forms.UserControl" />
|
||||
[ToolboxItem(false)]
|
||||
public partial class UCDateTimeSelectPan : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Occurs when [selected time event].
|
||||
/// </summary>
|
||||
[Description("确定事件"), Category("自定义")]
|
||||
public event EventHandler SelectedTimeEvent;
|
||||
/// <summary>
|
||||
/// Occurs when [cancel time event].
|
||||
/// </summary>
|
||||
[Description("取消事件"), Category("自定义")]
|
||||
public event EventHandler CancelTimeEvent;
|
||||
/// <summary>
|
||||
/// The automatic select next
|
||||
/// </summary>
|
||||
private bool autoSelectNext = true;
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether [automatic select next].
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if [automatic select next]; otherwise, <c>false</c>.</value>
|
||||
[Description("自动选中下一级"), Category("自定义")]
|
||||
public bool AutoSelectNext
|
||||
{
|
||||
get { return autoSelectNext; }
|
||||
set { autoSelectNext = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The m dt
|
||||
/// </summary>
|
||||
DateTime m_dt = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the current time.
|
||||
/// </summary>
|
||||
/// <value>The current time.</value>
|
||||
public DateTime CurrentTime
|
||||
{
|
||||
get { return m_dt; }
|
||||
set
|
||||
{
|
||||
m_dt = value;
|
||||
SetTimeToControl();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The m this BTN
|
||||
/// </summary>
|
||||
UCBtnExt m_thisBtn = null;
|
||||
|
||||
/// <summary>
|
||||
/// The m type
|
||||
/// </summary>
|
||||
DateTimePickerType m_type = DateTimePickerType.DateTime;
|
||||
/// <summary>
|
||||
/// Gets or sets the type of the time.
|
||||
/// </summary>
|
||||
/// <value>The type of the time.</value>
|
||||
[Description("时间类型"), Category("自定义")]
|
||||
public DateTimePickerType TimeType
|
||||
{
|
||||
get { return m_type; }
|
||||
set { m_type = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCDateTimeSelectPan" /> class.
|
||||
/// </summary>
|
||||
public UCDateTimeSelectPan()
|
||||
{
|
||||
InitializeComponent();
|
||||
panTime.SelectSourceEvent += panTime_SelectSourceEvent;
|
||||
this.TabStop = false;
|
||||
}
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCDateTimeSelectPan" /> class.
|
||||
/// </summary>
|
||||
/// <param name="dt">The dt.</param>
|
||||
public UCDateTimeSelectPan(DateTime dt)
|
||||
{
|
||||
m_dt = dt;
|
||||
InitializeComponent();
|
||||
panTime.SelectSourceEvent += panTime_SelectSourceEvent;
|
||||
this.TabStop = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the SelectSourceEvent event of the panTime control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
void panTime_SelectSourceEvent(object sender, EventArgs e)
|
||||
{
|
||||
string strKey = sender.ToString();
|
||||
if (m_thisBtn == btnYear)
|
||||
{
|
||||
m_dt = (strKey + "-" + m_dt.Month + "-" + m_dt.Day + " " + m_dt.Hour + ":" + m_dt.Minute).ToDate();
|
||||
}
|
||||
else if (m_thisBtn == btnMonth)
|
||||
{
|
||||
m_dt = (m_dt.Year + "-" + strKey + "-" + m_dt.Day + " " + m_dt.Hour + ":" + m_dt.Minute).ToDate();
|
||||
}
|
||||
else if (m_thisBtn == btnDay)
|
||||
{
|
||||
m_dt = (m_dt.Year + "-" + m_dt.Month + "-" + strKey + " " + m_dt.Hour + ":" + m_dt.Minute).ToDate();
|
||||
}
|
||||
else if (m_thisBtn == btnHour)
|
||||
{
|
||||
m_dt = (m_dt.Year + "-" + m_dt.Month + "-" + m_dt.Day + " " + strKey + ":" + m_dt.Minute).ToDate();
|
||||
}
|
||||
else if (m_thisBtn == btnMinute)
|
||||
{
|
||||
m_dt = (m_dt.Year + "-" + m_dt.Month + "-" + m_dt.Day + " " + m_dt.Hour + ":" + strKey).ToDate();
|
||||
}
|
||||
SetTimeToControl();
|
||||
if (this.Visible)
|
||||
{
|
||||
if (autoSelectNext)
|
||||
{
|
||||
if (m_thisBtn == btnYear)
|
||||
{
|
||||
SetSelectType(btnMonth);
|
||||
}
|
||||
else if (m_thisBtn == btnMonth)
|
||||
{
|
||||
SetSelectType(btnDay);
|
||||
}
|
||||
else if (m_thisBtn == btnDay)
|
||||
{
|
||||
if (m_type == DateTimePickerType.DateTime || m_type == DateTimePickerType.Time)
|
||||
SetSelectType(btnHour);
|
||||
}
|
||||
else if (m_thisBtn == btnHour)
|
||||
{
|
||||
SetSelectType(btnMinute);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the Load event of the UCDateTimePickerExt control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void UCDateTimePickerExt_Load(object sender, EventArgs e)
|
||||
{
|
||||
SetTimeToControl();
|
||||
|
||||
if (m_type == DateTimePickerType.Date)
|
||||
{
|
||||
btnHour.Visible = false;
|
||||
btnMinute.Visible = false;
|
||||
}
|
||||
else if (m_type == DateTimePickerType.Time)
|
||||
{
|
||||
btnYear.Visible = false;
|
||||
btnMonth.Visible = false;
|
||||
btnDay.Visible = false;
|
||||
sp1.Visible = false;
|
||||
sp2.Visible = false;
|
||||
sp3.Visible = false;
|
||||
}
|
||||
if ((int)m_type <= 2)
|
||||
{
|
||||
SetSelectType(btnYear);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetSelectType(btnHour);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the time to control.
|
||||
/// </summary>
|
||||
private void SetTimeToControl()
|
||||
{
|
||||
btnYear.Tag = m_dt.Year;
|
||||
btnYear.BtnText = m_dt.Year + "年";
|
||||
btnMonth.Tag = m_dt.Month;
|
||||
btnMonth.BtnText = m_dt.Month.ToString().PadLeft(2, '0') + "月";
|
||||
btnDay.Tag = m_dt.Day;
|
||||
btnDay.BtnText = m_dt.Day.ToString().PadLeft(2, '0') + "日";
|
||||
btnHour.Tag = m_dt.Hour;
|
||||
btnHour.BtnText = m_dt.Hour.ToString().PadLeft(2, '0') + "时";
|
||||
btnMinute.Tag = m_dt.Minute;
|
||||
btnMinute.BtnText = m_dt.Minute.ToString().PadLeft(2, '0') + "分";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the type of the select.
|
||||
/// </summary>
|
||||
/// <param name="btn">The BTN.</param>
|
||||
private void SetSelectType(UCBtnExt btn)
|
||||
{
|
||||
try
|
||||
{
|
||||
ControlHelper.FreezeControl(this, true);
|
||||
if (m_thisBtn != null)
|
||||
{
|
||||
m_thisBtn.FillColor = Color.White;
|
||||
m_thisBtn.BtnForeColor = Color.FromArgb(255, 77, 59);
|
||||
}
|
||||
m_thisBtn = btn;
|
||||
if (m_thisBtn != null)
|
||||
{
|
||||
m_thisBtn.FillColor = Color.FromArgb(255, 77, 59);
|
||||
m_thisBtn.BtnForeColor = Color.White;
|
||||
|
||||
List<KeyValuePair<string, string>> lstSource = new List<KeyValuePair<string, string>>();
|
||||
panTime.SuspendLayout();
|
||||
|
||||
if (btn == btnYear)
|
||||
{
|
||||
panLeft.Visible = true;
|
||||
panRight.Visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
panLeft.Visible = false;
|
||||
panRight.Visible = false;
|
||||
}
|
||||
|
||||
if (btn == btnYear)
|
||||
{
|
||||
panTime.Row = 5;
|
||||
panTime.Column = 6;
|
||||
int intYear = m_dt.Year - m_dt.Year % 30;
|
||||
for (int i = 0; i < 30; i++)
|
||||
{
|
||||
lstSource.Add(new KeyValuePair<string, string>((intYear + i).ToString(), (intYear + i).ToString()));
|
||||
}
|
||||
}
|
||||
else if (btn == btnMonth)
|
||||
{
|
||||
panTime.Row = 3;
|
||||
panTime.Column = 4;
|
||||
for (int i = 1; i <= 12; i++)
|
||||
{
|
||||
lstSource.Add(new KeyValuePair<string, string>(i.ToString(), i.ToString().PadLeft(2, '0') + "月\r\n" + (("2019-" + i + "-01").ToDate().ToString("MMM", System.Globalization.CultureInfo.CreateSpecificCulture("en-GB")))));
|
||||
}
|
||||
}
|
||||
else if (btn == btnDay)
|
||||
{
|
||||
panTime.Column = 7;
|
||||
int intDayCount = DateTime.DaysInMonth(m_dt.Year, m_dt.Month);
|
||||
int intIndex = (int)(m_dt.DayOfWeek);
|
||||
panTime.Row = (intDayCount + intIndex) / 7 + ((intDayCount + intIndex) % 7 != 0 ? 1 : 0);
|
||||
for (int i = 0; i < intIndex; i++)
|
||||
{
|
||||
lstSource.Add(new KeyValuePair<string, string>("", ""));
|
||||
}
|
||||
for (int i = 1; i <= intDayCount; i++)
|
||||
{
|
||||
lstSource.Add(new KeyValuePair<string, string>(i.ToString(), i.ToString().PadLeft(2, '0')));
|
||||
}
|
||||
}
|
||||
else if (btn == btnHour)
|
||||
{
|
||||
panTime.Row = 4;
|
||||
panTime.Column = 6;
|
||||
for (int i = 0; i <= 24; i++)
|
||||
{
|
||||
lstSource.Add(new KeyValuePair<string, string>(i.ToString(), i.ToString() + "时"));
|
||||
}
|
||||
}
|
||||
else if (btn == btnMinute)
|
||||
{
|
||||
panTime.Row = 5;
|
||||
panTime.Column = 12;
|
||||
for (int i = 0; i <= 60; i++)
|
||||
{
|
||||
lstSource.Add(new KeyValuePair<string, string>(i.ToString(), i.ToString().PadLeft(2, '0')));
|
||||
}
|
||||
}
|
||||
panTime.Source = lstSource;
|
||||
panTime.SetSelect(btn.Tag.ToStringExt());
|
||||
panTime.ResumeLayout(true);
|
||||
|
||||
// panTime.Enabled = true;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
ControlHelper.FreezeControl(this, false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the BtnClick event of the btnTime control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void btnTime_BtnClick(object sender, EventArgs e)
|
||||
{
|
||||
SetSelectType((UCBtnExt)sender);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the MouseDown event of the panLeft control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
|
||||
private void panLeft_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
List<KeyValuePair<string, string>> lstSource = new List<KeyValuePair<string, string>>();
|
||||
int intYear = this.panTime.Source[0].Key.ToInt() - this.panTime.Source[0].Key.ToInt() % 30 - 30;
|
||||
panTime.SuspendLayout();
|
||||
panTime.Row = 5;
|
||||
panTime.Column = 6;
|
||||
for (int i = 0; i < 30; i++)
|
||||
{
|
||||
lstSource.Add(new KeyValuePair<string, string>((intYear + i).ToString(), (intYear + i).ToString()));
|
||||
}
|
||||
panTime.Source = lstSource;
|
||||
panTime.SetSelect(btnYear.Tag.ToStringExt());
|
||||
panTime.ResumeLayout(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the MouseDown event of the panRight control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
|
||||
private void panRight_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
List<KeyValuePair<string, string>> lstSource = new List<KeyValuePair<string, string>>();
|
||||
int intYear = this.panTime.Source[0].Key.ToInt() - this.panTime.Source[0].Key.ToInt() % 30 + 30;
|
||||
panTime.SuspendLayout();
|
||||
panTime.Row = 5;
|
||||
panTime.Column = 6;
|
||||
for (int i = 0; i < 30; i++)
|
||||
{
|
||||
lstSource.Add(new KeyValuePair<string, string>((intYear + i).ToString(), (intYear + i).ToString()));
|
||||
}
|
||||
panTime.Source = lstSource;
|
||||
panTime.SetSelect(btnYear.Tag.ToStringExt());
|
||||
panTime.ResumeLayout(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the BtnClick event of the btnOk control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void btnOk_BtnClick(object sender, EventArgs e)
|
||||
{
|
||||
if (SelectedTimeEvent != null)
|
||||
SelectedTimeEvent(m_dt, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the BtnClick event of the btnCancel control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void btnCancel_BtnClick(object sender, EventArgs e)
|
||||
{
|
||||
if (CancelTimeEvent != null)
|
||||
{
|
||||
CancelTimeEvent(null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
120
X009/src/HZH_Controls/Controls/DateTime/UCDateTimeSelectPan.resx
Normal file
120
X009/src/HZH_Controls/Controls/DateTime/UCDateTimeSelectPan.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
2265
X009/src/HZH_Controls/Controls/DateTime/UCDateTimeSelectPan2.Designer.cs
generated
Normal file
2265
X009/src/HZH_Controls/Controls/DateTime/UCDateTimeSelectPan2.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
545
X009/src/HZH_Controls/Controls/DateTime/UCDateTimeSelectPan2.cs
Normal file
545
X009/src/HZH_Controls/Controls/DateTime/UCDateTimeSelectPan2.cs
Normal file
@ -0,0 +1,545 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
[ToolboxItem(false)]
|
||||
public partial class UCDateTimeSelectPan2 : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Occurs when [selected time event].
|
||||
/// </summary>
|
||||
[Description("确定事件"), Category("自定义")]
|
||||
public event EventHandler SelectedTimeEvent;
|
||||
/// <summary>
|
||||
/// Occurs when [cancel time event].
|
||||
/// </summary>
|
||||
[Description("取消事件"), Category("自定义")]
|
||||
public event EventHandler CancelTimeEvent;
|
||||
/// <summary>
|
||||
/// The m type
|
||||
/// </summary>
|
||||
DateTimePickerType m_type = DateTimePickerType.DateTime;
|
||||
/// <summary>
|
||||
/// Gets or sets the type of the time.
|
||||
/// </summary>
|
||||
/// <value>The type of the time.</value>
|
||||
[Description("时间类型"), Category("自定义")]
|
||||
public DateTimePickerType TimeType
|
||||
{
|
||||
get { return m_type; }
|
||||
set
|
||||
{
|
||||
m_type = value;
|
||||
panTime.Visible = value != DateTimePickerType.Date;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The m dt
|
||||
/// </summary>
|
||||
DateTime m_dt = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the current time.
|
||||
/// </summary>
|
||||
/// <value>The current time.</value>
|
||||
public DateTime CurrentTime
|
||||
{
|
||||
get { return m_dt; }
|
||||
set
|
||||
{
|
||||
m_dt = value;
|
||||
SetTimeToControl();
|
||||
}
|
||||
}
|
||||
|
||||
private Color selectColor = Color.FromArgb(255, 77, 59);
|
||||
|
||||
public Color SelectColor
|
||||
{
|
||||
get { return selectColor; }
|
||||
set
|
||||
{
|
||||
selectColor = value;
|
||||
panTop.BackColor = value;
|
||||
foreach (Label lbl in panWeek.Controls)
|
||||
{
|
||||
lbl.ForeColor = value;
|
||||
}
|
||||
foreach (Control item in panTime.Controls)
|
||||
{
|
||||
if (item is Label)
|
||||
{
|
||||
item.ForeColor = value;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var item in panBtns.Controls)
|
||||
{
|
||||
if (item is UCBtnExt)
|
||||
{
|
||||
((UCBtnExt)item).BtnForeColor = value;
|
||||
}
|
||||
}
|
||||
foreach (Control item in panSelectHourList.Controls)
|
||||
{
|
||||
item.ForeColor = value;
|
||||
}
|
||||
foreach (Control item in panSelectMinuteList.Controls)
|
||||
{
|
||||
item.ForeColor = value;
|
||||
}
|
||||
foreach (Control item in panSelectSecondList.Controls)
|
||||
{
|
||||
item.ForeColor = value;
|
||||
}
|
||||
panSelectYear.BackColor = value;
|
||||
panSelectMonth.BackColor = value;
|
||||
ucSplitLine_H2.BackColor = value;
|
||||
ucSplitLine_V4.BackColor = value;
|
||||
ucSplitLine_V5.BackColor = value;
|
||||
}
|
||||
}
|
||||
public UCDateTimeSelectPan2()
|
||||
{
|
||||
InitializeComponent();
|
||||
foreach (Label lblDay in panDay.Controls)
|
||||
{
|
||||
lblDay.MouseClick += lblDay_MouseClick;
|
||||
}
|
||||
foreach (Label lblMonthItem in panSelectMonthList.Controls)
|
||||
{
|
||||
lblMonthItem.MouseClick += lblMonthItem_MouseClick;
|
||||
}
|
||||
foreach (Label lblYearItem in panSelectYearList.Controls)
|
||||
{
|
||||
lblYearItem.MouseClick += lblYearItem_MouseClick;
|
||||
}
|
||||
for (int i = 0; i < 24; i++)
|
||||
{
|
||||
Label lblHourItem = new Label();
|
||||
lblHourItem.AutoSize = false;
|
||||
lblHourItem.Dock = DockStyle.Fill;
|
||||
lblHourItem.ForeColor = selectColor;
|
||||
lblHourItem.Font = new Font("微软雅黑", 9);
|
||||
lblHourItem.Text = i.ToString();
|
||||
lblHourItem.TextAlign = ContentAlignment.MiddleCenter;
|
||||
lblHourItem.MouseClick += lblHourItem_MouseClick;
|
||||
lblHourItem.Margin = new Padding(0);
|
||||
this.panSelectHourList.Controls.Add(lblHourItem, i % 5, i / 5);
|
||||
}
|
||||
for (int i = 0; i < 60; i++)
|
||||
{
|
||||
Label lblMinuteItem = new Label();
|
||||
lblMinuteItem.AutoSize = false;
|
||||
lblMinuteItem.Dock = DockStyle.Fill;
|
||||
lblMinuteItem.ForeColor = selectColor;
|
||||
lblMinuteItem.Font = new Font("微软雅黑", 8);
|
||||
lblMinuteItem.Text = i.ToString();
|
||||
lblMinuteItem.TextAlign = ContentAlignment.MiddleCenter;
|
||||
lblMinuteItem.MouseClick += lblMinuteItem_MouseClick;
|
||||
lblMinuteItem.Margin = new Padding(0);
|
||||
this.panSelectMinuteList.Controls.Add(lblMinuteItem, i % 10, i / 10);
|
||||
}
|
||||
for (int i = 0; i < 60; i++)
|
||||
{
|
||||
Label lblSecondItem = new Label();
|
||||
lblSecondItem.AutoSize = false;
|
||||
lblSecondItem.Dock = DockStyle.Fill;
|
||||
lblSecondItem.ForeColor = selectColor;
|
||||
lblSecondItem.Font = new Font("微软雅黑", 8);
|
||||
lblSecondItem.Text = i.ToString();
|
||||
lblSecondItem.TextAlign = ContentAlignment.MiddleCenter;
|
||||
lblSecondItem.MouseClick += lblSecondItem_MouseClick;
|
||||
lblSecondItem.Margin = new Padding(0);
|
||||
this.panSelectSecondList.Controls.Add(lblSecondItem, i % 10, i / 10);
|
||||
}
|
||||
}
|
||||
|
||||
void lblSecondItem_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
panSelectSecond.Visible = false;
|
||||
CurrentTime = DateTime.Parse(m_dt.ToString("yyyy-MM-dd HH:mm") + ":" + ((Label)sender).Text);
|
||||
}
|
||||
|
||||
void lblMinuteItem_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
panSelectMinute.Visible = false;
|
||||
CurrentTime = DateTime.Parse(m_dt.ToString("yyyy-MM-dd") + " " + m_dt.Hour + ":" + ((Label)sender).Text + ":" + m_dt.Second);
|
||||
}
|
||||
|
||||
void lblHourItem_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
panSelectHour.Visible = false;
|
||||
CurrentTime = DateTime.Parse(m_dt.ToString("yyyy-MM-dd") + " " + ((Label)sender).Text + ":" + m_dt.ToString("mm:ss"));
|
||||
}
|
||||
|
||||
void lblYearItem_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
panSelectYear.Visible = false;
|
||||
CurrentTime = DateTime.Parse(((Label)sender).Tag + "-" + m_dt.Month + "-" + m_dt.Day + " " + m_dt.ToString("HH:mm:ss"));
|
||||
}
|
||||
|
||||
void lblMonthItem_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
panSelectMonth.Visible = false;
|
||||
CurrentTime = DateTime.Parse(m_dt.Year + "-" + ((Label)sender).Tag + "-" + m_dt.Day + " " + m_dt.ToString("HH:mm:ss"));
|
||||
}
|
||||
|
||||
void lblDay_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
Label lbl = (Label)sender;
|
||||
if (m_dt.Month + "-" + m_dt.Day != lbl.Tag.ToString())
|
||||
{
|
||||
CurrentTime = DateTime.Parse(m_dt.Year + "-" + lbl.Tag + " " + m_dt.ToString("HH:mm:ss"));
|
||||
}
|
||||
}
|
||||
|
||||
private void SetTimeToControl()
|
||||
{
|
||||
if (lblYear.Tag.ToInt() != m_dt.Year)
|
||||
{
|
||||
lblYear.Tag = m_dt.Year;
|
||||
lblYear.Text = m_dt.Year + "年 ▼";
|
||||
}
|
||||
if (lblMouth.Tag.ToInt() != m_dt.Month)
|
||||
{
|
||||
lblMouth.Tag = m_dt.Month;
|
||||
lblMouth.Text = m_dt.Month.ToString().PadLeft(2, '0') + "月 ▼";
|
||||
}
|
||||
|
||||
//if (panDay.Tag.ToInt() != m_dt.Day)
|
||||
//{
|
||||
panDay.Tag = m_dt.Day;
|
||||
panDay.Controls.ToArray().ToList().ForEach(p =>
|
||||
{
|
||||
Label lbl = (Label)p;
|
||||
if (p.Tag.ToStringExt() == (m_dt.Month + "-" + m_dt.Day))
|
||||
{
|
||||
lbl.BackColor = selectColor;
|
||||
lbl.ForeColor = Color.White;
|
||||
}
|
||||
else
|
||||
{
|
||||
lbl.BackColor = Color.White;
|
||||
if (p.Tag.ToStringExt().Split('-')[0].ToInt() != m_dt.Month)
|
||||
{
|
||||
lbl.ForeColor = Color.FromArgb(153, 153, 153);
|
||||
}
|
||||
else
|
||||
{
|
||||
lbl.ForeColor = selectColor;
|
||||
}
|
||||
}
|
||||
});
|
||||
//}
|
||||
//btnDay.Tag = m_dt.Day;
|
||||
//btnDay.BtnText = m_dt.Day.ToString().PadLeft(2, '0') + "日";
|
||||
|
||||
if (lblHour.Tag.ToInt() != m_dt.Hour)
|
||||
{
|
||||
lblHour.Tag = m_dt.Hour;
|
||||
lblHour.Text = m_dt.Hour.ToString().PadLeft(2, '0');
|
||||
}
|
||||
if (lblMinute.Tag.ToInt() != m_dt.Minute)
|
||||
{
|
||||
lblMinute.Tag = m_dt.Minute;
|
||||
lblMinute.Text = m_dt.Minute.ToString().PadLeft(2, '0');
|
||||
}
|
||||
if (lblSecond.Tag.ToInt() != m_dt.Second)
|
||||
{
|
||||
lblSecond.Tag = m_dt.Second;
|
||||
lblSecond.Text = m_dt.Second.ToString().PadLeft(2, '0');
|
||||
}
|
||||
}
|
||||
|
||||
private void lblMouth_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
int mouth = ((Label)sender).Tag.ToInt();
|
||||
CurrentTime = DateTime.Parse(m_dt.Year + "-" + mouth + "-" + m_dt.Day + " " + m_dt.ToString("HH:mm:ss"));
|
||||
int intDayCount = DateTime.DaysInMonth(m_dt.Year, m_dt.Month);
|
||||
DateTime dtlastMonth = m_dt.AddMonths(-1);
|
||||
int intlasyMonthDayCount = DateTime.DaysInMonth(dtlastMonth.Year, dtlastMonth.Month);
|
||||
DateTime dt1 = DateTime.Parse(m_dt.Year + "-" + m_dt.Month + "-01 00:00:01");
|
||||
int intIndex = (int)(dt1.DayOfWeek);
|
||||
int haveLastDay = 0;//需要上月补充几天
|
||||
haveLastDay = intIndex;
|
||||
|
||||
List<KeyValuePair<int, int>> lst = new List<KeyValuePair<int, int>>();
|
||||
for (int i = 0; i < haveLastDay; i++)
|
||||
{
|
||||
lst.Add(new KeyValuePair<int, int>(dtlastMonth.Month, intlasyMonthDayCount - (haveLastDay - i) + 1));
|
||||
}
|
||||
for (int i = 0; i < intDayCount; i++)
|
||||
{
|
||||
lst.Add(new KeyValuePair<int, int>(mouth, i + 1));
|
||||
}
|
||||
if (lst.Count < 42)
|
||||
{
|
||||
DateTime dtNextMonth = m_dt.AddMonths(1);
|
||||
int cha = 42 - lst.Count;
|
||||
for (int i = 0; i < cha; i++)
|
||||
{
|
||||
lst.Add(new KeyValuePair<int, int>(dtNextMonth.Month, i + 1));
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < lst.Count; i++)
|
||||
{
|
||||
var lbl = (Label)this.panDay.Controls[this.panDay.Controls.Count - i - 1];
|
||||
lbl.Text = lst[i].Value.ToString();
|
||||
if (lst[i].Key != mouth)
|
||||
{
|
||||
lbl.ForeColor = Color.FromArgb(153, 153, 153);
|
||||
}
|
||||
else
|
||||
{
|
||||
lbl.ForeColor = selectColor;
|
||||
}
|
||||
if (lst[i].Key + ":" + lst[i].Value != m_dt.Month + "-" + m_dt.Day)
|
||||
{
|
||||
lbl.BackColor = Color.White;
|
||||
}
|
||||
else
|
||||
{
|
||||
lbl.BackColor = selectColor;
|
||||
lbl.ForeColor = Color.White;
|
||||
}
|
||||
lbl.Tag = lst[i].Key + "-" + lst[i].Value;
|
||||
}
|
||||
}
|
||||
|
||||
private void lblYear_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
CurrentTime = DateTime.Parse(lblYear.Tag + "-" + m_dt.ToString("MM-dd HH:mm:ss"));
|
||||
lblMouth_TextChanged(lblMouth, null);
|
||||
}
|
||||
|
||||
private void btnOK_BtnClick(object sender, EventArgs e)
|
||||
{
|
||||
if (SelectedTimeEvent != null)
|
||||
{
|
||||
SelectedTimeEvent(null, null);
|
||||
}
|
||||
}
|
||||
|
||||
private void btbMouthLast_BtnClick(object sender, EventArgs e)
|
||||
{
|
||||
panSelectYear.Visible = false;
|
||||
panSelectMonth.Visible = false;
|
||||
CurrentTime = CurrentTime.AddMonths(-1);
|
||||
}
|
||||
|
||||
private void btnMouthNext_BtnClick(object sender, EventArgs e)
|
||||
{
|
||||
panSelectYear.Visible = false;
|
||||
panSelectMonth.Visible = false;
|
||||
CurrentTime = CurrentTime.AddMonths(1);
|
||||
}
|
||||
|
||||
private void btnYearNext_BtnClick(object sender, EventArgs e)
|
||||
{
|
||||
panSelectYear.Visible = false;
|
||||
panSelectMonth.Visible = false;
|
||||
CurrentTime = CurrentTime.AddYears(1);
|
||||
}
|
||||
|
||||
private void btnYearLast_BtnClick(object sender, EventArgs e)
|
||||
{
|
||||
panSelectYear.Visible = false;
|
||||
panSelectMonth.Visible = false;
|
||||
CurrentTime = CurrentTime.AddYears(-1);
|
||||
}
|
||||
|
||||
private void lblMouth_Click(object sender, EventArgs e)
|
||||
{
|
||||
panSelectHour.Visible = false;
|
||||
panSelectMonth.Visible = !panSelectMonth.Visible;
|
||||
panSelectYear.Visible = false;
|
||||
panSelectMinute.Visible = false;
|
||||
panSelectSecond.Visible = false;
|
||||
}
|
||||
|
||||
private void panSelectYear_VisibleChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (panSelectYear.Visible)
|
||||
{
|
||||
BindYearList(CurrentTime.Year);
|
||||
}
|
||||
}
|
||||
|
||||
private void BindYearList(int year)
|
||||
{
|
||||
List<int> lst = new List<int>();
|
||||
for (int i = year - 7; i < year + 7; i++)
|
||||
{
|
||||
lst.Add(i);
|
||||
}
|
||||
for (int i = 0; i < lst.Count; i++)
|
||||
{
|
||||
((Label)this.panSelectYearList.Controls[this.panSelectYearList.Controls.Count - i - 1]).Text = lst[i] + "年";
|
||||
this.panSelectYearList.Controls[this.panSelectYearList.Controls.Count - i - 1].Tag = lst[i];
|
||||
}
|
||||
}
|
||||
|
||||
private void lblYear_Click(object sender, EventArgs e)
|
||||
{
|
||||
panSelectHour.Visible = false;
|
||||
panSelectMonth.Visible = false;
|
||||
panSelectYear.Visible = !panSelectYear.Visible;
|
||||
panSelectMinute.Visible = false;
|
||||
panSelectSecond.Visible = false;
|
||||
}
|
||||
|
||||
private void btnNow_BtnClick(object sender, EventArgs e)
|
||||
{
|
||||
CurrentTime = DateTime.Now;
|
||||
btnOK_BtnClick(null, null);
|
||||
}
|
||||
|
||||
private void UCDateTimeSelectPan2_VisibleChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (Visible)
|
||||
{
|
||||
panSelectMonth.Visible = false;
|
||||
panSelectYear.Visible = false;
|
||||
panSelectHour.Visible = false;
|
||||
panSelectMinute.Visible = false;
|
||||
panSelectSecond.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void lblHour_Click(object sender, EventArgs e)
|
||||
{
|
||||
panSelectHour.Visible = !panSelectHour.Visible;
|
||||
panSelectMonth.Visible = false;
|
||||
panSelectYear.Visible = false;
|
||||
panSelectMinute.Visible = false;
|
||||
panSelectSecond.Visible = false;
|
||||
}
|
||||
|
||||
private void label74_Click(object sender, EventArgs e)
|
||||
{
|
||||
panSelectHour.Visible = false;
|
||||
}
|
||||
|
||||
private void panSelectHour_VisibleChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (panSelectHour.Visible)
|
||||
{
|
||||
foreach (Label item in panSelectHourList.Controls)
|
||||
{
|
||||
if (item.Text == m_dt.Hour.ToString())
|
||||
{
|
||||
item.BackColor = selectColor;
|
||||
item.ForeColor = Color.White;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.BackColor = Color.White;
|
||||
item.ForeColor = selectColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void panSelectMinute_VisibleChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (panSelectMinute.Visible)
|
||||
{
|
||||
foreach (Label item in panSelectMinuteList.Controls)
|
||||
{
|
||||
if (item.Text == m_dt.Minute.ToString())
|
||||
{
|
||||
item.BackColor = selectColor;
|
||||
item.ForeColor = Color.White;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.BackColor = Color.White;
|
||||
item.ForeColor = selectColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void lblMinute_Click(object sender, EventArgs e)
|
||||
{
|
||||
panSelectHour.Visible = false;
|
||||
panSelectMonth.Visible = false;
|
||||
panSelectYear.Visible = false;
|
||||
panSelectMinute.Visible = !panSelectMinute.Visible;
|
||||
panSelectSecond.Visible = false;
|
||||
}
|
||||
|
||||
private void label76_Click(object sender, EventArgs e)
|
||||
{
|
||||
panSelectMinute.Visible = false;
|
||||
}
|
||||
|
||||
private void lblSecond_Click(object sender, EventArgs e)
|
||||
{
|
||||
panSelectHour.Visible = false;
|
||||
panSelectMonth.Visible = false;
|
||||
panSelectYear.Visible = false;
|
||||
panSelectMinute.Visible = false;
|
||||
panSelectSecond.Visible = !panSelectSecond.Visible;
|
||||
}
|
||||
|
||||
private void label77_Click(object sender, EventArgs e)
|
||||
{
|
||||
panSelectSecond.Visible = false;
|
||||
}
|
||||
|
||||
private void panSelectSecond_VisibleChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (panSelectSecond.Visible)
|
||||
{
|
||||
foreach (Label item in panSelectSecondList.Controls)
|
||||
{
|
||||
if (item.Text == m_dt.Second.ToString())
|
||||
{
|
||||
item.BackColor = selectColor;
|
||||
item.ForeColor = Color.White;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.BackColor = Color.White;
|
||||
item.ForeColor = selectColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void btnClear_BtnClick(object sender, EventArgs e)
|
||||
{
|
||||
if (CancelTimeEvent != null)
|
||||
{
|
||||
CancelTimeEvent(this, null);
|
||||
}
|
||||
}
|
||||
|
||||
private void lblYearLastList_Click(object sender, EventArgs e)
|
||||
{
|
||||
int year = this.panSelectYearList.Controls[6].Tag.ToInt();
|
||||
year -= 14;
|
||||
if (year - 7 < 1990)
|
||||
year = 1990 + 7;
|
||||
BindYearList(year);
|
||||
}
|
||||
|
||||
private void lblYearNextList_Click(object sender, EventArgs e)
|
||||
{
|
||||
int year = this.panSelectYearList.Controls[6].Tag.ToInt();
|
||||
year += 14;
|
||||
if (year + 6 > 2099)
|
||||
year = 2099 - 6;
|
||||
BindYearList(year);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
154
X009/src/HZH_Controls/Controls/DateTime/UCTimePanel.Designer.cs
generated
Normal file
154
X009/src/HZH_Controls/Controls/DateTime/UCTimePanel.Designer.cs
generated
Normal file
@ -0,0 +1,154 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-08-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCTimePanel.Designer.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCTimePanel.
|
||||
/// Implements the <see cref="System.Windows.Forms.UserControl" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Windows.Forms.UserControl" />
|
||||
partial class UCTimePanel
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.panMain = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.ucSplitLine_V1 = new HZH_Controls.Controls.UCSplitLine_V();
|
||||
this.ucSplitLine_V2 = new HZH_Controls.Controls.UCSplitLine_V();
|
||||
this.ucSplitLine_H1 = new HZH_Controls.Controls.UCSplitLine_H();
|
||||
this.ucSplitLine_H2 = new HZH_Controls.Controls.UCSplitLine_H();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panMain
|
||||
//
|
||||
this.panMain.ColumnCount = 1;
|
||||
this.panMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.panMain.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panMain.Location = new System.Drawing.Point(1, 1);
|
||||
this.panMain.Name = "panMain";
|
||||
this.panMain.RowCount = 1;
|
||||
this.panMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.panMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.panMain.Size = new System.Drawing.Size(99, 228);
|
||||
this.panMain.TabIndex = 0;
|
||||
//
|
||||
// ucSplitLine_V1
|
||||
//
|
||||
this.ucSplitLine_V1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(238)))), ((int)(((byte)(238)))));
|
||||
this.ucSplitLine_V1.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.ucSplitLine_V1.Location = new System.Drawing.Point(0, 0);
|
||||
this.ucSplitLine_V1.Name = "ucSplitLine_V1";
|
||||
this.ucSplitLine_V1.Size = new System.Drawing.Size(1, 230);
|
||||
this.ucSplitLine_V1.TabIndex = 0;
|
||||
this.ucSplitLine_V1.TabStop = false;
|
||||
this.ucSplitLine_V1.Visible = false;
|
||||
//
|
||||
// ucSplitLine_V2
|
||||
//
|
||||
this.ucSplitLine_V2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(238)))), ((int)(((byte)(238)))));
|
||||
this.ucSplitLine_V2.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.ucSplitLine_V2.Location = new System.Drawing.Point(100, 0);
|
||||
this.ucSplitLine_V2.Name = "ucSplitLine_V2";
|
||||
this.ucSplitLine_V2.Size = new System.Drawing.Size(1, 230);
|
||||
this.ucSplitLine_V2.TabIndex = 1;
|
||||
this.ucSplitLine_V2.TabStop = false;
|
||||
this.ucSplitLine_V2.Visible = false;
|
||||
//
|
||||
// ucSplitLine_H1
|
||||
//
|
||||
this.ucSplitLine_H1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(238)))), ((int)(((byte)(238)))));
|
||||
this.ucSplitLine_H1.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.ucSplitLine_H1.Location = new System.Drawing.Point(1, 0);
|
||||
this.ucSplitLine_H1.Name = "ucSplitLine_H1";
|
||||
this.ucSplitLine_H1.Size = new System.Drawing.Size(99, 1);
|
||||
this.ucSplitLine_H1.TabIndex = 0;
|
||||
this.ucSplitLine_H1.TabStop = false;
|
||||
this.ucSplitLine_H1.Visible = false;
|
||||
//
|
||||
// ucSplitLine_H2
|
||||
//
|
||||
this.ucSplitLine_H2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(238)))), ((int)(((byte)(238)))));
|
||||
this.ucSplitLine_H2.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.ucSplitLine_H2.Location = new System.Drawing.Point(1, 229);
|
||||
this.ucSplitLine_H2.Name = "ucSplitLine_H2";
|
||||
this.ucSplitLine_H2.Size = new System.Drawing.Size(99, 1);
|
||||
this.ucSplitLine_H2.TabIndex = 2;
|
||||
this.ucSplitLine_H2.TabStop = false;
|
||||
this.ucSplitLine_H2.Visible = false;
|
||||
//
|
||||
// UCTimePanel
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.Controls.Add(this.panMain);
|
||||
this.Controls.Add(this.ucSplitLine_H2);
|
||||
this.Controls.Add(this.ucSplitLine_H1);
|
||||
this.Controls.Add(this.ucSplitLine_V2);
|
||||
this.Controls.Add(this.ucSplitLine_V1);
|
||||
this.Name = "UCTimePanel";
|
||||
this.Size = new System.Drawing.Size(101, 230);
|
||||
this.Load += new System.EventHandler(this.UCTimePanel_Load);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// The pan main
|
||||
/// </summary>
|
||||
private System.Windows.Forms.TableLayoutPanel panMain;
|
||||
/// <summary>
|
||||
/// The uc split line v1
|
||||
/// </summary>
|
||||
private UCSplitLine_V ucSplitLine_V1;
|
||||
/// <summary>
|
||||
/// The uc split line v2
|
||||
/// </summary>
|
||||
private UCSplitLine_V ucSplitLine_V2;
|
||||
/// <summary>
|
||||
/// The uc split line h1
|
||||
/// </summary>
|
||||
private UCSplitLine_H ucSplitLine_H1;
|
||||
/// <summary>
|
||||
/// The uc split line h2
|
||||
/// </summary>
|
||||
private UCSplitLine_H ucSplitLine_H2;
|
||||
}
|
||||
}
|
318
X009/src/HZH_Controls/Controls/DateTime/UCTimePanel.cs
Normal file
318
X009/src/HZH_Controls/Controls/DateTime/UCTimePanel.cs
Normal file
@ -0,0 +1,318 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-08-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCTimePanel.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCTimePanel.
|
||||
/// Implements the <see cref="System.Windows.Forms.UserControl" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Windows.Forms.UserControl" />
|
||||
[ToolboxItem(false)]
|
||||
public partial class UCTimePanel : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Occurs when [select source event].
|
||||
/// </summary>
|
||||
public event EventHandler SelectSourceEvent;
|
||||
/// <summary>
|
||||
/// The source
|
||||
/// </summary>
|
||||
private List<KeyValuePair<string, string>> source = null;
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether [first event].
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if [first event]; otherwise, <c>false</c>.</value>
|
||||
public bool FirstEvent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the source.
|
||||
/// </summary>
|
||||
/// <value>The source.</value>
|
||||
public List<KeyValuePair<string, string>> Source
|
||||
{
|
||||
get { return source; }
|
||||
set
|
||||
{
|
||||
source = value;
|
||||
SetSource(value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The is show border
|
||||
/// </summary>
|
||||
private bool _IsShowBorder = false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this instance is show border.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is show border; otherwise, <c>false</c>.</value>
|
||||
public bool IsShowBorder
|
||||
{
|
||||
get { return _IsShowBorder; }
|
||||
set
|
||||
{
|
||||
_IsShowBorder = value;
|
||||
ucSplitLine_H1.Visible = value;
|
||||
ucSplitLine_H2.Visible = value;
|
||||
ucSplitLine_V1.Visible = value;
|
||||
ucSplitLine_V2.Visible = value;
|
||||
}
|
||||
}
|
||||
private Color _selectColor = Color.FromArgb(255, 77, 59);
|
||||
public Color SelectColor { get { return _selectColor; } set { _selectColor = value; } }
|
||||
/// <summary>
|
||||
/// The select BTN
|
||||
/// </summary>
|
||||
UCBtnExt selectBtn;
|
||||
/// <summary>
|
||||
/// 选中按钮
|
||||
/// </summary>
|
||||
/// <value>The select BTN.</value>
|
||||
public UCBtnExt SelectBtn
|
||||
{
|
||||
get { return selectBtn; }
|
||||
set
|
||||
{
|
||||
if (selectBtn != null && !selectBtn.IsDisposed)
|
||||
{
|
||||
selectBtn.FillColor = System.Drawing.Color.White;
|
||||
selectBtn.RectColor = System.Drawing.Color.White;
|
||||
selectBtn.BtnForeColor = System.Drawing.Color.FromArgb(66, 66, 66);
|
||||
}
|
||||
bool blnEvent = FirstEvent ? true : (selectBtn != null);
|
||||
selectBtn = value;
|
||||
if (value != null)
|
||||
{
|
||||
selectBtn.FillColor = _selectColor;// System.Drawing.Color.FromArgb(255, 77, 59);
|
||||
selectBtn.RectColor = _selectColor;// System.Drawing.Color.FromArgb(255, 77, 59);
|
||||
selectBtn.BtnForeColor = System.Drawing.Color.White;
|
||||
if (blnEvent && SelectSourceEvent != null)
|
||||
SelectSourceEvent(selectBtn.Tag.ToStringExt(), null);
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCTimePanel" /> class.
|
||||
/// </summary>
|
||||
public UCTimePanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.SizeChanged += UCTimePanel_SizeChanged;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the SizeChanged event of the UCTimePanel control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
void UCTimePanel_SizeChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The row
|
||||
/// </summary>
|
||||
private int row = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the row.
|
||||
/// </summary>
|
||||
/// <value>The row.</value>
|
||||
public int Row
|
||||
{
|
||||
get { return row; }
|
||||
set
|
||||
{
|
||||
row = value;
|
||||
ReloadPanel();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The column
|
||||
/// </summary>
|
||||
private int column = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the column.
|
||||
/// </summary>
|
||||
/// <value>The column.</value>
|
||||
public int Column
|
||||
{
|
||||
get { return column; }
|
||||
set
|
||||
{
|
||||
column = value;
|
||||
ReloadPanel();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the Load event of the UCTimePanel control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void UCTimePanel_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#region 设置面板数据源
|
||||
/// <summary>
|
||||
/// 功能描述:设置面板数据源
|
||||
/// 作 者:HZH
|
||||
/// 创建日期:2019-06-25 15:02:15
|
||||
/// 任务编号:POS
|
||||
/// </summary>
|
||||
/// <param name="lstSource">lstSource</param>
|
||||
public void SetSource(List<KeyValuePair<string, string>> lstSource)
|
||||
{
|
||||
try
|
||||
{
|
||||
ControlHelper.FreezeControl(this, true);
|
||||
if (row <= 0 || column <= 0)
|
||||
return;
|
||||
if (Source != lstSource)
|
||||
Source = lstSource;
|
||||
int index = 0;
|
||||
SelectBtn = null;
|
||||
foreach (UCBtnExt btn in this.panMain.Controls)
|
||||
{
|
||||
if (lstSource != null && index < lstSource.Count)
|
||||
{
|
||||
btn.BtnText = lstSource[index].Value;
|
||||
btn.Tag = lstSource[index].Key;
|
||||
index++;
|
||||
}
|
||||
else
|
||||
{
|
||||
btn.BtnText = "";
|
||||
btn.Tag = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
ControlHelper.FreezeControl(this, false);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// 设置选中项
|
||||
/// </summary>
|
||||
/// <param name="strKey">The string key.</param>
|
||||
public void SetSelect(string strKey)
|
||||
{
|
||||
foreach (UCBtnExt item in this.panMain.Controls)
|
||||
{
|
||||
if (item.Tag != null && item.Tag.ToStringExt() == strKey)
|
||||
{
|
||||
SelectBtn = item;
|
||||
return;
|
||||
}
|
||||
}
|
||||
SelectBtn = new UCBtnExt();
|
||||
}
|
||||
|
||||
#region 重置面板
|
||||
/// <summary>
|
||||
/// 功能描述:重置面板
|
||||
/// 作 者:HZH
|
||||
/// 创建日期:2019-06-25 15:02:05
|
||||
/// 任务编号:POS
|
||||
/// </summary>
|
||||
public void ReloadPanel()
|
||||
{
|
||||
if (row <= 0 || column <= 0)
|
||||
return;
|
||||
SelectBtn = null;
|
||||
this.panMain.Controls.Clear();
|
||||
this.panMain.ColumnCount = column;
|
||||
this.panMain.ColumnStyles.Clear();
|
||||
for (int i = 0; i < column; i++)
|
||||
{
|
||||
this.panMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
}
|
||||
|
||||
this.panMain.RowCount = row;
|
||||
this.panMain.RowStyles.Clear();
|
||||
for (int i = 0; i < row; i++)
|
||||
{
|
||||
this.panMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
}
|
||||
|
||||
for (int i = 0; i < row; i++)
|
||||
{
|
||||
for (int j = 0; j < column; j++)
|
||||
{
|
||||
UCBtnExt btn = new UCBtnExt();
|
||||
btn.BackColor = System.Drawing.Color.Transparent;
|
||||
btn.BtnBackColor = System.Drawing.Color.Transparent;
|
||||
btn.BtnFont = new System.Drawing.Font("微软雅黑", 13F);
|
||||
btn.BtnForeColor = System.Drawing.Color.FromArgb(66, 66, 66);
|
||||
btn.ConerRadius = 5;
|
||||
btn.Dock = DockStyle.Fill;
|
||||
btn.FillColor = System.Drawing.Color.White;
|
||||
btn.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
btn.Cursor = Cursor.Current;
|
||||
btn.IsShowRect = true;
|
||||
btn.IsRadius = true;
|
||||
btn.IsShowTips = false;
|
||||
btn.Name = "btn_" + i + "_" + j;
|
||||
btn.RectColor = System.Drawing.Color.White;
|
||||
btn.RectWidth = 1;
|
||||
btn.Width = this.Width;
|
||||
btn.TabIndex = 0;
|
||||
btn.TipsText = "";
|
||||
btn.BtnClick += btn_BtnClick;
|
||||
this.panMain.Controls.Add(btn, j, i);
|
||||
}
|
||||
}
|
||||
|
||||
if (Source != null)
|
||||
{
|
||||
SetSource(Source);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Handles the BtnClick event of the btn control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
void btn_BtnClick(object sender, EventArgs e)
|
||||
{
|
||||
var btn = (UCBtnExt)sender;
|
||||
if (btn.Tag == null)
|
||||
return;
|
||||
SelectBtn = btn;
|
||||
}
|
||||
}
|
||||
}
|
120
X009/src/HZH_Controls/Controls/DateTime/UCTimePanel.resx
Normal file
120
X009/src/HZH_Controls/Controls/DateTime/UCTimePanel.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
343
X009/src/HZH_Controls/Controls/FactoryControls/Arrow/UCArrow.cs
Normal file
343
X009/src/HZH_Controls/Controls/FactoryControls/Arrow/UCArrow.cs
Normal file
@ -0,0 +1,343 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-10
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCArrow.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCArrow.
|
||||
/// Implements the <see cref="System.Windows.Forms.UserControl" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Windows.Forms.UserControl" />
|
||||
public class UCArrow : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// The arrow color
|
||||
/// </summary>
|
||||
private Color arrowColor = Color.FromArgb(255, 77, 59);
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the arrow.
|
||||
/// </summary>
|
||||
/// <value>The color of the arrow.</value>
|
||||
[Description("箭头颜色"), Category("自定义")]
|
||||
public Color ArrowColor
|
||||
{
|
||||
get { return arrowColor; }
|
||||
set
|
||||
{
|
||||
arrowColor = value;
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The border color
|
||||
/// </summary>
|
||||
private Color? borderColor = null;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the border.
|
||||
/// </summary>
|
||||
/// <value>The color of the border.</value>
|
||||
[Description("箭头边框颜色,为空则无边框"), Category("自定义")]
|
||||
public Color? BorderColor
|
||||
{
|
||||
get { return borderColor; }
|
||||
set
|
||||
{
|
||||
borderColor = value;
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The direction
|
||||
/// </summary>
|
||||
private ArrowDirection direction = ArrowDirection.Right;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the direction.
|
||||
/// </summary>
|
||||
/// <value>The direction.</value>
|
||||
[Description("箭头方向"), Category("自定义")]
|
||||
public ArrowDirection Direction
|
||||
{
|
||||
get { return direction; }
|
||||
set
|
||||
{
|
||||
direction = value;
|
||||
ResetPath();
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取或设置控件显示的文字的字体。
|
||||
/// </summary>
|
||||
/// <value>The font.</value>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
|
||||
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
public override Font Font
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Font;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Font = value;
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取或设置控件的前景色。
|
||||
/// </summary>
|
||||
/// <value>The color of the fore.</value>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
public override Color ForeColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.ForeColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.ForeColor = value;
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The text
|
||||
/// </summary>
|
||||
private string text;
|
||||
/// <summary>
|
||||
/// Gets or sets the text.
|
||||
/// </summary>
|
||||
/// <value>The text.</value>
|
||||
[Bindable(true)]
|
||||
[Browsable(true)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
|
||||
[EditorBrowsable(EditorBrowsableState.Always)]
|
||||
[Localizable(true)]
|
||||
[Description("箭头文字"), Category("自定义")]
|
||||
public override string Text
|
||||
{
|
||||
get
|
||||
{
|
||||
return text;
|
||||
}
|
||||
set
|
||||
{
|
||||
text = value;
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The m path
|
||||
/// </summary>
|
||||
GraphicsPath m_path;
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCArrow" /> class.
|
||||
/// </summary>
|
||||
public UCArrow()
|
||||
{
|
||||
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
||||
this.SetStyle(ControlStyles.DoubleBuffer, true);
|
||||
this.SetStyle(ControlStyles.ResizeRedraw, true);
|
||||
this.SetStyle(ControlStyles.Selectable, true);
|
||||
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||||
this.SetStyle(ControlStyles.UserPaint, true);
|
||||
this.ForeColor = Color.White;
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.SizeChanged += UCArrow_SizeChanged;
|
||||
this.Size = new Size(100, 50);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the SizeChanged event of the UCArrow control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
void UCArrow_SizeChanged(object sender, EventArgs e)
|
||||
{
|
||||
ResetPath();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the path.
|
||||
/// </summary>
|
||||
private void ResetPath()
|
||||
{
|
||||
Point[] ps = null;
|
||||
switch (direction)
|
||||
{
|
||||
case ArrowDirection.Left:
|
||||
ps = new Point[]
|
||||
{
|
||||
new Point(0,this.Height/2),
|
||||
new Point(40,0),
|
||||
new Point(40,this.Height/4),
|
||||
new Point(this.Width-1,this.Height/4),
|
||||
new Point(this.Width-1,this.Height-this.Height/4),
|
||||
new Point(40,this.Height-this.Height/4),
|
||||
new Point(40,this.Height),
|
||||
new Point(0,this.Height/2)
|
||||
};
|
||||
break;
|
||||
case ArrowDirection.Right:
|
||||
ps = new Point[]
|
||||
{
|
||||
new Point(0,this.Height/4),
|
||||
new Point(this.Width-40,this.Height/4),
|
||||
new Point(this.Width-40,0),
|
||||
new Point(this.Width-1,this.Height/2),
|
||||
new Point(this.Width-40,this.Height),
|
||||
new Point(this.Width-40,this.Height-this.Height/4),
|
||||
new Point(0,this.Height-this.Height/4),
|
||||
new Point(0,this.Height/4)
|
||||
};
|
||||
break;
|
||||
case ArrowDirection.Top:
|
||||
ps = new Point[]
|
||||
{
|
||||
new Point(this.Width/2,0),
|
||||
new Point(this.Width,40),
|
||||
new Point(this.Width-this.Width/4,40),
|
||||
new Point(this.Width-this.Width/4,this.Height-1),
|
||||
new Point(this.Width/4,this.Height-1),
|
||||
new Point(this.Width/4,40),
|
||||
new Point(0,40),
|
||||
new Point(this.Width/2,0),
|
||||
};
|
||||
break;
|
||||
case ArrowDirection.Bottom:
|
||||
ps = new Point[]
|
||||
{
|
||||
new Point(this.Width-this.Width/4,0),
|
||||
new Point(this.Width-this.Width/4,this.Height-40),
|
||||
new Point(this.Width,this.Height-40),
|
||||
new Point(this.Width/2,this.Height-1),
|
||||
new Point(0,this.Height-40),
|
||||
new Point(this.Width/4,this.Height-40),
|
||||
new Point(this.Width/4,0),
|
||||
new Point(this.Width-this.Width/4,0),
|
||||
};
|
||||
break;
|
||||
case ArrowDirection.Left_Right:
|
||||
ps = new Point[]
|
||||
{
|
||||
new Point(0,this.Height/2),
|
||||
new Point(40,0),
|
||||
new Point(40,this.Height/4),
|
||||
new Point(this.Width-40,this.Height/4),
|
||||
new Point(this.Width-40,0),
|
||||
new Point(this.Width-1,this.Height/2),
|
||||
new Point(this.Width-40,this.Height),
|
||||
new Point(this.Width-40,this.Height-this.Height/4),
|
||||
new Point(40,this.Height-this.Height/4),
|
||||
new Point(40,this.Height),
|
||||
new Point(0,this.Height/2),
|
||||
};
|
||||
break;
|
||||
case ArrowDirection.Top_Bottom:
|
||||
ps = new Point[]
|
||||
{
|
||||
new Point(this.Width/2,0),
|
||||
new Point(this.Width,40),
|
||||
new Point(this.Width-this.Width/4,40),
|
||||
new Point(this.Width-this.Width/4,this.Height-40),
|
||||
new Point(this.Width,this.Height-40),
|
||||
new Point(this.Width/2,this.Height-1),
|
||||
new Point(0,this.Height-40),
|
||||
new Point(this.Width/4,this.Height-40),
|
||||
new Point(this.Width/4,40),
|
||||
new Point(0,40),
|
||||
new Point(this.Width/2,0),
|
||||
};
|
||||
break;
|
||||
}
|
||||
m_path = new GraphicsPath();
|
||||
m_path.AddLines(ps);
|
||||
m_path.CloseAllFigures();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 引发 <see cref="E:System.Windows.Forms.Control.Paint" /> 事件。
|
||||
/// </summary>
|
||||
/// <param name="e">包含事件数据的 <see cref="T:System.Windows.Forms.PaintEventArgs" />。</param>
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
var g = e.Graphics;
|
||||
g.SetGDIHigh();
|
||||
base.Region = new Region(m_path);
|
||||
|
||||
g.FillPath(new SolidBrush(arrowColor), m_path);
|
||||
|
||||
if (borderColor != null && borderColor != Color.Empty)
|
||||
g.DrawPath(new Pen(new SolidBrush(borderColor.Value)), m_path);
|
||||
if (!string.IsNullOrEmpty(text))
|
||||
{
|
||||
var size = g.MeasureString(Text, Font);
|
||||
g.DrawString(Text, Font, new SolidBrush(ForeColor), new PointF((this.Width - size.Width) / 2, (this.Height - size.Height) / 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enum ArrowDirection
|
||||
/// </summary>
|
||||
public enum ArrowDirection
|
||||
{
|
||||
/// <summary>
|
||||
/// The left
|
||||
/// </summary>
|
||||
Left,
|
||||
/// <summary>
|
||||
/// The right
|
||||
/// </summary>
|
||||
Right,
|
||||
/// <summary>
|
||||
/// The top
|
||||
/// </summary>
|
||||
Top,
|
||||
/// <summary>
|
||||
/// The bottom
|
||||
/// </summary>
|
||||
Bottom,
|
||||
/// <summary>
|
||||
/// The left right
|
||||
/// </summary>
|
||||
Left_Right,
|
||||
/// <summary>
|
||||
/// The top bottom
|
||||
/// </summary>
|
||||
Top_Bottom
|
||||
}
|
||||
}
|
@ -0,0 +1,390 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-09
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCBlower.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.ComponentModel;
|
||||
using Timer = System.Windows.Forms.Timer;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCBlower.
|
||||
/// Implements the <see cref="System.Windows.Forms.UserControl" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Windows.Forms.UserControl" />
|
||||
public class UCBlower : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// The entrance direction
|
||||
/// </summary>
|
||||
private BlowerEntranceDirection entranceDirection = BlowerEntranceDirection.None;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the entrance direction.
|
||||
/// </summary>
|
||||
/// <value>The entrance direction.</value>
|
||||
[Description("入口方向"), Category("自定义")]
|
||||
public BlowerEntranceDirection EntranceDirection
|
||||
{
|
||||
get { return entranceDirection; }
|
||||
set
|
||||
{
|
||||
entranceDirection = value;
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The exit direction
|
||||
/// </summary>
|
||||
private BlowerExitDirection exitDirection = BlowerExitDirection.Right;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the exit direction.
|
||||
/// </summary>
|
||||
/// <value>The exit direction.</value>
|
||||
[Description("出口方向"), Category("自定义")]
|
||||
public BlowerExitDirection ExitDirection
|
||||
{
|
||||
get { return exitDirection; }
|
||||
set
|
||||
{
|
||||
exitDirection = value;
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The blower color
|
||||
/// </summary>
|
||||
private Color blowerColor = Color.FromArgb(255, 77, 59);
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the blower.
|
||||
/// </summary>
|
||||
/// <value>The color of the blower.</value>
|
||||
[Description("风机颜色"), Category("自定义")]
|
||||
public Color BlowerColor
|
||||
{
|
||||
get { return blowerColor; }
|
||||
set
|
||||
{
|
||||
blowerColor = value;
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The fan color
|
||||
/// </summary>
|
||||
private Color fanColor = Color.FromArgb(3, 169, 243);
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the fan.
|
||||
/// </summary>
|
||||
/// <value>The color of the fan.</value>
|
||||
[Description("风叶颜色"), Category("自定义")]
|
||||
public Color FanColor
|
||||
{
|
||||
get { return fanColor; }
|
||||
set
|
||||
{
|
||||
fanColor = value;
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
TurnAround turnAround = TurnAround.None;
|
||||
[Description("风叶旋转方向,None表示不旋转"), Category("自定义")]
|
||||
public TurnAround TurnAround
|
||||
{
|
||||
get { return turnAround; }
|
||||
set
|
||||
{
|
||||
turnAround = value;
|
||||
if (value == HZH_Controls.Controls.TurnAround.None)
|
||||
{
|
||||
timer1.Enabled = false;
|
||||
jiaodu = 0;
|
||||
Refresh();
|
||||
}
|
||||
else
|
||||
timer1.Enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private int turnSpeed = 100;
|
||||
private int jiaodu = 0;
|
||||
private Timer timer1;
|
||||
private IContainer components;
|
||||
|
||||
[Description("风叶旋转速度,100-1000,值越小 速度越快"), Category("自定义")]
|
||||
public int TurnSpeed
|
||||
{
|
||||
get { return turnSpeed; }
|
||||
set
|
||||
{
|
||||
if (value < 100 || value > 1000)
|
||||
return;
|
||||
turnSpeed = value;
|
||||
timer1.Interval = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The m rect working
|
||||
/// </summary>
|
||||
Rectangle m_rectWorking;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCBlower" /> class.
|
||||
/// </summary>
|
||||
public UCBlower()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
||||
this.SetStyle(ControlStyles.DoubleBuffer, true);
|
||||
this.SetStyle(ControlStyles.ResizeRedraw, true);
|
||||
this.SetStyle(ControlStyles.Selectable, true);
|
||||
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||||
this.SetStyle(ControlStyles.UserPaint, true);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.SizeChanged += UCBlower_SizeChanged;
|
||||
this.Size = new Size(120, 120);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the SizeChanged event of the UCBlower control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
void UCBlower_SizeChanged(object sender, EventArgs e)
|
||||
{
|
||||
int intMin = Math.Min(this.Width, this.Height);
|
||||
m_rectWorking = new Rectangle((this.Width - (intMin / 3 * 2)) / 2, (this.Height - (intMin / 3 * 2)) / 2, (intMin / 3 * 2), (intMin / 3 * 2));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 引发 <see cref="E:System.Windows.Forms.Control.Paint" /> 事件。
|
||||
/// </summary>
|
||||
/// <param name="e">包含事件数据的 <see cref="T:System.Windows.Forms.PaintEventArgs" />。</param>
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
var g = e.Graphics;
|
||||
g.SetGDIHigh();
|
||||
GraphicsPath pathLineIn = new GraphicsPath();
|
||||
GraphicsPath pathLineOut = new GraphicsPath();
|
||||
int intLinePenWidth = 0;
|
||||
|
||||
switch (exitDirection)
|
||||
{
|
||||
case BlowerExitDirection.Left:
|
||||
g.FillRectangle(new SolidBrush(blowerColor), new Rectangle(0, m_rectWorking.Top, this.Width / 2, m_rectWorking.Height / 2 - 5));
|
||||
intLinePenWidth = m_rectWorking.Height / 2 - 5;
|
||||
pathLineOut.AddLine(new Point(-10, m_rectWorking.Top + (m_rectWorking.Height / 2 - 5) / 2), new Point(m_rectWorking.Left + m_rectWorking.Width / 2, m_rectWorking.Top + (m_rectWorking.Height / 2 - 5) / 2));
|
||||
g.DrawLine(new Pen(new SolidBrush(blowerColor), 3), new Point(1, m_rectWorking.Top - 2), new Point(1, m_rectWorking.Top + (m_rectWorking.Height / 2 - 5) + 2));
|
||||
break;
|
||||
case BlowerExitDirection.Right:
|
||||
g.FillRectangle(new SolidBrush(blowerColor), new Rectangle(this.Width / 2, m_rectWorking.Top, this.Width / 2, m_rectWorking.Height / 2 - 5));
|
||||
intLinePenWidth = m_rectWorking.Height / 2 - 5;
|
||||
pathLineOut.AddLine(new Point(this.Width + 10, m_rectWorking.Top + (m_rectWorking.Height / 2 - 5) / 2), new Point(m_rectWorking.Left + m_rectWorking.Width / 2, m_rectWorking.Top + (m_rectWorking.Height / 2 - 5) / 2));
|
||||
g.DrawLine(new Pen(new SolidBrush(blowerColor), 3), new Point(this.Width - 2, m_rectWorking.Top - 2), new Point(this.Width - 2, m_rectWorking.Top + (m_rectWorking.Height / 2 - 5) + 2));
|
||||
break;
|
||||
case BlowerExitDirection.Up:
|
||||
g.FillRectangle(new SolidBrush(blowerColor), new Rectangle(m_rectWorking.Right - (m_rectWorking.Width / 2 - 5), 0, m_rectWorking.Width / 2 - 5, this.Height / 2));
|
||||
intLinePenWidth = m_rectWorking.Width / 2 - 5;
|
||||
pathLineOut.AddLine(new Point(m_rectWorking.Right - (m_rectWorking.Width / 2 - 5) / 2, -10), new Point(m_rectWorking.Right - (m_rectWorking.Width / 2 - 5) / 2, m_rectWorking.Top + m_rectWorking.Height / 2));
|
||||
g.DrawLine(new Pen(new SolidBrush(blowerColor), 3), new Point(m_rectWorking.Right + 2, 1), new Point(m_rectWorking.Right - (m_rectWorking.Width / 2 - 5) - 2, 1));
|
||||
break;
|
||||
}
|
||||
|
||||
switch (entranceDirection)
|
||||
{
|
||||
case BlowerEntranceDirection.Left:
|
||||
g.FillRectangle(new SolidBrush(blowerColor), new Rectangle(0, m_rectWorking.Bottom - m_rectWorking.Height / 2 + 5, this.Width / 2, m_rectWorking.Height / 2 - 5));
|
||||
pathLineIn.AddLine(new Point(-10, m_rectWorking.Bottom - m_rectWorking.Height / 2 + 5 + (m_rectWorking.Height / 2 - 5) / 2), new Point(m_rectWorking.Left + m_rectWorking.Width / 2, m_rectWorking.Bottom - m_rectWorking.Height / 2 + 5 + (m_rectWorking.Height / 2 - 5) / 2));
|
||||
g.DrawLine(new Pen(new SolidBrush(blowerColor), 3), new Point(1, m_rectWorking.Bottom - m_rectWorking.Height / 2 + 5 - 2), new Point(1, m_rectWorking.Bottom - m_rectWorking.Height / 2 + 5 + (m_rectWorking.Height / 2 - 5) + 2));
|
||||
break;
|
||||
case BlowerEntranceDirection.Right:
|
||||
g.FillRectangle(new SolidBrush(blowerColor), new Rectangle(this.Width / 2, m_rectWorking.Bottom - m_rectWorking.Height / 2 + 5, this.Width / 2, m_rectWorking.Height / 2 - 5));
|
||||
pathLineIn.AddLine(new Point(this.Width + 10, m_rectWorking.Bottom - m_rectWorking.Height / 2 + 5 + (m_rectWorking.Height / 2 - 5) / 2), new Point(m_rectWorking.Left + m_rectWorking.Width / 2, m_rectWorking.Bottom - m_rectWorking.Height / 2 + 5 + (m_rectWorking.Height / 2 - 5) / 2));
|
||||
g.DrawLine(new Pen(new SolidBrush(blowerColor), 3), new Point(this.Width - 2, m_rectWorking.Bottom - m_rectWorking.Height / 2 + 5 - 2), new Point(this.Width - 2, m_rectWorking.Bottom - m_rectWorking.Height / 2 + 5 + (m_rectWorking.Height / 2 - 5) + 2));
|
||||
break;
|
||||
case BlowerEntranceDirection.Up:
|
||||
g.FillRectangle(new SolidBrush(blowerColor), new Rectangle(m_rectWorking.Left, 0, m_rectWorking.Width / 2 - 5, this.Height / 2));
|
||||
pathLineIn.AddLine(new Point(m_rectWorking.Left + (m_rectWorking.Width / 2 - 5) / 2, -10), new Point(m_rectWorking.Left + (m_rectWorking.Width / 2 - 5) / 2, m_rectWorking.Top + m_rectWorking.Height / 2));
|
||||
g.DrawLine(new Pen(new SolidBrush(blowerColor), 3), new Point(m_rectWorking.Left - 2, 1), new Point(m_rectWorking.Left + (m_rectWorking.Width / 2 - 5) + 2, 1));
|
||||
break;
|
||||
}
|
||||
|
||||
//渐变色
|
||||
int _intPenWidth = intLinePenWidth;
|
||||
int intCount = _intPenWidth / 2 / 4;
|
||||
for (int i = 0; i < intCount; i++)
|
||||
{
|
||||
int _penWidth = _intPenWidth / 2 - 4 * i;
|
||||
if (_penWidth <= 0)
|
||||
_penWidth = 1;
|
||||
if (entranceDirection != BlowerEntranceDirection.None)
|
||||
g.DrawPath(new Pen(new SolidBrush(Color.FromArgb(40, Color.White.R, Color.White.G, Color.White.B)), _penWidth), pathLineIn);
|
||||
g.DrawPath(new Pen(new SolidBrush(Color.FromArgb(40, Color.White.R, Color.White.G, Color.White.B)), _penWidth), pathLineOut);
|
||||
if (_penWidth == 1)
|
||||
break;
|
||||
}
|
||||
|
||||
//底座
|
||||
GraphicsPath gpDZ = new GraphicsPath();
|
||||
gpDZ.AddLines(new Point[]
|
||||
{
|
||||
new Point( m_rectWorking.Left+m_rectWorking.Width/2,m_rectWorking.Top+m_rectWorking.Height/2),
|
||||
new Point(m_rectWorking.Left+2,this.Height),
|
||||
new Point(m_rectWorking.Right-2,this.Height)
|
||||
});
|
||||
gpDZ.CloseAllFigures();
|
||||
g.FillPath(new SolidBrush(blowerColor), gpDZ);
|
||||
g.FillPath(new SolidBrush(Color.FromArgb(50, Color.White)), gpDZ);
|
||||
g.DrawLine(new Pen(new SolidBrush(blowerColor), 3), new Point(m_rectWorking.Left, this.Height - 2), new Point(m_rectWorking.Right, this.Height - 2));
|
||||
|
||||
//中心
|
||||
g.FillEllipse(new SolidBrush(blowerColor), m_rectWorking);
|
||||
g.FillEllipse(new SolidBrush(Color.FromArgb(20, Color.White)), m_rectWorking);
|
||||
|
||||
|
||||
//扇叶
|
||||
Rectangle _rect = new Rectangle(m_rectWorking.Left + (m_rectWorking.Width - (m_rectWorking.Width / 3 * 2)) / 2, m_rectWorking.Top + (m_rectWorking.Height - (m_rectWorking.Width / 3 * 2)) / 2, (m_rectWorking.Width / 3 * 2), (m_rectWorking.Width / 3 * 2));
|
||||
|
||||
int _splitCount = 8;
|
||||
float fltSplitValue = 360F / (float)_splitCount;
|
||||
for (int i = 0; i <= _splitCount; i++)
|
||||
{
|
||||
float fltAngle = (fltSplitValue * i - 180) % 360 + jiaodu;
|
||||
float fltY1 = (float)(_rect.Top + _rect.Width / 2 - ((_rect.Width / 2) * Math.Sin(Math.PI * (fltAngle / 180.00F))));
|
||||
float fltX1 = (float)(_rect.Left + (_rect.Width / 2 - ((_rect.Width / 2) * Math.Cos(Math.PI * (fltAngle / 180.00F)))));
|
||||
float fltY2 = 0;
|
||||
float fltX2 = 0;
|
||||
|
||||
fltY2 = (float)(_rect.Top + _rect.Width / 2 - ((_rect.Width / 4) * Math.Sin(Math.PI * (fltAngle / 180.00F))));
|
||||
fltX2 = (float)(_rect.Left + (_rect.Width / 2 - ((_rect.Width / 4) * Math.Cos(Math.PI * (fltAngle / 180.00F)))));
|
||||
|
||||
g.DrawLine(new Pen(new SolidBrush(fanColor), 2), new PointF(fltX1, fltY1), new PointF(fltX2, fltY2));
|
||||
}
|
||||
|
||||
g.FillEllipse(new SolidBrush(fanColor), new Rectangle(_rect.Left + _rect.Width / 2 - _rect.Width / 4 + 2, _rect.Top + _rect.Width / 2 - _rect.Width / 4 + 2, _rect.Width / 2 - 4, _rect.Width / 2 - 4));
|
||||
g.FillEllipse(new SolidBrush(Color.FromArgb(50, Color.White)), new Rectangle(_rect.Left - 5, _rect.Top - 5, _rect.Width + 10, _rect.Height + 10));
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.timer1 = new System.Windows.Forms.Timer(this.components);
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// timer1
|
||||
//
|
||||
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
|
||||
//
|
||||
// UCBlower
|
||||
//
|
||||
this.Name = "UCBlower";
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
private void timer1_Tick(object sender, EventArgs e)
|
||||
{
|
||||
if (turnAround == HZH_Controls.Controls.TurnAround.Clockwise)
|
||||
{
|
||||
jiaodu += 15;
|
||||
if (jiaodu == 45)
|
||||
jiaodu = 0;
|
||||
}
|
||||
else if (turnAround == HZH_Controls.Controls.TurnAround.Counterclockwise)
|
||||
{
|
||||
jiaodu -= 15;
|
||||
if (jiaodu == -45)
|
||||
jiaodu = 0;
|
||||
}
|
||||
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Enum BlowerEntranceDirection
|
||||
/// </summary>
|
||||
public enum BlowerEntranceDirection
|
||||
{
|
||||
/// <summary>
|
||||
/// The none
|
||||
/// </summary>
|
||||
None,
|
||||
/// <summary>
|
||||
/// The left
|
||||
/// </summary>
|
||||
Left,
|
||||
/// <summary>
|
||||
/// The right
|
||||
/// </summary>
|
||||
Right,
|
||||
/// <summary>
|
||||
/// Up
|
||||
/// </summary>
|
||||
Up
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enum BlowerExitDirection
|
||||
/// </summary>
|
||||
public enum BlowerExitDirection
|
||||
{
|
||||
/// <summary>
|
||||
/// The left
|
||||
/// </summary>
|
||||
Left,
|
||||
/// <summary>
|
||||
/// The right
|
||||
/// </summary>
|
||||
Right,
|
||||
/// <summary>
|
||||
/// Up
|
||||
/// </summary>
|
||||
Up
|
||||
}
|
||||
/// <summary>
|
||||
/// 旋转方向
|
||||
/// </summary>
|
||||
public enum TurnAround
|
||||
{
|
||||
/// <summary>
|
||||
/// 不旋转
|
||||
/// </summary>
|
||||
None,
|
||||
/// <summary>
|
||||
/// 顺时针
|
||||
/// </summary>
|
||||
Clockwise,
|
||||
/// <summary>
|
||||
/// 逆时针
|
||||
/// </summary>
|
||||
Counterclockwise
|
||||
}
|
||||
}
|
@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
@ -0,0 +1,489 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-05
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCBottle.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCBottle.
|
||||
/// Implements the <see cref="System.Windows.Forms.UserControl" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Windows.Forms.UserControl" />
|
||||
public class UCBottle : UserControl
|
||||
{
|
||||
//瓶身区域
|
||||
/// <summary>
|
||||
/// The m working rect
|
||||
/// </summary>
|
||||
Rectangle m_workingRect;
|
||||
|
||||
/// <summary>
|
||||
/// The title
|
||||
/// </summary>
|
||||
string title = "瓶子1";
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the title.
|
||||
/// </summary>
|
||||
/// <value>The title.</value>
|
||||
[Description("标题"), Category("自定义")]
|
||||
public string Title
|
||||
{
|
||||
get { return title; }
|
||||
set
|
||||
{
|
||||
title = value;
|
||||
ResetWorkingRect();
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The bottle color
|
||||
/// </summary>
|
||||
private Color bottleColor = Color.FromArgb(255, 77, 59);
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the bottle.
|
||||
/// </summary>
|
||||
/// <value>The color of the bottle.</value>
|
||||
[Description("瓶子颜色"), Category("自定义")]
|
||||
public Color BottleColor
|
||||
{
|
||||
get { return bottleColor; }
|
||||
set
|
||||
{
|
||||
bottleColor = value;
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The bottle mouth color
|
||||
/// </summary>
|
||||
private Color bottleMouthColor = Color.FromArgb(105, 105, 105);
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the bottle mouth.
|
||||
/// </summary>
|
||||
/// <value>The color of the bottle mouth.</value>
|
||||
[Description("瓶口颜色"), Category("自定义")]
|
||||
public Color BottleMouthColor
|
||||
{
|
||||
get { return bottleMouthColor; }
|
||||
set { bottleMouthColor = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The liquid color
|
||||
/// </summary>
|
||||
private Color liquidColor = Color.FromArgb(3, 169, 243);
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the liquid.
|
||||
/// </summary>
|
||||
/// <value>The color of the liquid.</value>
|
||||
[Description("液体颜色"), Category("自定义")]
|
||||
public Color LiquidColor
|
||||
{
|
||||
get { return liquidColor; }
|
||||
set
|
||||
{
|
||||
liquidColor = value;
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置控件显示的文字的字体。
|
||||
/// </summary>
|
||||
/// <value>The font.</value>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
|
||||
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
[Description("文字字体"), Category("自定义")]
|
||||
public override Font Font
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Font;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Font = value;
|
||||
ResetWorkingRect();
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置控件的前景色。
|
||||
/// </summary>
|
||||
/// <value>The color of the fore.</value>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
[Description("文字颜色"), Category("自定义")]
|
||||
public override System.Drawing.Color ForeColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.ForeColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.ForeColor = value;
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The maximum value
|
||||
/// </summary>
|
||||
private decimal maxValue = 100;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum value.
|
||||
/// </summary>
|
||||
/// <value>The maximum value.</value>
|
||||
[Description("最大值"), Category("自定义")]
|
||||
public decimal MaxValue
|
||||
{
|
||||
get { return maxValue; }
|
||||
set
|
||||
{
|
||||
if (value < m_value)
|
||||
return;
|
||||
maxValue = value;
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The m value
|
||||
/// </summary>
|
||||
private decimal m_value = 50;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value.
|
||||
/// </summary>
|
||||
/// <value>The value.</value>
|
||||
[Description("值"), Category("自定义")]
|
||||
public decimal Value
|
||||
{
|
||||
get { return m_value; }
|
||||
set
|
||||
{
|
||||
if (value <= 0 || value > maxValue)
|
||||
return;
|
||||
m_value = value;
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The m no
|
||||
/// </summary>
|
||||
private string m_NO;
|
||||
/// <summary>
|
||||
/// Gets or sets the NO.
|
||||
/// </summary>
|
||||
/// <value>The no.</value>
|
||||
[Description("编号"), Category("自定义")]
|
||||
public string NO
|
||||
{
|
||||
get { return m_NO; }
|
||||
set
|
||||
{
|
||||
m_NO = value;
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
private Direction direction = Direction.Down;
|
||||
|
||||
[Description("瓶子方向,默认朝下"), Category("自定义")]
|
||||
public Direction Direction
|
||||
{
|
||||
get { return direction; }
|
||||
set
|
||||
{
|
||||
direction = value;
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCBottle" /> class.
|
||||
/// </summary>
|
||||
public UCBottle()
|
||||
{
|
||||
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
||||
this.SetStyle(ControlStyles.DoubleBuffer, true);
|
||||
this.SetStyle(ControlStyles.ResizeRedraw, true);
|
||||
this.SetStyle(ControlStyles.Selectable, true);
|
||||
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||||
this.SetStyle(ControlStyles.UserPaint, true);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.SizeChanged += UCBottle_SizeChanged;
|
||||
this.Size = new Size(100, 150);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the SizeChanged event of the UCBottle control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
void UCBottle_SizeChanged(object sender, EventArgs e)
|
||||
{
|
||||
ResetWorkingRect();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the working rect.
|
||||
/// </summary>
|
||||
private void ResetWorkingRect()
|
||||
{
|
||||
var g = this.CreateGraphics();
|
||||
var size = g.MeasureString(title, Font);
|
||||
if (direction == HZH_Controls.Controls.Direction.Down)
|
||||
m_workingRect = new Rectangle(0, (int)size.Height + 10, this.Width, this.Height - ((int)size.Height + 10) - 15);
|
||||
else
|
||||
m_workingRect = new Rectangle(0, 15, this.Width, this.Height - ((int)size.Height + 10) - 15);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 引发 <see cref="E:System.Windows.Forms.Control.Paint" /> 事件。
|
||||
/// </summary>
|
||||
/// <param name="e">包含事件数据的 <see cref="T:System.Windows.Forms.PaintEventArgs" />。</param>
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
var g = e.Graphics;
|
||||
g.SetGDIHigh();
|
||||
|
||||
|
||||
if (direction == HZH_Controls.Controls.Direction.Down)
|
||||
{
|
||||
//写文字
|
||||
var size = g.MeasureString(title, Font);
|
||||
g.DrawString(title, Font, new SolidBrush(ForeColor), new PointF((this.Width - size.Width) / 2, 2));
|
||||
//画空瓶子
|
||||
GraphicsPath pathPS = new GraphicsPath();
|
||||
Point[] psPS = new Point[]
|
||||
{
|
||||
new Point(m_workingRect.Left, m_workingRect.Top),
|
||||
new Point(m_workingRect.Right - 1, m_workingRect.Top),
|
||||
new Point(m_workingRect.Right - 1, m_workingRect.Bottom - 15),
|
||||
new Point(m_workingRect.Right - 1 - m_workingRect.Width / 4, m_workingRect.Bottom),
|
||||
new Point(m_workingRect.Left + m_workingRect.Width / 4, m_workingRect.Bottom),
|
||||
new Point(m_workingRect.Left, m_workingRect.Bottom - 15),
|
||||
};
|
||||
pathPS.AddLines(psPS);
|
||||
pathPS.CloseAllFigures();
|
||||
g.FillPath(new SolidBrush(bottleColor), pathPS);
|
||||
//画液体
|
||||
decimal decYTHeight = (m_value / maxValue) * m_workingRect.Height;
|
||||
GraphicsPath pathYT = new GraphicsPath();
|
||||
Rectangle rectYT = Rectangle.Empty;
|
||||
if (decYTHeight < 15)
|
||||
{
|
||||
PointF[] psYT = new PointF[]
|
||||
{
|
||||
new PointF((float)(m_workingRect.Left+(15-decYTHeight))+3,(float)(m_workingRect.Bottom-decYTHeight)),
|
||||
new PointF((float)(m_workingRect.Right-(15-decYTHeight))-3,(float)(m_workingRect.Bottom-decYTHeight)),
|
||||
new PointF(m_workingRect.Right-1-m_workingRect.Width/4, m_workingRect.Bottom),
|
||||
new PointF(m_workingRect.Left+m_workingRect.Width/4, m_workingRect.Bottom),
|
||||
};
|
||||
pathYT.AddLines(psYT);
|
||||
pathYT.CloseAllFigures();
|
||||
rectYT = new Rectangle((m_workingRect.Left + (15 - (int)decYTHeight)) + 3, m_workingRect.Bottom - (int)decYTHeight - 5, m_workingRect.Width - (int)(15 - decYTHeight) * 2 - 8, 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
PointF[] psYT = new PointF[]
|
||||
{
|
||||
new PointF(m_workingRect.Left,(float)(m_workingRect.Bottom-decYTHeight)),
|
||||
new PointF(m_workingRect.Right-1,(float)(m_workingRect.Bottom-decYTHeight)),
|
||||
new PointF(m_workingRect.Right-1,m_workingRect.Bottom-15),
|
||||
new PointF(m_workingRect.Right-1-m_workingRect.Width/4, m_workingRect.Bottom),
|
||||
new PointF(m_workingRect.Left+m_workingRect.Width/4, m_workingRect.Bottom),
|
||||
new PointF(m_workingRect.Left,m_workingRect.Bottom-15),
|
||||
};
|
||||
pathYT.AddLines(psYT);
|
||||
pathYT.CloseAllFigures();
|
||||
rectYT = new Rectangle(m_workingRect.Left, m_workingRect.Bottom - (int)decYTHeight - 5, m_workingRect.Width, 10);
|
||||
}
|
||||
|
||||
g.FillPath(new SolidBrush(liquidColor), pathYT);
|
||||
g.FillPath(new SolidBrush(Color.FromArgb(50, bottleMouthColor)), pathYT);
|
||||
//画液体面
|
||||
g.FillEllipse(new SolidBrush(liquidColor), rectYT);
|
||||
g.FillEllipse(new SolidBrush(Color.FromArgb(50, Color.White)), rectYT);
|
||||
|
||||
//画高亮
|
||||
int intCount = m_workingRect.Width / 2 / 4;
|
||||
int intSplit = (255 - 100) / intCount;
|
||||
for (int i = 0; i < intCount; i++)
|
||||
{
|
||||
int _penWidth = m_workingRect.Width / 2 - 4 * i;
|
||||
if (_penWidth <= 0)
|
||||
_penWidth = 1;
|
||||
g.DrawLine(new Pen(new SolidBrush(Color.FromArgb(10, Color.White)), _penWidth), new Point(m_workingRect.Width / 2, m_workingRect.Top), new Point(m_workingRect.Width / 2, m_workingRect.Bottom - 15));
|
||||
if (_penWidth == 1)
|
||||
break;
|
||||
}
|
||||
|
||||
//画瓶底
|
||||
g.FillEllipse(new SolidBrush(bottleColor), new RectangleF(m_workingRect.Left, m_workingRect.Top - 5, m_workingRect.Width - 2, 10));
|
||||
g.FillEllipse(new SolidBrush(Color.FromArgb(50, Color.White)), new RectangleF(m_workingRect.Left, m_workingRect.Top - 5, m_workingRect.Width - 2, 10));
|
||||
//画瓶口
|
||||
g.FillRectangle(new SolidBrush(bottleMouthColor), new Rectangle(m_workingRect.Left + m_workingRect.Width / 4, m_workingRect.Bottom, m_workingRect.Width / 2, 15));
|
||||
//画瓶颈阴影
|
||||
GraphicsPath pathPJ = new GraphicsPath();
|
||||
Point[] psPJ = new Point[]
|
||||
{
|
||||
new Point(m_workingRect.Left, m_workingRect.Bottom-15),
|
||||
new Point(m_workingRect.Right-1, m_workingRect.Bottom-15),
|
||||
new Point(m_workingRect.Right-1-m_workingRect.Width/4, m_workingRect.Bottom),
|
||||
new Point(m_workingRect.Left+m_workingRect.Width/4, m_workingRect.Bottom)
|
||||
};
|
||||
pathPJ.AddLines(psPJ);
|
||||
pathPJ.CloseAllFigures();
|
||||
g.FillPath(new SolidBrush(Color.FromArgb(50, bottleMouthColor)), pathPJ);
|
||||
|
||||
//写编号
|
||||
if (!string.IsNullOrEmpty(m_NO))
|
||||
{
|
||||
var nosize = g.MeasureString(m_NO, Font);
|
||||
g.DrawString(m_NO, Font, new SolidBrush(ForeColor), new PointF((this.Width - nosize.Width) / 2, m_workingRect.Top + 10));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//写文字
|
||||
var size = g.MeasureString(title, Font);
|
||||
g.DrawString(title, Font, new SolidBrush(ForeColor), new PointF((this.Width - size.Width) / 2, this.Height - size.Height - 2));
|
||||
//画空瓶子
|
||||
GraphicsPath pathPS = new GraphicsPath();
|
||||
Point[] psPS = new Point[]
|
||||
{
|
||||
new Point(m_workingRect.Left + m_workingRect.Width / 4, m_workingRect.Top),
|
||||
new Point(m_workingRect.Right - 1- m_workingRect.Width / 4, m_workingRect.Top),
|
||||
new Point(m_workingRect.Right - 1, m_workingRect.Top + 15),
|
||||
new Point(m_workingRect.Right - 1, m_workingRect.Bottom),
|
||||
new Point(m_workingRect.Left , m_workingRect.Bottom),
|
||||
new Point(m_workingRect.Left, m_workingRect.Top + 15),
|
||||
};
|
||||
pathPS.AddLines(psPS);
|
||||
pathPS.CloseAllFigures();
|
||||
g.FillPath(new SolidBrush(bottleColor), pathPS);
|
||||
//画液体
|
||||
decimal decYTHeight = (m_value / maxValue) * m_workingRect.Height;
|
||||
GraphicsPath pathYT = new GraphicsPath();
|
||||
Rectangle rectYT = Rectangle.Empty;
|
||||
if (decYTHeight > m_workingRect.Height - 15)
|
||||
{
|
||||
PointF[] psYT = new PointF[]
|
||||
{
|
||||
new PointF((float)(m_workingRect.Left+(decYTHeight-(m_workingRect.Height-15)))+3,(float)(m_workingRect.Bottom-decYTHeight)),
|
||||
new PointF((float)(m_workingRect.Right-(decYTHeight-(m_workingRect.Height-15)))-3,(float)(m_workingRect.Bottom-decYTHeight)),
|
||||
new PointF(m_workingRect.Right-1, m_workingRect.Top+15),
|
||||
new PointF(m_workingRect.Right-1, m_workingRect.Bottom),
|
||||
new PointF(m_workingRect.Left, m_workingRect.Bottom),
|
||||
new PointF(m_workingRect.Left, m_workingRect.Top+15),
|
||||
};
|
||||
pathYT.AddLines(psYT);
|
||||
pathYT.CloseAllFigures();
|
||||
rectYT = new Rectangle(m_workingRect.Left + (int)(decYTHeight - (m_workingRect.Height - 15)) +1, (int)(m_workingRect.Bottom - decYTHeight - 4), m_workingRect.Width - (int)(decYTHeight - (m_workingRect.Height - 15)) * 2-2 , 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
PointF[] psYT = new PointF[]
|
||||
{
|
||||
new PointF(m_workingRect.Left,(float)(m_workingRect.Bottom-decYTHeight)),
|
||||
new PointF(m_workingRect.Right-1,(float)(m_workingRect.Bottom-decYTHeight)),
|
||||
new PointF(m_workingRect.Right-1,m_workingRect.Bottom),
|
||||
new PointF(m_workingRect.Left,m_workingRect.Bottom),
|
||||
};
|
||||
pathYT.AddLines(psYT);
|
||||
pathYT.CloseAllFigures();
|
||||
rectYT = new Rectangle(m_workingRect.Left, m_workingRect.Bottom - (int)decYTHeight - 5, m_workingRect.Width, 10);
|
||||
}
|
||||
|
||||
g.FillPath(new SolidBrush(liquidColor), pathYT);
|
||||
g.FillPath(new SolidBrush(Color.FromArgb(50, bottleMouthColor)), pathYT);
|
||||
//画液体面
|
||||
g.FillEllipse(new SolidBrush(liquidColor), rectYT);
|
||||
g.FillEllipse(new SolidBrush(Color.FromArgb(50, Color.White)), rectYT);
|
||||
//画高亮
|
||||
int intCount = m_workingRect.Width / 2 / 4;
|
||||
int intSplit = (255 - 100) / intCount;
|
||||
for (int i = 0; i < intCount; i++)
|
||||
{
|
||||
int _penWidth = m_workingRect.Width / 2 - 4 * i;
|
||||
if (_penWidth <= 0)
|
||||
_penWidth = 1;
|
||||
g.DrawLine(new Pen(new SolidBrush(Color.FromArgb(10, Color.White)), _penWidth), new Point(m_workingRect.Width / 2, m_workingRect.Top + 15), new Point(m_workingRect.Width / 2, m_workingRect.Bottom));
|
||||
if (_penWidth == 1)
|
||||
break;
|
||||
}
|
||||
//画瓶底
|
||||
g.FillEllipse(new SolidBrush(liquidColor), new RectangleF(m_workingRect.Left, m_workingRect.Bottom - 5, m_workingRect.Width - 2, 10));
|
||||
g.FillEllipse(new SolidBrush(Color.FromArgb(50, liquidColor)), new RectangleF(m_workingRect.Left, m_workingRect.Bottom - 5, m_workingRect.Width - 2, 10));
|
||||
//画瓶口
|
||||
g.FillRectangle(new SolidBrush(bottleMouthColor), new Rectangle(m_workingRect.Left + m_workingRect.Width / 4, m_workingRect.Top - 15 + 1, m_workingRect.Width / 2, 15));
|
||||
//画瓶颈阴影
|
||||
GraphicsPath pathPJ = new GraphicsPath();
|
||||
Point[] psPJ = new Point[]
|
||||
{
|
||||
new Point(m_workingRect.Left+m_workingRect.Width/4, m_workingRect.Top),
|
||||
new Point(m_workingRect.Right-1-m_workingRect.Width/4, m_workingRect.Top),
|
||||
new Point(m_workingRect.Right-1, m_workingRect.Top+15),
|
||||
new Point(m_workingRect.Left, m_workingRect.Top+15)
|
||||
};
|
||||
pathPJ.AddLines(psPJ);
|
||||
pathPJ.CloseAllFigures();
|
||||
g.FillPath(new SolidBrush(Color.FromArgb(50, bottleMouthColor)), pathPJ);
|
||||
//写编号
|
||||
if (!string.IsNullOrEmpty(m_NO))
|
||||
{
|
||||
var nosize = g.MeasureString(m_NO, Font);
|
||||
g.DrawString(m_NO, Font, new SolidBrush(ForeColor), new PointF((this.Width - nosize.Width) / 2, m_workingRect.Bottom - nosize.Height - 10));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public enum Direction
|
||||
{
|
||||
Up,
|
||||
Down
|
||||
}
|
||||
}
|
@ -0,0 +1,804 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-04
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCConduit.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.ComponentModel;
|
||||
using Timer = System.Windows.Forms.Timer;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCConduit.
|
||||
/// Implements the <see cref="System.Windows.Forms.UserControl" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Windows.Forms.UserControl" />
|
||||
public class UCConduit : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// The conduit style
|
||||
/// </summary>
|
||||
private ConduitStyle conduitStyle = ConduitStyle.Horizontal_None_None;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the conduit style.
|
||||
/// </summary>
|
||||
/// <value>The conduit style.</value>
|
||||
[Description("样式"), Category("自定义")]
|
||||
public ConduitStyle ConduitStyle
|
||||
{
|
||||
get { return conduitStyle; }
|
||||
set
|
||||
{
|
||||
string strOld = conduitStyle.ToString().Substring(0, 1);
|
||||
string strNew = value.ToString().Substring(0, 1);
|
||||
conduitStyle = value;
|
||||
if (strOld != strNew)
|
||||
{
|
||||
this.Size = new Size(this.Size.Height, this.Size.Width);
|
||||
}
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The conduit color
|
||||
/// </summary>
|
||||
private Color conduitColor = Color.FromArgb(255, 77, 59);
|
||||
[Description("颜色"), Category("自定义")]
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the conduit.
|
||||
/// </summary>
|
||||
/// <value>The color of the conduit.</value>
|
||||
public Color ConduitColor
|
||||
{
|
||||
get { return conduitColor; }
|
||||
set
|
||||
{
|
||||
conduitColor = value;
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The liquid color
|
||||
/// </summary>
|
||||
private Color liquidColor = Color.FromArgb(3, 169, 243);
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the liquid.
|
||||
/// </summary>
|
||||
/// <value>The color of the liquid.</value>
|
||||
[Description("液体颜色"), Category("自定义")]
|
||||
public Color LiquidColor
|
||||
{
|
||||
get { return liquidColor; }
|
||||
set
|
||||
{
|
||||
liquidColor = value;
|
||||
if (liquidDirection != LiquidDirection.None)
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The liquid direction
|
||||
/// </summary>
|
||||
private LiquidDirection liquidDirection = LiquidDirection.Forward;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the liquid direction.
|
||||
/// </summary>
|
||||
/// <value>The liquid direction.</value>
|
||||
[Description("液体流动方向"), Category("自定义")]
|
||||
public LiquidDirection LiquidDirection
|
||||
{
|
||||
get { return liquidDirection; }
|
||||
set
|
||||
{
|
||||
liquidDirection = value;
|
||||
if (value == LiquidDirection.None)
|
||||
m_timer.Enabled = false;
|
||||
else
|
||||
m_timer.Enabled = true;
|
||||
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The liquid speed
|
||||
/// </summary>
|
||||
private int liquidSpeed = 100;
|
||||
|
||||
/// <summary>
|
||||
/// 液体流速,越小,速度越快Gets or sets the liquid speed.
|
||||
/// </summary>
|
||||
/// <value>The liquid speed.</value>
|
||||
[Description("液体流速,越小,速度越快"), Category("自定义")]
|
||||
public int LiquidSpeed
|
||||
{
|
||||
get { return liquidSpeed; }
|
||||
set
|
||||
{
|
||||
if (value <= 0)
|
||||
return;
|
||||
liquidSpeed = value;
|
||||
m_timer.Interval = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The conduit width
|
||||
/// </summary>
|
||||
int conduitWidth = 50;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the width of the conduit.
|
||||
/// </summary>
|
||||
/// <value>The width of the conduit.</value>
|
||||
[Description("管道宽度,当ConduitStyle的值是Horizontal_Tilt_Up,Horizontal_Tilt_Down,Vertical_Tilt_Left,Vertical_Tilt_Right时有效,其他时候将根据管道大小使用自动宽度"), Category("自定义")]
|
||||
public int ConduitWidth
|
||||
{
|
||||
get { return conduitWidth; }
|
||||
set
|
||||
{
|
||||
conduitWidth = value;
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The int pen width
|
||||
/// </summary>
|
||||
int intPenWidth = 0;
|
||||
|
||||
/// <summary>
|
||||
/// The int line left
|
||||
/// </summary>
|
||||
int intLineLeft = 0;
|
||||
/// <summary>
|
||||
/// The m timer
|
||||
/// </summary>
|
||||
Timer m_timer;
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCConduit" /> class.
|
||||
/// </summary>
|
||||
public UCConduit()
|
||||
{
|
||||
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
||||
this.SetStyle(ControlStyles.DoubleBuffer, true);
|
||||
this.SetStyle(ControlStyles.ResizeRedraw, true);
|
||||
this.SetStyle(ControlStyles.Selectable, true);
|
||||
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||||
this.SetStyle(ControlStyles.UserPaint, true);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.SizeChanged += UCConduit_SizeChanged;
|
||||
this.Size = new Size(200, 50);
|
||||
m_timer = new Timer();
|
||||
m_timer.Interval = 100;
|
||||
m_timer.Tick += timer_Tick;
|
||||
m_timer.Enabled = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the Tick event of the timer control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
void timer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
intLineLeft += 2;
|
||||
if (intLineLeft > 12)
|
||||
intLineLeft = 0;
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Handles the SizeChanged event of the UCConduit control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
void UCConduit_SizeChanged(object sender, EventArgs e)
|
||||
{
|
||||
intPenWidth = conduitStyle.ToString().StartsWith("H") ? this.Height : this.Width;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 引发 <see cref="E:System.Windows.Forms.Control.Paint" /> 事件。
|
||||
/// </summary>
|
||||
/// <param name="e">包含事件数据的 <see cref="T:System.Windows.Forms.PaintEventArgs" />。</param>
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
Graphics g = e.Graphics;
|
||||
|
||||
List<ArcEntity> lstArcs = new List<ArcEntity>();
|
||||
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
GraphicsPath linePath = new GraphicsPath();
|
||||
List<Point[]> tileLine = new List<Point[]>();
|
||||
switch (conduitStyle)
|
||||
{
|
||||
#region H English:H
|
||||
case ConduitStyle.Horizontal_None_None:
|
||||
path.AddLines(new PointF[]
|
||||
{
|
||||
new PointF(0, 0),
|
||||
new PointF(this.ClientRectangle.Right, 0),
|
||||
new PointF(this.ClientRectangle.Right, this.Height),
|
||||
new PointF(0, this.Height)
|
||||
});
|
||||
path.CloseAllFigures();
|
||||
linePath.AddLine(0, this.Height / 2, this.Width, this.Height / 2);
|
||||
break;
|
||||
case ConduitStyle.Horizontal_Up_None:
|
||||
path.AddLines(new PointF[]
|
||||
{
|
||||
new PointF(0, 0),
|
||||
new PointF(this.ClientRectangle.Right, 0),
|
||||
new PointF(this.ClientRectangle.Right, this.Height),
|
||||
new PointF(0+intPenWidth, this.Height)
|
||||
});
|
||||
path.AddArc(new Rectangle(0, intPenWidth * -1, intPenWidth * 2, intPenWidth * 2), 90, 90);
|
||||
path.CloseAllFigures();
|
||||
|
||||
linePath.AddArc(new Rectangle(intPenWidth / 2 + 1, -1 * intPenWidth / 2 - 1, intPenWidth, intPenWidth), 181, -91);
|
||||
linePath.AddLine(intPenWidth, this.Height / 2, this.Width, this.Height / 2);
|
||||
|
||||
lstArcs.Add(new ArcEntity() { rect = new Rectangle(0, intPenWidth * -1, intPenWidth * 2, intPenWidth * 2), startAngle = 90, sweepAngle = 90 });
|
||||
break;
|
||||
case ConduitStyle.Horizontal_Down_None:
|
||||
path.AddLines(new PointF[]
|
||||
{
|
||||
new PointF(intPenWidth, 0),
|
||||
new PointF(this.ClientRectangle.Right, 0),
|
||||
new PointF(this.ClientRectangle.Right, this.Height),
|
||||
new PointF(0, this.Height)
|
||||
});
|
||||
path.AddArc(new Rectangle(0, -1, intPenWidth * 2, intPenWidth * 2), 180, 90);
|
||||
path.CloseAllFigures();
|
||||
|
||||
linePath.AddArc(new Rectangle(intPenWidth / 2 + 1, this.Height / 2, intPenWidth, intPenWidth), 179, 91);
|
||||
linePath.AddLine(intPenWidth + 1, this.Height / 2, this.Width, this.Height / 2);
|
||||
|
||||
lstArcs.Add(new ArcEntity() { rect = new Rectangle(0, -1, intPenWidth * 2, intPenWidth * 2), startAngle = 180, sweepAngle = 90 });
|
||||
break;
|
||||
case ConduitStyle.Horizontal_None_Up:
|
||||
path.AddLines(new PointF[]
|
||||
{
|
||||
new PointF(this.ClientRectangle.Right-intPenWidth, this.Height),
|
||||
new PointF(0, this.Height),
|
||||
new PointF(0, 0),
|
||||
new PointF(this.ClientRectangle.Right-intPenWidth, 0)
|
||||
});
|
||||
path.AddArc(new Rectangle(this.ClientRectangle.Right - intPenWidth * 2, intPenWidth * -1, intPenWidth * 2, intPenWidth * 2), 0, 90);
|
||||
path.CloseAllFigures();
|
||||
|
||||
linePath.AddLine(0, this.Height / 2, this.Width - intPenWidth, this.Height / 2);
|
||||
linePath.AddArc(new Rectangle(this.ClientRectangle.Right - intPenWidth - intPenWidth / 2 - 1, -1 * intPenWidth / 2 - 1, intPenWidth, intPenWidth), 91, -91);
|
||||
|
||||
lstArcs.Add(new ArcEntity() { rect = new Rectangle(this.ClientRectangle.Right - intPenWidth * 2, intPenWidth * -1, intPenWidth * 2, intPenWidth * 2), startAngle = 0, sweepAngle = 90 });
|
||||
break;
|
||||
case ConduitStyle.Horizontal_None_Down:
|
||||
path.AddLines(new PointF[]
|
||||
{
|
||||
new PointF(this.ClientRectangle.Right, this.Height),
|
||||
new PointF(0, this.Height),
|
||||
new PointF(0, 0),
|
||||
new PointF(this.ClientRectangle.Right-intPenWidth, 0)
|
||||
});
|
||||
path.AddArc(new Rectangle(this.ClientRectangle.Right - intPenWidth * 2, -1, intPenWidth * 2, intPenWidth * 2), 270, 90);
|
||||
path.CloseAllFigures();
|
||||
|
||||
linePath.AddLine(0, this.Height / 2, this.Width - intPenWidth - 1, this.Height / 2);
|
||||
linePath.AddArc(new Rectangle(this.ClientRectangle.Right - intPenWidth - intPenWidth / 2 - 1, intPenWidth / 2, intPenWidth, intPenWidth), 269, 91);
|
||||
|
||||
lstArcs.Add(new ArcEntity() { rect = new Rectangle(this.ClientRectangle.Right - intPenWidth * 2, -1, intPenWidth * 2, intPenWidth * 2), startAngle = 270, sweepAngle = 90 });
|
||||
break;
|
||||
case ConduitStyle.Horizontal_Down_Up:
|
||||
path.AddLine(new Point(intPenWidth, 0), new Point(this.Width, 0));
|
||||
path.AddArc(new Rectangle(this.ClientRectangle.Right - intPenWidth * 2, intPenWidth * -1, intPenWidth * 2, intPenWidth * 2), 0, 90);
|
||||
path.AddLine(new Point(this.Width - intPenWidth, this.Height), new Point(0, this.Height));
|
||||
path.AddArc(new Rectangle(0, -1, intPenWidth * 2, intPenWidth * 2), 180, 90);
|
||||
path.CloseAllFigures();
|
||||
|
||||
linePath.AddArc(new Rectangle(intPenWidth / 2 + 1, this.Height / 2, intPenWidth, intPenWidth), 179, 91);
|
||||
//linePath.AddLine(intPenWidth, this.Height / 2, this.Width - intPenWidth, this.Height / 2);
|
||||
linePath.AddArc(new Rectangle(this.ClientRectangle.Right - intPenWidth - intPenWidth / 2 - 1, -1 * intPenWidth / 2 - 1, intPenWidth, intPenWidth), 91, -91);
|
||||
|
||||
lstArcs.Add(new ArcEntity() { rect = new Rectangle(0, -1, intPenWidth * 2, intPenWidth * 2), startAngle = 180, sweepAngle = 90 });
|
||||
lstArcs.Add(new ArcEntity() { rect = new Rectangle(this.ClientRectangle.Right - intPenWidth * 2, intPenWidth * -1, intPenWidth * 2, intPenWidth * 2), startAngle = 0, sweepAngle = 90 });
|
||||
break;
|
||||
case ConduitStyle.Horizontal_Up_Down:
|
||||
path.AddLine(new Point(0, 0), new Point(this.Width - intPenWidth, 0));
|
||||
path.AddArc(new Rectangle(this.ClientRectangle.Right - intPenWidth * 2, -1, intPenWidth * 2, intPenWidth * 2), 270, 90);
|
||||
path.AddLine(new Point(this.Width, this.Height), new Point(intPenWidth, this.Height));
|
||||
path.AddArc(new Rectangle(0, intPenWidth * -1, intPenWidth * 2, intPenWidth * 2), 90, 90);
|
||||
path.CloseAllFigures();
|
||||
|
||||
linePath.AddArc(new Rectangle(intPenWidth / 2 + 1, -1 * intPenWidth / 2 - 1, intPenWidth, intPenWidth), 181, -91);
|
||||
linePath.AddLine(intPenWidth, this.Height / 2, this.Width - intPenWidth - 1, this.Height / 2);
|
||||
linePath.AddArc(new Rectangle(this.ClientRectangle.Right - intPenWidth - intPenWidth / 2 - 1, intPenWidth / 2, intPenWidth, intPenWidth), 269, 91);
|
||||
|
||||
lstArcs.Add(new ArcEntity() { rect = new Rectangle(0, intPenWidth * -1, intPenWidth * 2, intPenWidth * 2), startAngle = 90, sweepAngle = 90 });
|
||||
lstArcs.Add(new ArcEntity() { rect = new Rectangle(this.ClientRectangle.Right - intPenWidth * 2, -1, intPenWidth * 2, intPenWidth * 2), startAngle = 270, sweepAngle = 90 });
|
||||
break;
|
||||
case ConduitStyle.Horizontal_Up_Up:
|
||||
path.AddLine(new Point(0, 0), new Point(this.Width, 0));
|
||||
path.AddArc(new Rectangle(this.ClientRectangle.Right - intPenWidth * 2, intPenWidth * -1, intPenWidth * 2, intPenWidth * 2), 0, 90);
|
||||
path.AddLine(new Point(this.Width - intPenWidth, this.Height), new Point(intPenWidth, this.Height));
|
||||
path.AddArc(new Rectangle(0, intPenWidth * -1, intPenWidth * 2, intPenWidth * 2), 90, 90);
|
||||
path.CloseAllFigures();
|
||||
|
||||
linePath.AddArc(new Rectangle(intPenWidth / 2 + 1, -1 * intPenWidth / 2 - 1, intPenWidth, intPenWidth), 181, -91);
|
||||
//linePath.AddLine(intPenWidth, this.Height / 2, this.Width - intPenWidth, this.Height / 2);
|
||||
linePath.AddArc(new Rectangle(this.ClientRectangle.Right - intPenWidth - intPenWidth / 2 - 1, -1 * intPenWidth / 2 - 1, intPenWidth, intPenWidth), 91, -91);
|
||||
|
||||
lstArcs.Add(new ArcEntity() { rect = new Rectangle(0, intPenWidth * -1, intPenWidth * 2, intPenWidth * 2), startAngle = 90, sweepAngle = 90 });
|
||||
lstArcs.Add(new ArcEntity() { rect = new Rectangle(this.ClientRectangle.Right - intPenWidth * 2, intPenWidth * -1, intPenWidth * 2, intPenWidth * 2), startAngle = 0, sweepAngle = 90 });
|
||||
break;
|
||||
case ConduitStyle.Horizontal_Down_Down:
|
||||
path.AddLine(new Point(intPenWidth, 0), new Point(this.Width - intPenWidth, 0));
|
||||
path.AddArc(new Rectangle(this.ClientRectangle.Right - intPenWidth * 2, -1, intPenWidth * 2, intPenWidth * 2), 270, 90);
|
||||
path.AddLine(new Point(this.Width, this.Height), new Point(0, this.Height));
|
||||
path.AddArc(new Rectangle(0, -1, intPenWidth * 2, intPenWidth * 2), 180, 90);
|
||||
path.CloseAllFigures();
|
||||
|
||||
linePath.AddArc(new Rectangle(intPenWidth / 2 + 1, this.Height / 2, intPenWidth, intPenWidth), 179, 91);
|
||||
linePath.AddLine(intPenWidth + 1, this.Height / 2, this.Width - intPenWidth - 1, this.Height / 2);
|
||||
linePath.AddArc(new Rectangle(this.ClientRectangle.Right - intPenWidth - intPenWidth / 2 - 1, intPenWidth / 2, intPenWidth, intPenWidth), 269, 91);
|
||||
|
||||
lstArcs.Add(new ArcEntity() { rect = new Rectangle(0, -1, intPenWidth * 2, intPenWidth * 2), startAngle = 180, sweepAngle = 90 });
|
||||
lstArcs.Add(new ArcEntity() { rect = new Rectangle(this.ClientRectangle.Right - intPenWidth * 2, -1, intPenWidth * 2, intPenWidth * 2), startAngle = 270, sweepAngle = 90 });
|
||||
break;
|
||||
|
||||
case ConduitStyle.Horizontal_Tilt_Up:
|
||||
|
||||
double angleUp = Math.Atan((this.ClientRectangle.Height - conduitWidth) / (double)this.ClientRectangle.Width);
|
||||
angleUp = angleUp / Math.PI * 180f;
|
||||
path.AddArc(new Rectangle(this.ClientRectangle.Left - conduitWidth, this.ClientRectangle.Bottom - conduitWidth * 2, conduitWidth * 2, conduitWidth * 2), 90, -1 * (float)angleUp);
|
||||
path.AddLine(new Point(this.ClientRectangle.Right, this.ClientRectangle.Top + conduitWidth), new Point(this.ClientRectangle.Right, this.ClientRectangle.Top));
|
||||
path.AddArc(new Rectangle(this.ClientRectangle.Right - conduitWidth, this.ClientRectangle.Top, conduitWidth * 2, conduitWidth * 2), 270, -1 * (float)angleUp);
|
||||
path.AddLine(new Point(this.ClientRectangle.Left, this.ClientRectangle.Bottom - conduitWidth), new Point(this.ClientRectangle.Left, this.ClientRectangle.Bottom));
|
||||
path.CloseAllFigures();
|
||||
|
||||
|
||||
linePath.AddArc(new Rectangle(this.ClientRectangle.Right - conduitWidth / 2, this.ClientRectangle.Top + conduitWidth / 2, conduitWidth, conduitWidth), 270, -1 * (float)angleUp);
|
||||
linePath.AddArc(new Rectangle(this.ClientRectangle.Left - conduitWidth / 2, this.ClientRectangle.Bottom - 1 - conduitWidth - conduitWidth / 2, conduitWidth, conduitWidth), 95 - (float)angleUp, (float)angleUp + 5);
|
||||
|
||||
lstArcs.Add(new ArcEntity() { rect = new Rectangle(this.ClientRectangle.Left - conduitWidth, this.ClientRectangle.Bottom - conduitWidth * 2, conduitWidth * 2, conduitWidth * 2), startAngle = 90, sweepAngle = -1 * (float)angleUp });
|
||||
lstArcs.Add(new ArcEntity() { rect = new Rectangle(this.ClientRectangle.Right - conduitWidth, this.ClientRectangle.Top, conduitWidth * 2, conduitWidth * 2), startAngle = 270, sweepAngle = -1 * (float)angleUp });
|
||||
|
||||
tileLine.Add(new Point[]
|
||||
{
|
||||
new Point((int)(this.ClientRectangle.Right+1 - Math.Sin(Math.PI * (angleUp / 180.00F)) * conduitWidth),(int)( this.ClientRectangle.Top + conduitWidth - Math.Cos(Math.PI * (angleUp / 180.00F)) * conduitWidth)),
|
||||
new Point(this.ClientRectangle.Left,this.ClientRectangle.Bottom-conduitWidth-1)
|
||||
});
|
||||
tileLine.Add(new Point[]
|
||||
{
|
||||
new Point((int)(this.ClientRectangle.Left+1 + Math.Sin(Math.PI * (angleUp / 180.00F)) * conduitWidth),(int)( this.ClientRectangle.Bottom - conduitWidth + Math.Cos(Math.PI * (angleUp / 180.00F)) * conduitWidth)),
|
||||
new Point(this.ClientRectangle.Right,this.ClientRectangle.Top+conduitWidth)
|
||||
});
|
||||
|
||||
break;
|
||||
case ConduitStyle.Horizontal_Tilt_Down:
|
||||
double angleDown = Math.Atan((this.ClientRectangle.Height - conduitWidth) / (double)this.ClientRectangle.Width);
|
||||
angleDown = angleDown / Math.PI * 180f;
|
||||
path.AddArc(new Rectangle(this.ClientRectangle.Left - conduitWidth, this.ClientRectangle.Top, conduitWidth * 2, conduitWidth * 2), 270, (float)angleDown);
|
||||
path.AddLine(new Point(this.ClientRectangle.Right, this.ClientRectangle.Bottom - conduitWidth), new Point(this.ClientRectangle.Right, this.ClientRectangle.Bottom));
|
||||
path.AddArc(new Rectangle(this.ClientRectangle.Right - conduitWidth, this.ClientRectangle.Bottom - conduitWidth * 2, conduitWidth * 2, conduitWidth * 2), 90, (float)angleDown);
|
||||
path.AddLine(new Point(this.ClientRectangle.Left, this.ClientRectangle.Top + conduitWidth), new Point(this.ClientRectangle.Left, this.ClientRectangle.Top));
|
||||
path.CloseAllFigures();
|
||||
|
||||
|
||||
linePath.AddArc(new Rectangle(this.ClientRectangle.Left - conduitWidth / 2, this.ClientRectangle.Top + conduitWidth / 2, conduitWidth, conduitWidth), 265, (float)angleDown + 5);
|
||||
linePath.AddArc(new Rectangle(this.ClientRectangle.Right - conduitWidth / 2, this.ClientRectangle.Bottom - conduitWidth - conduitWidth / 2 - 1, conduitWidth, conduitWidth), 90 + (float)angleDown, -1 * (float)angleDown - 5);
|
||||
|
||||
lstArcs.Add(new ArcEntity() { rect = new Rectangle(this.ClientRectangle.Left - conduitWidth, this.ClientRectangle.Top, conduitWidth * 2, conduitWidth * 2), startAngle = 270, sweepAngle = (float)angleDown });
|
||||
lstArcs.Add(new ArcEntity() { rect = new Rectangle(this.ClientRectangle.Right - conduitWidth, this.ClientRectangle.Bottom - conduitWidth * 2, conduitWidth * 2, conduitWidth * 2), startAngle = 90, sweepAngle = (float)angleDown });
|
||||
|
||||
tileLine.Add(new Point[]
|
||||
{
|
||||
new Point((int)(this.ClientRectangle.Left + Math.Sin(Math.PI * (angleDown / 180.00F)) * conduitWidth),(int)( this.ClientRectangle.Top + conduitWidth - Math.Cos(Math.PI * (angleDown / 180.00F)) * conduitWidth)),
|
||||
new Point(this.ClientRectangle.Right-1,this.ClientRectangle.Bottom-conduitWidth-1)
|
||||
});
|
||||
tileLine.Add(new Point[]
|
||||
{
|
||||
new Point((int)(this.ClientRectangle.Right - Math.Sin(Math.PI * (angleDown / 180.00F)) * conduitWidth),(int)( this.ClientRectangle.Bottom - conduitWidth + Math.Cos(Math.PI * (angleDown / 180.00F)) * conduitWidth)),
|
||||
new Point(this.ClientRectangle.Left,this.ClientRectangle.Top+conduitWidth)
|
||||
});
|
||||
break;
|
||||
#endregion
|
||||
|
||||
#region V English:V
|
||||
case ConduitStyle.Vertical_None_None:
|
||||
path.AddLines(new PointF[]
|
||||
{
|
||||
new PointF(0, 0),
|
||||
new PointF(this.ClientRectangle.Right, 0),
|
||||
new PointF(this.ClientRectangle.Right, this.Height),
|
||||
new PointF(0, this.Height)
|
||||
});
|
||||
path.CloseAllFigures();
|
||||
linePath.AddLine(this.Width / 2, 0, this.Width / 2, this.Height);
|
||||
break;
|
||||
case ConduitStyle.Vertical_Left_None:
|
||||
path.AddLines(new PointF[]
|
||||
{
|
||||
new PointF(this.ClientRectangle.Right, intPenWidth),
|
||||
new PointF(this.ClientRectangle.Right, this.Height),
|
||||
new PointF(0, this.Height),
|
||||
new PointF(0, 0)
|
||||
});
|
||||
path.AddArc(new Rectangle(-1 * intPenWidth, 0, intPenWidth * 2, intPenWidth * 2), 270, 90);
|
||||
path.CloseAllFigures();
|
||||
|
||||
linePath.AddArc(new Rectangle(-1 * intPenWidth / 2 - 1, intPenWidth / 2 + 1, intPenWidth, intPenWidth), 269, 91);
|
||||
linePath.AddLine(intPenWidth / 2, intPenWidth, intPenWidth / 2, this.Height);
|
||||
|
||||
lstArcs.Add(new ArcEntity() { rect = new Rectangle(-1 * intPenWidth, 0, intPenWidth * 2, intPenWidth * 2), startAngle = 270, sweepAngle = 90 });
|
||||
break;
|
||||
case ConduitStyle.Vertical_Right_None:
|
||||
path.AddLines(new PointF[]
|
||||
{
|
||||
new PointF(this.ClientRectangle.Right, 0),
|
||||
new PointF(this.ClientRectangle.Right, this.Height),
|
||||
new PointF(0, this.Height),
|
||||
new PointF(0, intPenWidth)
|
||||
});
|
||||
path.AddArc(new Rectangle(-1, 0, intPenWidth * 2, intPenWidth * 2), 180, 90);
|
||||
path.CloseAllFigures();
|
||||
|
||||
linePath.AddArc(new Rectangle(intPenWidth / 2, intPenWidth / 2 + 1, intPenWidth, intPenWidth), 271, -91);
|
||||
linePath.AddLine(intPenWidth / 2, intPenWidth + 1, intPenWidth / 2, this.Height);
|
||||
|
||||
lstArcs.Add(new ArcEntity() { rect = new Rectangle(-1, 0, intPenWidth * 2, intPenWidth * 2), startAngle = 180, sweepAngle = 90 });
|
||||
break;
|
||||
case ConduitStyle.Vertical_None_Left:
|
||||
path.AddLines(new PointF[]
|
||||
{
|
||||
new PointF(0, this.Height),
|
||||
new PointF(0, 0),
|
||||
new PointF(this.ClientRectangle.Right, 0),
|
||||
new PointF(this.ClientRectangle.Right, this.Height-intPenWidth),
|
||||
});
|
||||
path.AddArc(new Rectangle(-1 * intPenWidth, this.Height - intPenWidth * 2, intPenWidth * 2, intPenWidth * 2), 0, 90);
|
||||
path.CloseAllFigures();
|
||||
|
||||
linePath.AddLine(this.Width / 2, 0, this.Width / 2, this.Height - intPenWidth);
|
||||
linePath.AddArc(new Rectangle(-1 * intPenWidth / 2 - 1, this.Height - intPenWidth - intPenWidth / 2 - 1, intPenWidth, intPenWidth), -1, 91);
|
||||
|
||||
lstArcs.Add(new ArcEntity() { rect = new Rectangle(-1 * intPenWidth, this.Height - intPenWidth * 2, intPenWidth * 2, intPenWidth * 2), startAngle = 0, sweepAngle = 90 });
|
||||
break;
|
||||
case ConduitStyle.Vertical_None_Right:
|
||||
path.AddLines(new PointF[]
|
||||
{
|
||||
new PointF(0, this.Height-intPenWidth),
|
||||
new PointF(0, 0),
|
||||
new PointF(this.ClientRectangle.Right, 0),
|
||||
new PointF(this.ClientRectangle.Right, this.Height),
|
||||
});
|
||||
path.AddArc(new Rectangle(-1, this.Height - intPenWidth * 2, intPenWidth * 2, intPenWidth * 2), 90, 90);
|
||||
path.CloseAllFigures();
|
||||
|
||||
linePath.AddLine(this.Width / 2, 0, this.Width / 2, this.Height - intPenWidth - 1);
|
||||
linePath.AddArc(new Rectangle(intPenWidth / 2, this.Height - intPenWidth - intPenWidth / 2 - 1, intPenWidth, intPenWidth), 181, -91);
|
||||
|
||||
lstArcs.Add(new ArcEntity() { rect = new Rectangle(-1, this.Height - intPenWidth * 2, intPenWidth * 2, intPenWidth * 2), startAngle = 90, sweepAngle = 90 });
|
||||
break;
|
||||
case ConduitStyle.Vertical_Left_Right:
|
||||
path.AddLine(this.Width, intPenWidth, this.Width, this.Height);
|
||||
path.AddArc(new Rectangle(-1, this.Height - intPenWidth * 2, intPenWidth * 2, intPenWidth * 2), 90, 90);
|
||||
path.AddLine(0, this.Height - intPenWidth, 0, 0);
|
||||
path.AddArc(new Rectangle(-1 * intPenWidth, 0, intPenWidth * 2, intPenWidth * 2), 270, 90);
|
||||
path.CloseAllFigures();
|
||||
|
||||
linePath.AddArc(new Rectangle(-1 * intPenWidth / 2 - 1, intPenWidth / 2 + 1, intPenWidth, intPenWidth), 269, 91);
|
||||
//linePath.AddLine(intPenWidth / 2, intPenWidth, intPenWidth / 2, this.Height - intPenWidth);
|
||||
linePath.AddArc(new Rectangle(intPenWidth / 2, this.Height - intPenWidth - intPenWidth / 2 - 1, intPenWidth, intPenWidth), 181, -91);
|
||||
|
||||
lstArcs.Add(new ArcEntity() { rect = new Rectangle(-1 * intPenWidth, 0, intPenWidth * 2, intPenWidth * 2), startAngle = 270, sweepAngle = 90 });
|
||||
lstArcs.Add(new ArcEntity() { rect = new Rectangle(-1, this.Height - intPenWidth * 2, intPenWidth * 2, intPenWidth * 2), startAngle = 90, sweepAngle = 90 });
|
||||
break;
|
||||
case ConduitStyle.Vertical_Right_Left:
|
||||
path.AddLine(this.Width, 0, this.Width, this.Height - intPenWidth);
|
||||
path.AddArc(new Rectangle(-1 * intPenWidth, this.Height - intPenWidth * 2, intPenWidth * 2, intPenWidth * 2), 0, 90);
|
||||
path.AddLine(0, this.Height, 0, intPenWidth);
|
||||
path.AddArc(new Rectangle(-1, 0, intPenWidth * 2, intPenWidth * 2), 180, 90);
|
||||
path.CloseAllFigures();
|
||||
|
||||
linePath.AddArc(new Rectangle(intPenWidth / 2, intPenWidth / 2 + 1, intPenWidth, intPenWidth), 271, -91);
|
||||
//linePath.AddLine(intPenWidth / 2, intPenWidth, intPenWidth / 2, this.Height - intPenWidth);
|
||||
linePath.AddArc(new Rectangle(-1 * intPenWidth / 2 - 1, this.Height - intPenWidth - intPenWidth / 2 - 1, intPenWidth, intPenWidth), -1, 91);
|
||||
|
||||
lstArcs.Add(new ArcEntity() { rect = new Rectangle(-1, 0, intPenWidth * 2, intPenWidth * 2), startAngle = 180, sweepAngle = 90 });
|
||||
lstArcs.Add(new ArcEntity() { rect = new Rectangle(-1 * intPenWidth, this.Height - intPenWidth * 2, intPenWidth * 2, intPenWidth * 2), startAngle = 0, sweepAngle = 90 });
|
||||
break;
|
||||
case ConduitStyle.Vertical_Left_Left:
|
||||
path.AddLine(this.Width, intPenWidth, this.Width, this.Height - intPenWidth);
|
||||
path.AddArc(new Rectangle(-1 * intPenWidth, this.Height - intPenWidth * 2, intPenWidth * 2, intPenWidth * 2), 0, 90);
|
||||
path.AddLine(0, this.Height, 0, 0);
|
||||
path.AddArc(new Rectangle(-1 * intPenWidth, 0, intPenWidth * 2, intPenWidth * 2), 270, 90);
|
||||
path.CloseAllFigures();
|
||||
|
||||
linePath.AddArc(new Rectangle(-1 * intPenWidth / 2 - 1, intPenWidth / 2 + 1, intPenWidth, intPenWidth), 269, 91);
|
||||
//linePath.AddLine(intPenWidth / 2, intPenWidth, intPenWidth / 2, this.Height - intPenWidth);
|
||||
linePath.AddArc(new Rectangle(-1 * intPenWidth / 2 - 1, this.Height - intPenWidth - intPenWidth / 2 - 1, intPenWidth, intPenWidth), -1, 91);
|
||||
|
||||
lstArcs.Add(new ArcEntity() { rect = new Rectangle(-1 * intPenWidth, 0, intPenWidth * 2, intPenWidth * 2), startAngle = 270, sweepAngle = 90 });
|
||||
lstArcs.Add(new ArcEntity() { rect = new Rectangle(-1 * intPenWidth, this.Height - intPenWidth * 2, intPenWidth * 2, intPenWidth * 2), startAngle = 0, sweepAngle = 90 });
|
||||
break;
|
||||
case ConduitStyle.Vertical_Right_Right:
|
||||
path.AddLine(this.Width, 0, this.Width, this.Height);
|
||||
path.AddArc(new Rectangle(-1, this.Height - intPenWidth * 2, intPenWidth * 2, intPenWidth * 2), 90, 90);
|
||||
path.AddLine(0, this.Height - intPenWidth, 0, intPenWidth);
|
||||
path.AddArc(new Rectangle(-1, 0, intPenWidth * 2, intPenWidth * 2), 180, 90);
|
||||
path.CloseAllFigures();
|
||||
|
||||
linePath.AddArc(new Rectangle(intPenWidth / 2, intPenWidth / 2 + 1, intPenWidth, intPenWidth), 271, -91);
|
||||
//linePath.AddLine(intPenWidth / 2, intPenWidth, intPenWidth / 2, this.Height - intPenWidth);
|
||||
linePath.AddArc(new Rectangle(intPenWidth / 2, this.Height - intPenWidth - intPenWidth / 2 - 1, intPenWidth, intPenWidth), 180, -91);
|
||||
|
||||
lstArcs.Add(new ArcEntity() { rect = new Rectangle(-1, 0, intPenWidth * 2, intPenWidth * 2), startAngle = 180, sweepAngle = 90 });
|
||||
lstArcs.Add(new ArcEntity() { rect = new Rectangle(-1, this.Height - intPenWidth * 2, intPenWidth * 2, intPenWidth * 2), startAngle = 90, sweepAngle = 90 });
|
||||
break;
|
||||
case ConduitStyle.Vertical_Tilt_Left:
|
||||
double angleLeft = Math.Atan((this.ClientRectangle.Width - conduitWidth) / (double)this.ClientRectangle.Height);
|
||||
angleLeft = angleLeft / Math.PI * 180f;
|
||||
path.AddArc(new Rectangle(this.ClientRectangle.Left - 1, ClientRectangle.Top - conduitWidth, conduitWidth * 2, conduitWidth * 2), 180, -1 * (float)angleLeft);
|
||||
path.AddLine(new Point(this.ClientRectangle.Right - conduitWidth, this.ClientRectangle.Bottom), new Point(this.ClientRectangle.Right, this.ClientRectangle.Bottom));
|
||||
path.AddArc(new Rectangle(this.ClientRectangle.Right - conduitWidth * 2, this.ClientRectangle.Bottom - conduitWidth, conduitWidth * 2, conduitWidth * 2), 0, -1 * (float)angleLeft);
|
||||
path.AddLine(new Point(this.ClientRectangle.Left + conduitWidth, this.ClientRectangle.Top), new Point(this.ClientRectangle.Left, this.ClientRectangle.Top));
|
||||
path.CloseAllFigures();
|
||||
|
||||
|
||||
linePath.AddArc(new Rectangle(this.ClientRectangle.Left + conduitWidth / 2, this.ClientRectangle.Top - conduitWidth / 2, conduitWidth, conduitWidth), 185, -1 * (float)angleLeft - 5);
|
||||
linePath.AddArc(new Rectangle(this.ClientRectangle.Right - conduitWidth - conduitWidth / 2, this.ClientRectangle.Bottom - conduitWidth / 2, conduitWidth, conduitWidth), -1 * (float)angleLeft, (float)angleLeft);
|
||||
|
||||
lstArcs.Add(new ArcEntity() { rect = new Rectangle(this.ClientRectangle.Left - 1, ClientRectangle.Top - conduitWidth, conduitWidth * 2, conduitWidth * 2), startAngle = 180, sweepAngle = -1 * (float)angleLeft });
|
||||
lstArcs.Add(new ArcEntity() { rect = new Rectangle(this.ClientRectangle.Right - conduitWidth * 2, this.ClientRectangle.Bottom - conduitWidth, conduitWidth * 2, conduitWidth * 2), startAngle = 0, sweepAngle = -1 * (float)angleLeft });
|
||||
|
||||
tileLine.Add(new Point[]
|
||||
{
|
||||
new Point((int)(this.ClientRectangle.Left + conduitWidth),this.ClientRectangle.Top),
|
||||
new Point((int)(this.ClientRectangle.Right-conduitWidth+Math.Cos(Math.PI * (angleLeft / 180.00F)) * conduitWidth),(int)(this.ClientRectangle.Bottom-Math.Sin(Math.PI * (angleLeft / 180.00F)) * conduitWidth))
|
||||
});
|
||||
tileLine.Add(new Point[]
|
||||
{
|
||||
new Point((int)(this.ClientRectangle.Left-1+conduitWidth-Math.Cos(Math.PI * (angleLeft / 180.00F)) * conduitWidth),(int)(this.ClientRectangle.Top+Math.Sin(Math.PI * (angleLeft / 180.00F)) * conduitWidth)),
|
||||
new Point(this.ClientRectangle.Right-conduitWidth,this.ClientRectangle.Bottom)
|
||||
});
|
||||
break;
|
||||
case ConduitStyle.Vertical_Tilt_Right:
|
||||
double angleRight = Math.Atan((this.ClientRectangle.Width - conduitWidth) / (double)this.ClientRectangle.Height);
|
||||
angleRight = angleRight / Math.PI * 180f;
|
||||
path.AddArc(new Rectangle(this.ClientRectangle.Right - conduitWidth * 2, ClientRectangle.Top - conduitWidth, conduitWidth * 2, conduitWidth * 2), 0, (float)angleRight);
|
||||
path.AddLine(new Point(this.ClientRectangle.Left + conduitWidth, this.ClientRectangle.Bottom), new Point(this.ClientRectangle.Left, this.ClientRectangle.Bottom));
|
||||
path.AddArc(new Rectangle(this.ClientRectangle.Left - 1, this.ClientRectangle.Bottom - conduitWidth, conduitWidth * 2, conduitWidth * 2), 180, (float)angleRight);
|
||||
path.AddLine(new Point(this.ClientRectangle.Right - conduitWidth, this.ClientRectangle.Top), new Point(this.ClientRectangle.Right, this.ClientRectangle.Top));
|
||||
path.CloseAllFigures();
|
||||
|
||||
|
||||
linePath.AddArc(new Rectangle(this.ClientRectangle.Right - conduitWidth - conduitWidth / 2, this.ClientRectangle.Top - conduitWidth / 2, conduitWidth, conduitWidth), -5, (float)angleRight + 5);
|
||||
linePath.AddArc(new Rectangle(this.ClientRectangle.Left + conduitWidth / 2, this.ClientRectangle.Bottom - conduitWidth / 2, conduitWidth, conduitWidth), 180 + (float)angleRight, -1 * (float)angleRight);
|
||||
|
||||
lstArcs.Add(new ArcEntity() { rect = new Rectangle(this.ClientRectangle.Right - conduitWidth * 2, ClientRectangle.Top - conduitWidth, conduitWidth * 2, conduitWidth * 2), startAngle = 0, sweepAngle = (float)angleRight });
|
||||
lstArcs.Add(new ArcEntity() { rect = new Rectangle(this.ClientRectangle.Left - 1, this.ClientRectangle.Bottom - conduitWidth, conduitWidth * 2, conduitWidth * 2), startAngle = 180, sweepAngle = (float)angleRight });
|
||||
|
||||
tileLine.Add(new Point[]
|
||||
{
|
||||
new Point((int)(this.ClientRectangle.Right - conduitWidth),this.ClientRectangle.Top),
|
||||
new Point((int)(this.ClientRectangle.Left + conduitWidth - Math.Cos(Math.PI * (angleRight / 180.00F)) * conduitWidth),(int)(this.ClientRectangle.Bottom-Math.Sin(Math.PI * (angleRight / 180.00F)) * conduitWidth))
|
||||
});
|
||||
tileLine.Add(new Point[]
|
||||
{
|
||||
new Point((int)(this.ClientRectangle.Right - conduitWidth+Math.Cos(Math.PI * (angleRight / 180.00F)) * conduitWidth),(int)(this.ClientRectangle.Top+Math.Sin(Math.PI * (angleRight / 180.00F)) * conduitWidth)),
|
||||
new Point(this.ClientRectangle.Left + conduitWidth,this.ClientRectangle.Bottom)
|
||||
});
|
||||
break;
|
||||
#endregion
|
||||
}
|
||||
base.Region = new Region(path);
|
||||
g.FillPath(new SolidBrush(conduitColor), path);
|
||||
|
||||
//渐变色
|
||||
int _intPenWidth = intPenWidth;
|
||||
if (conduitStyle.ToString().Contains("Tilt"))
|
||||
{
|
||||
_intPenWidth = conduitWidth;
|
||||
}
|
||||
int intCount = _intPenWidth / 2 / 4;
|
||||
for (int i = 0; i < intCount; i++)
|
||||
{
|
||||
int _penWidth = _intPenWidth / 2 - 4 * i;
|
||||
if (_penWidth <= 0)
|
||||
_penWidth = 1;
|
||||
g.DrawPath(new Pen(new SolidBrush(Color.FromArgb(40, Color.White.R, Color.White.G, Color.White.B)), _penWidth), linePath);
|
||||
if (_penWidth == 1)
|
||||
break;
|
||||
}
|
||||
|
||||
g.SetGDIHigh();
|
||||
//使用抗锯齿画圆角
|
||||
foreach (var item in lstArcs)
|
||||
{
|
||||
g.DrawArc(new Pen(new SolidBrush(this.BackColor)), item.rect, item.startAngle, item.sweepAngle);
|
||||
}
|
||||
|
||||
if (tileLine.Count > 0)
|
||||
{
|
||||
foreach (var item in tileLine)
|
||||
{
|
||||
g.DrawLine(new Pen(new SolidBrush(this.BackColor)), item[0], item[1]);
|
||||
}
|
||||
}
|
||||
|
||||
//液体流动
|
||||
if (LiquidDirection != LiquidDirection.None)
|
||||
{
|
||||
Pen p = new Pen(new SolidBrush(liquidColor), 4);
|
||||
p.DashPattern = new float[] { 6, 6 };
|
||||
p.DashOffset = intLineLeft * (LiquidDirection == LiquidDirection.Forward ? -1 : 1);
|
||||
g.DrawPath(p, linePath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Class ArcEntity.
|
||||
/// </summary>
|
||||
class ArcEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the rect.
|
||||
/// </summary>
|
||||
/// <value>The rect.</value>
|
||||
public Rectangle rect { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the start angle.
|
||||
/// </summary>
|
||||
/// <value>The start angle.</value>
|
||||
public float startAngle { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the sweep angle.
|
||||
/// </summary>
|
||||
/// <value>The sweep angle.</value>
|
||||
public float sweepAngle { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enum LiquidDirection
|
||||
/// </summary>
|
||||
public enum LiquidDirection
|
||||
{
|
||||
/// <summary>
|
||||
/// The none
|
||||
/// </summary>
|
||||
None,
|
||||
/// <summary>
|
||||
/// The forward
|
||||
/// </summary>
|
||||
Forward,
|
||||
/// <summary>
|
||||
/// The backward
|
||||
/// </summary>
|
||||
Backward
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 管道样式Enum ConduitStyle
|
||||
/// </summary>
|
||||
public enum ConduitStyle
|
||||
{
|
||||
/// <summary>
|
||||
/// 直线 The horizontal none none
|
||||
/// </summary>
|
||||
Horizontal_None_None,
|
||||
/// <summary>
|
||||
/// 左上The horizontal up none
|
||||
/// </summary>
|
||||
Horizontal_Up_None,
|
||||
/// <summary>
|
||||
/// 左下The horizontal down none
|
||||
/// </summary>
|
||||
Horizontal_Down_None,
|
||||
/// <summary>
|
||||
/// 右上The horizontal none up
|
||||
/// </summary>
|
||||
Horizontal_None_Up,
|
||||
/// <summary>
|
||||
/// 右下The horizontal none down
|
||||
/// </summary>
|
||||
Horizontal_None_Down,
|
||||
/// <summary>
|
||||
/// 左下右上The horizontal down up
|
||||
/// </summary>
|
||||
Horizontal_Down_Up,
|
||||
/// <summary>
|
||||
/// 左上右下The horizontal up down
|
||||
/// </summary>
|
||||
Horizontal_Up_Down,
|
||||
/// <summary>
|
||||
/// 左上,右上The horizontal up up
|
||||
/// </summary>
|
||||
Horizontal_Up_Up,
|
||||
/// <summary>
|
||||
/// 左下右下The horizontal down down
|
||||
/// </summary>
|
||||
Horizontal_Down_Down,
|
||||
/// <summary>
|
||||
/// 向上倾斜The horizontal tilt up
|
||||
/// </summary>
|
||||
Horizontal_Tilt_Up,
|
||||
/// <summary>
|
||||
/// 向下倾斜The horizontal tilt down
|
||||
/// </summary>
|
||||
Horizontal_Tilt_Down,
|
||||
|
||||
/// <summary>
|
||||
/// 竖线The vertical none none
|
||||
/// </summary>
|
||||
Vertical_None_None,
|
||||
/// <summary>
|
||||
/// 上左The vertical left none
|
||||
/// </summary>
|
||||
Vertical_Left_None,
|
||||
/// <summary>
|
||||
/// 上右The vertical right none
|
||||
/// </summary>
|
||||
Vertical_Right_None,
|
||||
/// <summary>
|
||||
/// 下左The vertical none left
|
||||
/// </summary>
|
||||
Vertical_None_Left,
|
||||
/// <summary>
|
||||
/// 下右The vertical none right
|
||||
/// </summary>
|
||||
Vertical_None_Right,
|
||||
/// <summary>
|
||||
/// 上左下右The vertical left right
|
||||
/// </summary>
|
||||
Vertical_Left_Right,
|
||||
/// <summary>
|
||||
/// 上右下左The vertical right left
|
||||
/// </summary>
|
||||
Vertical_Right_Left,
|
||||
/// <summary>
|
||||
/// 上左下左The vertical left left
|
||||
/// </summary>
|
||||
Vertical_Left_Left,
|
||||
/// <summary>
|
||||
/// 上右下右The vertical right left
|
||||
/// </summary>
|
||||
Vertical_Right_Right,
|
||||
/// <summary>
|
||||
/// 向左倾斜The vertical tilt
|
||||
/// </summary>
|
||||
Vertical_Tilt_Left,
|
||||
/// <summary>
|
||||
/// 向右倾斜The vertical tilt right
|
||||
/// </summary>
|
||||
Vertical_Tilt_Right
|
||||
}
|
||||
}
|
@ -0,0 +1,296 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-05
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCConveyor.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.ComponentModel;
|
||||
using Timer = System.Windows.Forms.Timer;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCConveyor.
|
||||
/// Implements the <see cref="System.Windows.Forms.UserControl" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Windows.Forms.UserControl" />
|
||||
public class UCConveyor : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// The conveyor color
|
||||
/// </summary>
|
||||
private Color conveyorColor = Color.FromArgb(255, 77, 59);
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the conveyor.
|
||||
/// </summary>
|
||||
/// <value>The color of the conveyor.</value>
|
||||
[Description("传送带颜色"), Category("自定义")]
|
||||
public Color ConveyorColor
|
||||
{
|
||||
get { return conveyorColor; }
|
||||
set
|
||||
{
|
||||
conveyorColor = value;
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The inclination
|
||||
/// </summary>
|
||||
private double inclination = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the inclination.
|
||||
/// </summary>
|
||||
/// <value>The inclination.</value>
|
||||
[Description("传送带角度(-90<=value<=90)"), Category("自定义")]
|
||||
public double Inclination
|
||||
{
|
||||
get { return inclination; }
|
||||
set
|
||||
{
|
||||
if (value > 90 || value < -90)
|
||||
return;
|
||||
inclination = value;
|
||||
ResetWorkingRect();
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The conveyor height
|
||||
/// </summary>
|
||||
private int conveyorHeight = 50;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the height of the conveyor.
|
||||
/// </summary>
|
||||
/// <value>The height of the conveyor.</value>
|
||||
[Description("传送带高度"), Category("自定义")]
|
||||
public int ConveyorHeight
|
||||
{
|
||||
get { return conveyorHeight; }
|
||||
set
|
||||
{
|
||||
conveyorHeight = value;
|
||||
ResetWorkingRect();
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The conveyor direction
|
||||
/// </summary>
|
||||
private ConveyorDirection conveyorDirection = ConveyorDirection.Forward;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the conveyor direction.
|
||||
/// </summary>
|
||||
/// <value>The conveyor direction.</value>
|
||||
[Description("传送带运行方向"), Category("自定义")]
|
||||
public ConveyorDirection ConveyorDirection
|
||||
{
|
||||
get { return conveyorDirection; }
|
||||
set
|
||||
{
|
||||
conveyorDirection = value;
|
||||
if (value == HZH_Controls.Controls.ConveyorDirection.None)
|
||||
{
|
||||
m_timer.Enabled = false;
|
||||
Refresh();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_timer.Enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The liquid speed
|
||||
/// </summary>
|
||||
private int conveyorSpeed = 100;
|
||||
|
||||
/// <summary>
|
||||
/// 传送带运行速度,越小,速度越快Gets or sets the ConveyorSpeed.
|
||||
/// </summary>
|
||||
/// <value>The liquid speed.</value>
|
||||
[Description("传送带运行速度,越小,速度越快"), Category("自定义")]
|
||||
public int ConveyorSpeed
|
||||
{
|
||||
get { return conveyorSpeed; }
|
||||
set
|
||||
{
|
||||
if (value <= 0)
|
||||
return;
|
||||
conveyorSpeed = value;
|
||||
m_timer.Interval = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The m working rect
|
||||
/// </summary>
|
||||
Rectangle m_workingRect;
|
||||
/// <summary>
|
||||
/// The int line left
|
||||
/// </summary>
|
||||
int intLineLeft = 0;
|
||||
/// <summary>
|
||||
/// The m timer
|
||||
/// </summary>
|
||||
Timer m_timer;
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCConveyor" /> class.
|
||||
/// </summary>
|
||||
public UCConveyor()
|
||||
{
|
||||
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
||||
this.SetStyle(ControlStyles.DoubleBuffer, true);
|
||||
this.SetStyle(ControlStyles.ResizeRedraw, true);
|
||||
this.SetStyle(ControlStyles.Selectable, true);
|
||||
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||||
this.SetStyle(ControlStyles.UserPaint, true);
|
||||
this.SizeChanged += UCConveyor_SizeChanged;
|
||||
this.Size = new Size(300, 50);
|
||||
m_timer = new Timer();
|
||||
m_timer.Interval = 100;
|
||||
m_timer.Tick += timer_Tick;
|
||||
m_timer.Enabled = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the Tick event of the timer control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
void timer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
intLineLeft += 2;
|
||||
if (intLineLeft > 12)
|
||||
intLineLeft = 0;
|
||||
Refresh();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the SizeChanged event of the UCConveyor control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
void UCConveyor_SizeChanged(object sender, EventArgs e)
|
||||
{
|
||||
ResetWorkingRect();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the working rect.
|
||||
/// </summary>
|
||||
private void ResetWorkingRect()
|
||||
{
|
||||
if (inclination == 90 || inclination == -90)
|
||||
{
|
||||
m_workingRect = new Rectangle((this.Width - conveyorHeight) / 2, 1, conveyorHeight, this.Height - 2);
|
||||
}
|
||||
else if (inclination == 0)
|
||||
{
|
||||
m_workingRect = new Rectangle(1, (this.Height - conveyorHeight) / 2 + 1, this.Width - 2, conveyorHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
//根据角度计算需要的高度
|
||||
int intHeight = (int)(Math.Tan(Math.PI * (Math.Abs(inclination) / 180.00000)) * (this.Width));
|
||||
if (intHeight >= this.Height)
|
||||
intHeight = this.Height;
|
||||
|
||||
int intWidth = (int)(intHeight / (Math.Tan(Math.PI * (Math.Abs(inclination) / 180.00000))));
|
||||
intHeight += conveyorHeight;
|
||||
if (intHeight >= this.Height)
|
||||
intHeight = this.Height;
|
||||
m_workingRect = new Rectangle((this.Width - intWidth) / 2 + 1, (this.Height - intHeight) / 2 + 1, intWidth - 2, intHeight - 2);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 引发 <see cref="E:System.Windows.Forms.Control.Paint" /> 事件。
|
||||
/// </summary>
|
||||
/// <param name="e">包含事件数据的 <see cref="T:System.Windows.Forms.PaintEventArgs" />。</param>
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
var g = e.Graphics;
|
||||
g.SetGDIHigh();
|
||||
//g.FillRectangle(new SolidBrush(Color.FromArgb(100, conveyorColor)), m_workingRect);
|
||||
|
||||
//轴
|
||||
//左端
|
||||
var rectLeft = new Rectangle(m_workingRect.Left + 5, (inclination >= 0 ? (m_workingRect.Bottom - conveyorHeight) : m_workingRect.Top) + 5, conveyorHeight - 10, conveyorHeight - 10);
|
||||
g.FillEllipse(new SolidBrush(conveyorColor), rectLeft);
|
||||
g.FillEllipse(new SolidBrush(Color.White), new Rectangle(rectLeft.Left + (rectLeft.Width - 6) / 2, rectLeft.Top + (rectLeft.Height - 6) / 2, 6, 6));
|
||||
//右端
|
||||
var rectRight = new Rectangle(m_workingRect.Right - conveyorHeight + 5, (inclination >= 0 ? (m_workingRect.Top) : (m_workingRect.Bottom - conveyorHeight)) + 5, conveyorHeight - 10, conveyorHeight - 10);
|
||||
g.FillEllipse(new SolidBrush(conveyorColor), rectRight);
|
||||
g.FillEllipse(new SolidBrush(Color.White), new Rectangle(rectRight.Left + (rectRight.Width - 6) / 2, rectRight.Top + (rectRight.Height - 6) / 2, 6, 6));
|
||||
|
||||
//传送带
|
||||
//左端
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
GraphicsPath pathRegion = new GraphicsPath();
|
||||
path.AddArc(new Rectangle(m_workingRect.Left + 3, (inclination >= 0 ? (m_workingRect.Bottom - conveyorHeight) : m_workingRect.Top) + 3, conveyorHeight - 6, conveyorHeight - 6), 90F - (float)inclination, 180F);
|
||||
pathRegion.AddArc(new Rectangle(m_workingRect.Left, (inclination >= 0 ? (m_workingRect.Bottom - conveyorHeight) : m_workingRect.Top), conveyorHeight, conveyorHeight), 90F - (float)inclination, 180F);
|
||||
//右端
|
||||
path.AddArc(new Rectangle(m_workingRect.Right - conveyorHeight + 3, (inclination >= 0 ? (m_workingRect.Top) : (m_workingRect.Bottom - conveyorHeight)) + 3, conveyorHeight - 6, conveyorHeight - 6), 270 - (float)inclination, 180F);
|
||||
pathRegion.AddArc(new Rectangle(m_workingRect.Right - conveyorHeight, (inclination >= 0 ? (m_workingRect.Top) : (m_workingRect.Bottom - conveyorHeight)), conveyorHeight, conveyorHeight), 270 - (float)inclination, 180F);
|
||||
path.CloseAllFigures();
|
||||
|
||||
base.Region = new System.Drawing.Region(pathRegion);
|
||||
|
||||
g.DrawPath(new Pen(new SolidBrush(conveyorColor), 3), path);
|
||||
|
||||
//液体流动
|
||||
if (ConveyorDirection != ConveyorDirection.None)
|
||||
{
|
||||
Pen p = new Pen(new SolidBrush(Color.FromArgb(150, this.BackColor)), 4);
|
||||
p.DashPattern = new float[] { 6, 6 };
|
||||
p.DashOffset = intLineLeft * (ConveyorDirection == ConveyorDirection.Forward ? -1 : 1);
|
||||
g.DrawPath(p, path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enum ConveyorDirection
|
||||
/// </summary>
|
||||
public enum ConveyorDirection
|
||||
{
|
||||
/// <summary>
|
||||
/// The none
|
||||
/// </summary>
|
||||
None,
|
||||
/// <summary>
|
||||
/// The forward
|
||||
/// </summary>
|
||||
Forward,
|
||||
/// <summary>
|
||||
/// The backward
|
||||
/// </summary>
|
||||
Backward
|
||||
}
|
||||
}
|
37
X009/src/HZH_Controls/Controls/FactoryControls/DialAisle/UCDialAisle.Designer.cs
generated
Normal file
37
X009/src/HZH_Controls/Controls/FactoryControls/DialAisle/UCDialAisle.Designer.cs
generated
Normal file
@ -0,0 +1,37 @@
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
partial class UCDialAisle
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -0,0 +1,308 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
public partial class UCDialAisle : UserControl
|
||||
{
|
||||
[Description("点击项目事件,sender为项目序号,如果是-1,则表示按下的是C键"), Category("自定义")]
|
||||
public event EventHandler ClickItemEvent;
|
||||
|
||||
[Description("连通项目事件,sender为一个数组,表示已连通的项目,数组内容为项目序号,如果数组长度为0则表示当前没有任何连通,如果长度为1则表示单方连通"), Category("自定义")]
|
||||
public event EventHandler LineItemEvent;
|
||||
private Color dialColor = Color.FromArgb(236, 219, 209);
|
||||
|
||||
[Description("圆盘颜色"), Category("自定义")]
|
||||
public Color DialColor
|
||||
{
|
||||
get { return dialColor; }
|
||||
set
|
||||
{
|
||||
dialColor = value;
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
private string[] itemTexts;
|
||||
|
||||
[Description("转盘项目文字"), Category("自定义")]
|
||||
public string[] ItemTexts
|
||||
{
|
||||
get { return itemTexts; }
|
||||
set
|
||||
{
|
||||
if (value == null || value.Length < 2)
|
||||
return;
|
||||
itemTexts = value;
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
Dictionary<int, RectangleF> m_lstItemRectCache = new Dictionary<int, RectangleF>();
|
||||
|
||||
private Color itemColor = Color.FromArgb(215, 221, 224);
|
||||
|
||||
[Description("项目颜色"), Category("自定义")]
|
||||
public Color ItemColor
|
||||
{
|
||||
get { return itemColor; }
|
||||
set
|
||||
{
|
||||
itemColor = value;
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
private Color itemForeColor = Color.Black;
|
||||
|
||||
[Description("项目文字颜色"), Category("自定义")]
|
||||
public Color ItemForeColor
|
||||
{
|
||||
get { return itemForeColor; }
|
||||
set
|
||||
{
|
||||
itemForeColor = value;
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
private Color itemSelectColor = Color.Green;
|
||||
|
||||
[Description("项目选中时颜色"), Category("自定义")]
|
||||
public Color ItemSelectColor
|
||||
{
|
||||
get { return itemSelectColor; }
|
||||
set
|
||||
{
|
||||
itemSelectColor = value;
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
private Color itemSelectForeColor = Color.White;
|
||||
|
||||
[Description("项目选中时文字颜色"), Category("自定义")]
|
||||
public Color ItemSelectForeColor
|
||||
{
|
||||
get { return itemSelectForeColor; }
|
||||
set
|
||||
{
|
||||
itemSelectForeColor = value;
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
private Color linkColor = Color.FromArgb(255, 77, 59);
|
||||
|
||||
[Description("链接管道颜色"), Category("自定义")]
|
||||
public Color LinkColor
|
||||
{
|
||||
get { return linkColor; }
|
||||
set
|
||||
{
|
||||
linkColor = value;
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
private bool enabledClick = false;
|
||||
|
||||
[Description("是否启用点击"), Category("自定义")]
|
||||
public bool EnabledClick
|
||||
{
|
||||
get { return enabledClick; }
|
||||
set { enabledClick = value; }
|
||||
}
|
||||
|
||||
private List<int> m_lstSelectItemIndex = new List<int>();
|
||||
|
||||
Rectangle m_rectWorking;
|
||||
public UCDialAisle()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
||||
this.SetStyle(ControlStyles.DoubleBuffer, true);
|
||||
this.SetStyle(ControlStyles.ResizeRedraw, true);
|
||||
this.SetStyle(ControlStyles.Selectable, true);
|
||||
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||||
this.SetStyle(ControlStyles.UserPaint, true);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
ItemTexts = new string[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" };
|
||||
UCDialAisle_SizeChanged(null, null);
|
||||
this.SizeChanged += UCDialAisle_SizeChanged;
|
||||
this.MouseClick += UCDialAisle_MouseClick;
|
||||
}
|
||||
|
||||
void UCDialAisle_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (!enabledClick)
|
||||
return;
|
||||
foreach (var item in m_lstItemRectCache)
|
||||
{
|
||||
if (ClickItemEvent != null)
|
||||
{
|
||||
ClickItemEvent(item.Key, e);
|
||||
}
|
||||
if (item.Value.Contains(e.Location))
|
||||
{
|
||||
if (item.Key == -1)
|
||||
{
|
||||
m_lstSelectItemIndex.Clear();
|
||||
Refresh();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_lstSelectItemIndex.Contains(item.Key))
|
||||
{
|
||||
m_lstSelectItemIndex.Remove(item.Key);
|
||||
Refresh();
|
||||
}
|
||||
else if (m_lstSelectItemIndex.Count < 2)
|
||||
{
|
||||
m_lstSelectItemIndex.Add(item.Key);
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
if (LineItemEvent != null)
|
||||
{
|
||||
LineItemEvent(m_lstSelectItemIndex.ToArray(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void UCDialAisle_SizeChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (this.Width < 120)
|
||||
{
|
||||
this.Width = 120;
|
||||
return;
|
||||
}
|
||||
if (this.Height < 120)
|
||||
{
|
||||
this.Height = 120;
|
||||
return;
|
||||
}
|
||||
int min = Math.Min(this.Width, this.Height);
|
||||
m_rectWorking = new Rectangle((this.Width - min) / 2, (this.Height - min) / 2, min, min);
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
path.AddEllipse(m_rectWorking);
|
||||
this.Region = new System.Drawing.Region(path);
|
||||
m_lstItemRectCache.Clear();
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
var g = e.Graphics;
|
||||
g.SetGDIHigh();
|
||||
g.FillEllipse(new SolidBrush(dialColor), m_rectWorking);
|
||||
|
||||
//分割线
|
||||
int _splitCount = itemTexts.Length;
|
||||
float fltSplitValue = (float)360 / (float)_splitCount;
|
||||
var rectc = new RectangleF(m_rectWorking.Left + m_rectWorking.Width / 2 - 12.5f, m_rectWorking.Top + m_rectWorking.Height / 2 - 12.5f, 25, 25);
|
||||
|
||||
for (int i = 0; i < _splitCount; i++)
|
||||
{
|
||||
float fltAngle = (fltSplitValue * i + 90) % 360;
|
||||
float fltY1 = (float)(m_rectWorking.Top + m_rectWorking.Width / 2 - ((m_rectWorking.Width / 2) * Math.Sin(Math.PI * (fltAngle / 180.00F))));
|
||||
float fltX1 = (float)(m_rectWorking.Left + (m_rectWorking.Width / 2 - ((m_rectWorking.Width / 2) * Math.Cos(Math.PI * (fltAngle / 180.00F)))));
|
||||
float fltY2 = 0;
|
||||
float fltX2 = 0;
|
||||
|
||||
fltY2 = (float)(m_rectWorking.Top + m_rectWorking.Width / 2 - ((m_rectWorking.Width / 2 - 10) * Math.Sin(Math.PI * (fltAngle / 180.00F))));
|
||||
fltX2 = (float)(m_rectWorking.Left + (m_rectWorking.Width / 2 - ((m_rectWorking.Width / 2 - 10) * Math.Cos(Math.PI * (fltAngle / 180.00F)))));
|
||||
|
||||
var txtSize = new Size(25, 25);
|
||||
float fltFY1 = (float)(m_rectWorking.Top - txtSize.Height / 2 + m_rectWorking.Width / 2 - ((m_rectWorking.Width / 2 - 20) * Math.Sin(Math.PI * (fltAngle / 180.00F))));
|
||||
float fltFX1 = (float)(m_rectWorking.Left - txtSize.Width / 2 + (m_rectWorking.Width / 2 - ((m_rectWorking.Width / 2 - 20) * Math.Cos(Math.PI * (fltAngle / 180.00F)))));
|
||||
var rect = new RectangleF(fltFX1, fltFY1, 25, 25);
|
||||
if (m_lstSelectItemIndex.Contains(i))
|
||||
{
|
||||
g.DrawLine(new Pen(new SolidBrush(linkColor), 9), new PointF(rect.Left + rect.Width / 2, rect.Top + rect.Height / 2), new PointF(rectc.Left + rectc.Width / 2, rectc.Top + rectc.Height / 2));
|
||||
g.FillEllipse(new SolidBrush(itemSelectColor), rect);
|
||||
g.DrawString(itemTexts[i], new Font("微软雅黑", 10), new SolidBrush(itemSelectForeColor), rect, new StringFormat() { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center });
|
||||
}
|
||||
else
|
||||
{
|
||||
g.FillEllipse(new SolidBrush(itemColor), rect);
|
||||
g.DrawString(itemTexts[i], new Font("微软雅黑", 10), new SolidBrush(itemForeColor), rect, new StringFormat() { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center });
|
||||
}
|
||||
if (!m_lstItemRectCache.ContainsKey(i))
|
||||
{
|
||||
m_lstItemRectCache[i] = rect;
|
||||
}
|
||||
}
|
||||
g.FillEllipse(new SolidBrush(itemColor), rectc);
|
||||
g.DrawString("C", new Font("微软雅黑", 10), new SolidBrush(itemForeColor), new RectangleF(m_rectWorking.Left + m_rectWorking.Width / 2 - 12.5f, m_rectWorking.Top + m_rectWorking.Height / 2 - 12.5f, 25, 25), new StringFormat() { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center });
|
||||
if (!m_lstItemRectCache.ContainsKey(-1))
|
||||
{
|
||||
m_lstItemRectCache[-1] = rectc;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 添加一个链接
|
||||
/// </summary>
|
||||
/// <param name="index">链接下标</param>
|
||||
/// <returns>是否成功</returns>
|
||||
public bool AddLink(int index)
|
||||
{
|
||||
if (index >= itemTexts.Length)
|
||||
return false;
|
||||
if (m_lstSelectItemIndex.Count < 2)
|
||||
{
|
||||
m_lstSelectItemIndex.Add(index);
|
||||
Refresh();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 移除一个链接
|
||||
/// </summary>
|
||||
/// <param name="index">链接下标</param>
|
||||
/// <returns>是否成功</returns>
|
||||
public bool RemoveLink(int index)
|
||||
{
|
||||
if (index >= itemTexts.Length)
|
||||
return false;
|
||||
if (m_lstSelectItemIndex.Count <= 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_lstSelectItemIndex.Contains(index))
|
||||
{
|
||||
m_lstSelectItemIndex.Remove(index);
|
||||
Refresh();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 清空所有链接
|
||||
/// </summary>
|
||||
public void ClearAllLink()
|
||||
{
|
||||
m_lstSelectItemIndex.Clear();
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
}
|
46
X009/src/HZH_Controls/Controls/FactoryControls/EllipseDialAisle/UCEllipseDialAisle.Designer.cs
generated
Normal file
46
X009/src/HZH_Controls/Controls/FactoryControls/EllipseDialAisle/UCEllipseDialAisle.Designer.cs
generated
Normal file
@ -0,0 +1,46 @@
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
partial class UCEllipseDialAisle
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// UCEllipseDialAisle
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204)))));
|
||||
this.Name = "UCEllipseDialAisle";
|
||||
this.Size = new System.Drawing.Size(373, 150);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -0,0 +1,336 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
public partial class UCEllipseDialAisle : UserControl
|
||||
{
|
||||
[Description("点击项目事件,sender为项目序号,如果是-1,则表示按下的是中心键"), Category("自定义")]
|
||||
public event EventHandler ClickItemEvent;
|
||||
private List<EllipseDialAisleItem> items = new List<EllipseDialAisleItem>();
|
||||
|
||||
[Description("节点"), Category("自定义")]
|
||||
public EllipseDialAisleItem[] Items
|
||||
{
|
||||
get { return items.ToArray(); }
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
items = new List<EllipseDialAisleItem>();
|
||||
else
|
||||
items = value.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
private EllipseDialAisleItem centreItem;
|
||||
[Description("中心节点"), Category("自定义")]
|
||||
public EllipseDialAisleItem CentreItem
|
||||
{
|
||||
get { return centreItem; }
|
||||
set { centreItem = value; }
|
||||
}
|
||||
|
||||
private bool enabledClick = true;
|
||||
|
||||
[Description("是否启用点击"), Category("自定义")]
|
||||
public bool EnabledClick
|
||||
{
|
||||
get { return enabledClick; }
|
||||
set { enabledClick = value; }
|
||||
}
|
||||
|
||||
private int itemSize = 30;
|
||||
|
||||
[Description("节点大小"), Category("自定义")]
|
||||
public int ItemSize
|
||||
{
|
||||
get { return itemSize; }
|
||||
set { itemSize = value; }
|
||||
}
|
||||
|
||||
private Color borderColor = Color.Red;
|
||||
|
||||
[Description("边框颜色"), Category("自定义")]
|
||||
public Color BorderColor
|
||||
{
|
||||
get { return borderColor; }
|
||||
set { borderColor = value; }
|
||||
}
|
||||
|
||||
Dictionary<EllipseDialAisleItem, RectangleF> m_lstItemRectCache = new Dictionary<EllipseDialAisleItem, RectangleF>();
|
||||
RectangleF centreRect;
|
||||
public UCEllipseDialAisle()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.SizeChanged += UCEllipseDialAisle_SizeChanged;
|
||||
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
||||
this.SetStyle(ControlStyles.DoubleBuffer, true);
|
||||
this.SetStyle(ControlStyles.ResizeRedraw, true);
|
||||
this.SetStyle(ControlStyles.Selectable, true);
|
||||
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||||
this.SetStyle(ControlStyles.UserPaint, true);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
items = new List<EllipseDialAisleItem>();
|
||||
items.Add(new EllipseDialAisleItem() { Text = "1" });
|
||||
items.Add(new EllipseDialAisleItem() { Text = "2" });
|
||||
items.Add(new EllipseDialAisleItem() { Text = "3" });
|
||||
items.Add(new EllipseDialAisleItem() { Text = "4" });
|
||||
items.Add(new EllipseDialAisleItem() { Text = "5" });
|
||||
items.Add(new EllipseDialAisleItem() { Text = "6" });
|
||||
items.Add(new EllipseDialAisleItem() { Text = "7" });
|
||||
items.Add(new EllipseDialAisleItem() { Text = "8" });
|
||||
items.Add(new EllipseDialAisleItem() { Text = "9" });
|
||||
items.Add(new EllipseDialAisleItem() { Text = "10" });
|
||||
items.Add(new EllipseDialAisleItem() { Text = "11" });
|
||||
items.Add(new EllipseDialAisleItem() { Text = "12" });
|
||||
centreItem = new EllipseDialAisleItem() { Text = "-1" };
|
||||
UCEllipseDialAisle_SizeChanged(null, null);
|
||||
this.MouseClick += UCEllipseDialAisle_MouseClick;
|
||||
}
|
||||
void UCEllipseDialAisle_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (!enabledClick)
|
||||
return;
|
||||
|
||||
if (centreRect != null && centreRect.Contains(e.Location))
|
||||
{
|
||||
centreItem.Selected = !centreItem.Selected;
|
||||
if (ClickItemEvent != null)
|
||||
{
|
||||
ClickItemEvent(centreItem, e);
|
||||
}
|
||||
Invalidate();
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var item in m_lstItemRectCache)
|
||||
{
|
||||
if (item.Value.Contains(e.Location))
|
||||
{
|
||||
item.Key.Selected = !item.Key.Selected;
|
||||
if (ClickItemEvent != null)
|
||||
{
|
||||
ClickItemEvent(item.Key, e);
|
||||
}
|
||||
Invalidate();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UCEllipseDialAisle_SizeChanged(object sender, EventArgs e)
|
||||
{
|
||||
m_lstItemRectCache.Clear();
|
||||
if (items == null || items.Count <= 0)
|
||||
return;
|
||||
centreRect = new RectangleF((float)(this.Width - itemSize * 1.5) / 2f, (float)(this.Height - itemSize * 1.5) / 2f, (float)itemSize * 1.5f, (float)itemSize * 1.5f);
|
||||
var zhijing = this.Width > this.Height ? this.Height : this.Width;
|
||||
var yuanzhouchang = Math.PI * zhijing;
|
||||
var zongZhouChang = yuanzhouchang;
|
||||
if (this.Width > this.Height)
|
||||
{
|
||||
zongZhouChang += (this.Width - zhijing) * 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
zongZhouChang += (this.Height - zhijing) * 2;
|
||||
}
|
||||
var sp = (float)(zongZhouChang / items.Count);
|
||||
|
||||
int c1 = (int)(yuanzhouchang / 2 / sp);//计算半个圆可以放几个
|
||||
int c2 = items.Count / 2 - c1;//半个横线放几个
|
||||
if (this.Width > this.Height)
|
||||
{
|
||||
int index = 0;
|
||||
//上
|
||||
for (int i = 0; i < c2; i++)
|
||||
{
|
||||
var rect = new RectangleF(this.Height / 2 + (this.Width - this.Height) / c2 / 2 + i * ((this.Width - this.Height) / c2) - itemSize / 2, 5f, itemSize, itemSize);
|
||||
m_lstItemRectCache[items[index]] = rect;
|
||||
index++;
|
||||
}
|
||||
//右
|
||||
float fltSplitValue = (float)180 / (float)c1;
|
||||
for (int i = 0; i < c1; i++)
|
||||
{
|
||||
float fltAngle = (fltSplitValue * i + 90 + fltSplitValue / 2) % 360;
|
||||
float fltFY1 = (float)(0 - itemSize / 2 + this.Height / 2 - ((this.Height / 2 - 15) * Math.Sin(Math.PI * (fltAngle / 180.00F))));
|
||||
float fltFX1 = (float)(this.Width - this.Height / 2 - itemSize - ((this.Height / 2 - 10) * Math.Cos(Math.PI * (fltAngle / 180.00F))));
|
||||
var rect = new RectangleF(fltFX1, fltFY1, itemSize, itemSize);
|
||||
m_lstItemRectCache[items[index]] = rect;
|
||||
index++;
|
||||
}
|
||||
|
||||
//下
|
||||
for (int i = c2 - 1; i >= 0; i--)
|
||||
{
|
||||
var rect = new RectangleF(this.Height / 2 + (this.Width - this.Height) / c2 / 2 + i * ((this.Width - this.Height) / c2) - itemSize / 2, this.Height - 5f - itemSize, itemSize, itemSize);
|
||||
m_lstItemRectCache[items[index]] = rect;
|
||||
index++;
|
||||
}
|
||||
//左
|
||||
for (int i = 0; i < c1; i++)
|
||||
{
|
||||
float fltAngle = (fltSplitValue * i + 90 + 180 + fltSplitValue / 2) % 360;
|
||||
float fltFY1 = (float)(0 - itemSize / 2 + this.Height / 2 - ((this.Height / 2 - 15) * Math.Sin(Math.PI * (fltAngle / 180.00F))));
|
||||
float fltFX1 = (float)(this.Height / 2 - (((this.Height / 2 - 10) * Math.Cos(Math.PI * (fltAngle / 180.00F)))));
|
||||
var rect = new RectangleF(fltFX1, fltFY1, itemSize, itemSize);
|
||||
m_lstItemRectCache[items[index]] = rect;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int index = 0;
|
||||
float fltSplitValue = (float)180 / (float)c1;
|
||||
//上
|
||||
for (int i = 0; i < c1; i++)
|
||||
{
|
||||
float fltAngle = (fltSplitValue * i + fltSplitValue / 2) % 360;
|
||||
float fltFY1 = (float)(this.Width / 2 - ((this.Width / 2 - 15) * Math.Sin(Math.PI * (fltAngle / 180.00F))));
|
||||
float fltFX1 = (float)(this.Width / 2 - itemSize / 2 - ((this.Width / 2 - 10) * Math.Cos(Math.PI * (fltAngle / 180.00F))));
|
||||
var rect = new RectangleF(fltFX1, fltFY1, itemSize, itemSize);
|
||||
m_lstItemRectCache[items[index]] = rect;
|
||||
index++;
|
||||
}
|
||||
//右
|
||||
for (int i = 0; i < c2; i++)
|
||||
{
|
||||
var rect = new RectangleF(this.Width - itemSize - 5, this.Width / 2+(this.Height-this.Width)/c2/2+ i * ((this.Height-this.Width) / c2)-itemSize/2, itemSize, itemSize);
|
||||
m_lstItemRectCache[items[index]] = rect;
|
||||
index++;
|
||||
}
|
||||
//下
|
||||
for (int i = 0; i < c1; i++)
|
||||
{
|
||||
float fltAngle = (fltSplitValue * i+180 + fltSplitValue / 2) % 360;
|
||||
float fltFY1 = (float)(this.Height - this.Width/2 - itemSize - ((this.Width / 2 - 15) * Math.Sin(Math.PI * (fltAngle / 180.00F))));
|
||||
float fltFX1 = (float)(this.Width / 2 - itemSize / 2 - ((this.Width / 2 - 10) * Math.Cos(Math.PI * (fltAngle / 180.00F))));
|
||||
var rect = new RectangleF(fltFX1, fltFY1, itemSize, itemSize);
|
||||
m_lstItemRectCache[items[index]] = rect;
|
||||
index++;
|
||||
}
|
||||
//左
|
||||
for (int i = c2-1; i >=0; i--)
|
||||
{
|
||||
var rect = new RectangleF(5, this.Width / 2 + (this.Height - this.Width) / c2 / 2 + i * ((this.Height - this.Width) / c2) - itemSize / 2, itemSize, itemSize);
|
||||
m_lstItemRectCache[items[index]] = rect;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
var g = e.Graphics;
|
||||
g.SetGDIHigh();
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
GraphicsPath borderpath = new GraphicsPath();
|
||||
|
||||
|
||||
if (this.Width > this.Height)
|
||||
{
|
||||
borderpath.AddArc(new Rectangle(1, 1, this.Height, this.Height-2), 90, 180);
|
||||
borderpath.AddArc(new Rectangle(this.Width - this.Height-2, 1, this.Height, this.Height-2), 270, 180);
|
||||
borderpath.CloseAllFigures();
|
||||
path.AddArc(new Rectangle(0, 0, this.Height, this.Height), 90, 180);
|
||||
path.AddArc(new Rectangle(this.Width - this.Height, 0, this.Height, this.Height), 270, 180);
|
||||
path.CloseAllFigures();
|
||||
}
|
||||
else
|
||||
{
|
||||
borderpath.AddArc(new Rectangle(1, 1, this.Width-2, this.Width), 180, 180);
|
||||
borderpath.AddArc(new Rectangle(1, this.Height - this.Width-2, this.Width-2, this.Width), 0, 180);
|
||||
borderpath.CloseAllFigures();
|
||||
|
||||
path.AddArc(new Rectangle(0, 0, this.Width, this.Width), 180, 180);
|
||||
path.AddArc(new Rectangle(0, this.Height - this.Width, this.Width, this.Width), 0, 180);
|
||||
path.CloseAllFigures();
|
||||
}
|
||||
base.Region = new Region(path);
|
||||
|
||||
|
||||
foreach (var item in m_lstItemRectCache)
|
||||
{
|
||||
if (item.Key.Selected)
|
||||
{
|
||||
g.FillEllipse(new SolidBrush(item.Key.SelectedBGColor), item.Value);
|
||||
g.DrawString(item.Key.Text, item.Key.Font, new SolidBrush(item.Key.SelectedForeColor), item.Value, new StringFormat() { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center });
|
||||
}
|
||||
else
|
||||
{
|
||||
g.FillEllipse(new SolidBrush(item.Key.BGColor), item.Value);
|
||||
g.DrawString(item.Key.Text, item.Key.Font, new SolidBrush(item.Key.ForeColor), item.Value, new StringFormat() { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center });
|
||||
}
|
||||
}
|
||||
|
||||
if (centreRect != null && centreItem != null)
|
||||
{
|
||||
if (centreItem.Selected)
|
||||
{
|
||||
g.FillEllipse(new SolidBrush(centreItem.SelectedBGColor), centreRect);
|
||||
g.DrawString(centreItem.Text, centreItem.Font, new SolidBrush(centreItem.SelectedForeColor), centreRect, new StringFormat() { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center });
|
||||
}
|
||||
else
|
||||
{
|
||||
g.FillEllipse(new SolidBrush(centreItem.BGColor), centreRect);
|
||||
g.DrawString(centreItem.Text, centreItem.Font, new SolidBrush(centreItem.ForeColor), centreRect, new StringFormat() { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center });
|
||||
}
|
||||
}
|
||||
|
||||
g.DrawPath(new Pen(new SolidBrush(borderColor), 2), borderpath);
|
||||
}
|
||||
}
|
||||
[Serializable]
|
||||
public class EllipseDialAisleItem
|
||||
{
|
||||
public string Key { get; set; }
|
||||
public string Text { get; set; }
|
||||
Color bGColor = Color.FromArgb(255, 77, 59);
|
||||
/// <summary>
|
||||
/// 背景色
|
||||
/// </summary>
|
||||
public Color BGColor { get { return bGColor; } set { bGColor = value; } }
|
||||
Color selectedBGColor = Color.FromArgb(78, 201, 176);
|
||||
/// <summary>
|
||||
/// 选中时背景色
|
||||
/// </summary>
|
||||
public Color SelectedBGColor { get { return selectedBGColor; } set { selectedBGColor = value; } }
|
||||
Color foreColor = Color.White;
|
||||
/// <summary>
|
||||
/// 文字颜色
|
||||
/// </summary>
|
||||
public Color ForeColor
|
||||
{
|
||||
get { return foreColor; }
|
||||
set { foreColor = value; }
|
||||
}
|
||||
Color selectedForeColor = Color.White;
|
||||
/// <summary>
|
||||
/// 选中时文字颜色
|
||||
/// </summary>
|
||||
public Color SelectedForeColor
|
||||
{
|
||||
get { return selectedForeColor; }
|
||||
set { selectedForeColor = value; }
|
||||
}
|
||||
Font font = new Font("微软雅黑", 10);
|
||||
/// <summary>
|
||||
/// 字体
|
||||
/// </summary>
|
||||
public Font Font { get { return font; } set { font = value; } }
|
||||
/// <summary>
|
||||
/// 关联的数据
|
||||
/// </summary>
|
||||
public object DataSource { get; set; }
|
||||
public bool Selected { get; set; }
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user