动态获取当前屏幕中光标所在位置的颜色
【IT168技术文档】
////////////////////////////////////////////////////////////////////////// /// 程序:屏幕取色 /// 功能:动态获取当前屏幕中光标所在位置的颜色 /// 作者:黎波 /// 网名:upto(阿球) /// 邮箱:itfun@163.com /// 日期:2004年3月31日 ////////////////////////////////////////////////////////////////////////// using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.Drawing.Imaging; using System.Runtime.InteropServices; namespace LiBo.ColorPicker { /// <summary> /// Form1 的摘要说明。 /// </summary> public class Form1 : System.Windows.Forms.Form { // 桌面工作区的尺寸 Size workingArea; // Form 的初始位置和在左下角,右下角的位置 Point formLoc, ptLeftBottom, ptRightBottom; private System.Windows.Forms.Label lblColor; private System.Windows.Forms.TextBox txtArgb; private System.Windows.Forms.Timer tmr; private System.Windows.Forms.ToolTip tip; private System.ComponentModel.IContainer components; public Form1() { InitializeComponent(); this.FormBorderStyle = FormBorderStyle.FixedToolWindow; this.StartPosition = FormStartPosition.CenterScreen; Rectangle rect = SystemInformation.WorkingArea; workingArea = new Size(rect.Width, rect.Height); ptLeftBottom = new Point(0, workingArea.Height - this.Height); ptRightBottom = new Point(workingArea.Width - this.Width, workingArea.Height - this.Height); String tipMsg = "在窗体空白处双击鼠标左键开始取色,按ESC键确定颜色"; tip.SetToolTip(this, tipMsg); tip.SetToolTip(lblColor, tipMsg); tip.SetToolTip(txtArgb, tipMsg); } /// <summary> /// 清理所有正在使用的资源。 /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); }
0
相关文章