资源简介
有时候做网页时需要拾取屏幕颜色,然后就自己写了个。可以全局热键,可以16进制 rgb hsl转换。
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using MyHelper.Common;
namespace MyHelper.GetColor
{
public partial class GetColorForm : Form
{
public GetColorForm()
{
InitializeComponent();
}
private void button1_Click(object sender EventArgs e) //显示16进制代码颜色
{
Color c = this.colorHx16toRGB(this.textBox_16进制.Text);
this.label_颜色显示.BackColor = c;
this.textBox_R.Text = c.R.ToString();
this.textBox_G.Text = c.G.ToString();
this.textBox_B.Text = c.B.ToString();
HSLColor hsl = new HSLColor(c);
this.textBox_H.Text = hsl.Hue + ““;
this.textBox_S.Text = ((int)(hsl.Saturation * 100)) + ““;
this.textBox_L.Text = ((int)(hsl.Lightness * 100)) + ““;
}
private void button2_Click(object sender EventArgs e) //显示RGB值颜色
{
Color c=Color.FromArgb(Int32.Parse(this.textBox_R.Text) Int32.Parse(this.textBox_G.Text) Int32.Parse(this.textBox_B.Text));
this.label_颜色显示.BackColor = c;
this.textBox_16进制.Text = ColorTranslator.ToHtml(c);
HSLColor hsl = new HSLColor(c);
this.textBox_H.Text = hsl.Hue + ““;
this.textBox_S.Text = ((int)(hsl.Saturation * 100)) + ““;
this.textBox_L.Text = ((int)(hsl.Lightness * 100)) + ““;
}
private void button3_Click(object sender EventArgs e) //选择颜色
{
this.colorDialog1.AllowFullOpen = true;
colorDialog1.AnyColor = true;
colorDialog1.FullOpen = true;
colorDialog1.SolidColorOnly = false;
if (colorDialog1.ShowDialog() == DialogResult.OK)
{
this.textBox_16进制.ForeColor = this.colorDialog1.Color;
this.label_颜色显示.BackColor = this.colorDialog1.Color;
// String str1 = this.colorDialog1.Color.Name.ToString();
// this.textBox1.Text = “#“+str1.Substring(2);
this.textBox_16进制.Text= ColorTranslator.ToHtml(this.colorDialog1.Color);
this.textBox_R.Text = this.colorDialog1.Color.R.ToString();
this.textBox_G.Text = this.colorDialog1.Color.G.ToString();
this.textBox_B.Text = this.colorDialog1.Color.B.ToString();
}
}
private void button_开始_Click(object sender EventArgs e) //开始获取
{
HotKey.RegisterHotKey(this.Handle 12455 true true false false Keys.P);
this.TopMost = true;
this.timer1.Start();
this.button_开始.Enabled = false;
this.button_停止.Enabled = true;
}
private void button_停止_Clic
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 121856 2013-01-09 21:27 MyHelper.GetColor\MyHelper.GetColor\bin\Debug\MyHelper.GetColor.exe
文件 44544 2013-01-09 21:27 MyHelper.GetColor\MyHelper.GetColor\bin\Debug\MyHelper.GetColor.pdb
文件 22472 2013-01-09 21:30 MyHelper.GetColor\MyHelper.GetColor\bin\Debug\MyHelper.GetColor.vshost.exe
文件 8096 2013-01-09 21:26 MyHelper.GetColor\MyHelper.GetColor\GetColorForm.cs
文件 17146 2013-01-09 21:20 MyHelper.GetColor\MyHelper.GetColor\GetColorForm.designer.cs
文件 156226 2013-01-09 21:20 MyHelper.GetColor\MyHelper.GetColor\GetColorForm.resx
文件 1886 2013-01-09 21:26 MyHelper.GetColor\MyHelper.GetColor\HotKey.cs
文件 4690 2013-01-09 21:20 MyHelper.GetColor\MyHelper.GetColor\HSBColor.cs
文件 6548 2013-01-09 21:20 MyHelper.GetColor\MyHelper.GetColor\HSLColor.cs
文件 3987 2013-01-09 21:26 MyHelper.GetColor\MyHelper.GetColor\MyHelper.GetColor.csproj
文件 863 2013-01-09 21:19 MyHelper.GetColor\MyHelper.GetColor\obj\Debug\DesignTimeResolveAssemblyReferences.cache
文件 6899 2013-01-09 21:26 MyHelper.GetColor\MyHelper.GetColor\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 937 2013-01-09 21:30 MyHelper.GetColor\MyHelper.GetColor\obj\Debug\MyHelper.GetColor.csproj.FileListAbsolute.txt
文件 982 2013-01-09 21:26 MyHelper.GetColor\MyHelper.GetColor\obj\Debug\MyHelper.GetColor.csproj.GenerateResource.Cache
文件 2209 2013-01-09 21:26 MyHelper.GetColor\MyHelper.GetColor\obj\Debug\MyHelper.GetColor.csprojResolveAssemblyReference.cache
文件 121856 2013-01-09 21:27 MyHelper.GetColor\MyHelper.GetColor\obj\Debug\MyHelper.GetColor.exe
文件 100244 2013-01-09 21:26 MyHelper.GetColor\MyHelper.GetColor\obj\Debug\MyHelper.GetColor.GetColorForm.resources
文件 44544 2013-01-09 21:27 MyHelper.GetColor\MyHelper.GetColor\obj\Debug\MyHelper.GetColor.pdb
文件 180 2013-01-09 21:26 MyHelper.GetColor\MyHelper.GetColor\obj\Debug\MyHelper.GetColor.Properties.Resources.resources
文件 505 2013-01-09 21:27 MyHelper.GetColor\MyHelper.GetColor\Program.cs
文件 1354 2013-01-09 21:19 MyHelper.GetColor\MyHelper.GetColor\Properties\AssemblyInfo.cs
文件 2886 2013-01-09 21:19 MyHelper.GetColor\MyHelper.GetColor\Properties\Resources.Designer.cs
文件 5612 2013-01-09 21:19 MyHelper.GetColor\MyHelper.GetColor\Properties\Resources.resx
文件 1104 2013-01-09 21:19 MyHelper.GetColor\MyHelper.GetColor\Properties\Settings.Designer.cs
文件 249 2013-01-09 21:19 MyHelper.GetColor\MyHelper.GetColor\Properties\Settings.settings
文件 941 2013-01-09 21:19 MyHelper.GetColor\MyHelper.GetColor.sln
..A..H. 32768 2013-01-09 22:00 MyHelper.GetColor\MyHelper.GetColor.v11.suo
目录 0 2013-01-09 21:19 MyHelper.GetColor\MyHelper.GetColor\obj\Debug\TempPE
目录 0 2013-01-16 16:37 MyHelper.GetColor\MyHelper.GetColor\bin\Debug
目录 0 2013-01-09 21:25 MyHelper.GetColor\MyHelper.GetColor\bin\Release
............此处省略9个文件信息
- 上一篇:c# 生成二维码
- 下一篇:校园导游系统 C#源代码图的应用
相关资源
- C# TIP文件生成和拆解
- C#解析HL7消息的库135797
- C# OCR数字识别实例,采用TessnetOcr,对
- 考试管理系统 - C#源码
- asp.net C#购物车源代码
- C#实时网络流量监听源码
- C#百度地图源码
- Visual C#.2010从入门到精通配套源程序
- Winform可视化打印模板设计工具含源码
- C# 软件版本更新
- C#屏幕软键盘源码,可以自己定制界面
- 智慧城市 智能家居 C# 源代码
- c#获取mobile手机的IMEI和IMSI
- C#实现简单QQ聊天程序
- 操作系统 模拟的 欢迎下载 C#版
- C#写的计算机性能监控程序
- 用C#实现邮件发送,有点类似于outlo
- MVC model层代码生成器 C#
- c#小型图书销售系统
- C# Socket Server Client 通讯应用 完整的服
- c# winform 自动登录 百度账户 源代码
- C#编写的16进制计算器
- C#TCP通信协议
- C# 数据表(Dataset)操作 合并 查询一
- C#语音识别系统speechsdk51,SpeechSDK51L
- 数据库备份还原工具1.0 C# 源码
-
[免费]xm
lDocument 节点遍历C# - EQ2008LEDc#开发实例
- DirectX.Capturec# winform 操作摄像头录像附
- c# 实现的最大最小距离方法对鸢尾花
评论
共有 条评论