|
|
ASP.NET实现的彩色下拉框源码
|
|
|
|
|
|
一、源码描述
|
|
|
环境:VS2022
|
|
|
|
|
|
二、功能介绍
|
|
|
该源码主要是演示如何读取系统颜色并在下拉框中的每个条目中显示对应的颜色,该源码主要展示以下内容:
|
|
|
1、如何获得System.Drawing.KnownColor颜色控件的列表枚举
|
|
|
2、如何排除系统环境颜色,如“Active Border”
|
|
|
3、如何分配颜色到下拉框的每个条目
|
|
|
|
|
|
开发背景:
|
|
|
有人曾经要我开发一个根据不同选择而显示不同颜色的管理工具。
|
|
|
我开始考虑利用下拉框来实现条目背景及显示颜色根据条目名称不同而进行变化,
|
|
|
根据这个思路我在网上搜了半天也没有找到任何相关的解决方案,
|
|
|
最后我想到了一个比当初需求要复杂的方案(包括数据库),所以我尝试着找到一个更简单的实现方案。
|
|
|
|
|
|
This code-source demonstrates how to read system colors and to color-in each row of a drop down list. In this example, I will show:
|
|
|
|
|
|
How to get a list of color names from the System.Drawing.KnownColor enumeration
|
|
|
How to exclude system environment colors, e.g. "Active Border"
|
|
|
How to assign color to each row of the drop down list
|
|
|
|
|
|
Background
|
|
|
I was asked to make an admin tool where different types of appointments can be set.
|
|
|
These appointments would be of unique color and the admin could change the color of the appointment type at any time.
|
|
|
|
|
|
I began to think of a drop down list where the name of the colors would be displayed and t
|
|
|
he background of that row would be of that color. With a view to that, I searched the web and couldn't find any solutions for a long time.
|
|
|
Then I finally found a solution that seemed much more complex than needed, involving a database. So I tried to find an easier solution.
|
|
|
|
|
|
|
|
|
三、注意事项
|
|
|
ctrl+F5运行即可。
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
作者: FuadBinOmar
|
|
|
|
|
|
如需获得该源码的视频、更新等更多资料请访问: https://www.51aspx.com/Code/ColorDropDownList
|
|
|
------------------------------------------------------------------------------------------------
|
|
|
|
|
|
源码服务专家
|
|
|
官网: https://www.51aspx.com
|
|
|
讨论圈: https://club.51aspx.com/
|
|
|
|
|
|
平台声明:
|
|
|
|
|
|
1.51Aspx平台上提供下载的资源为免费、共享、商业三类源码,其中免费和共享源码仅供个人学习和研究使用,商业源码请在相应的授权许可条件下使用;
|
|
|
2.51Aspx平台对提供下载的软件及其它资源不拥有任何权利,其版权归属源码合法拥有者所有;
|
|
|
3.著作权人发现本网站载有侵害其合法权益的内容或作品,请与我们联系( 登录官网与客服反馈或发送邮件到support@51Aspx.com );
|
|
|
4.51Aspx平台不保证提供的下载资源的准确性、安全性和完整性;
|
|
|
|
|
|
友情提示:
|
|
|
一般数据库文件默认在 DB_51Aspx 文件夹下
|
|
|
默认账号密码一般均为51Aspx
|
|
|
关于源码使用常见问题及解决方案,请参阅: https://www.51aspx.com/Help
|