C#制作的屏幕取色器

主要原理就是将屏幕全图抓屏,然后获取鼠标当前位置,取色。直接看代码:   1 using System;

  2 using System.Collections.Generic;

  3 using System.ComponentModel;

  4 using System.Data;

  5 using System.Drawing;

  6 using System.Linq;

  7 using System.Text;

  8 using System.Windows.Forms;

  9 using System.Runtime.InteropServices;

  10

  11 namespace GetScrColor

  12 {

  13     public partial class Form1 : Form

  14     {

  15         public Form1()

  16         {

  17             InitializeComponent();

  18         }

  19

  20         private bool flag = false;

  21

  22         public struct POINTAPI

  23         {

  24             public uint x;

  25             public uint y;

  26         }

  27

  28         public class WinInfo

  29         {

  30             [DllImport("user32.dll")]

  31             public static extern uint WindowFromPoint

  32             (

  33                 uint x_point,

  34                 uint y_point

  35             );

  36

  37             [DllImport("user32.dll")]

  38             public static extern bool GetCursorPos

  39             (

  40                 ref POINTAPI p

  41             );

  42

  43             [DllImport("user32.dll")]

  44             public static extern uint ScreenToClient

  45             (

  46                 uint hwnd,

  47                 ref POINTAPI p

  48             );

  49

  50             [DllImport("user32.dll")]

  51             public static extern uint GetDC

  52             (

  53                 uint hwnd

  54             );

  55

  56             [DllImport("gdi32.dll")]

  57             public static extern uint GetPixel

  58             (

  59                 uint hDC,

  60                 uint x,

  61                 uint y

  62             );

  63


TAG标签: 屏幕取色器


本文转自 ☆★ 包罗万象网 ★☆ - http://www.baoluowanxiang.com 转载请注明出处,侵权必究!
原文链接:http://www.baoluowanxiang.com/a/program/csharp/2010/0813/1341.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值