获取屏幕中某个点的RGB值与CAD屏幕像素值
'获取CAD屏幕像素的比值
Function ViewScreen() As Double
Dim ScreenSize As Variant
ScreenSize = ThisDrawing.GetVariable("screensize") '当前视口的屏幕宽度和高度
Dim H As Variant
H = ThisDrawing.GetVariable("viewsize") '当前视图图形的实际高度
ViewScreen = Abs(H / ScreenSize(1))
End Function
Public Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
获取屏幕中某个点的RGB值
public static Color GetColor()
{
POINT _Point = new POINT();
GetCursorPos(ref _Point);
IntPtr _Hwnd = WindowFromPoint((uint)_Point.x, (uint)_Point.y);
IntPtr _DC = GetDC(_Hwnd);
ScreenToClient(_Hwnd, ref _Point);
uint _ColorLong = GetPixel(_DC, _Point.x, _Point.y);
Color _Color = Color.FromArgb((int)_ColorLong & 0xFF, (int)(_ColorLong & 0xFF00) / 256, (int)(_ColorLong & 0xFF0000) / 65536); ReleaseDC(_Hwnd, _DC); return _Color; } [StructLayout(LayoutKind.Sequential)]
public struct POINT
{
public int x;
public int y;
}
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC); [DllImport("gdi32.dll")]
public static extern uint GetPixel(IntPtr hDC, int XPos, int YPos); [DllImport("user32.dll")]
public static extern uint ScreenToClient(IntPtr hwnd, ref POINT p_Point); [DllImport("user32.dll")]
public static extern bool GetCursorPos(ref POINT p_Point); [DllImport("user32.dll")]
public static extern IntPtr WindowFromPoint(uint x_point, uint y_point); [DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr GetDC(IntPtr hWnd);
获取屏幕中某个点的RGB值与CAD屏幕像素值的更多相关文章
- 获取UIColor中的RGB值(本人亲测多个获取RGB值的方法,这个最有效)
在自己研发的项目个人项目中,碰到一个从颜色中获取RGB值的需求. 在网上找了许久,也有一些方法可以获取RGB值,但不能获取黑白以及灰色的值(他们是非RGB颜色空间,不清楚什么意思,反正亲测确实获取不了 ...
- android 中获取当前焦点所在屏幕中的位置 view.getLocationOnScreen(location)
final int[] location = new int[2]; view.getLocationOnScreen(location); final int[] location = new in ...
- C#中的bitmap类和图像像素值获取方法
一.Bitmap类 Bitmap对象封装了GDI+中的一个位图,此位图由图形图像及其属性的像素数据组成.因此Bitmap是用于处理由像素数据定义的图像的对象.该类的主要方法和属性如下: 1. GetP ...
- android 获取屏幕的高度和宽度、获取控件在屏幕中的位置、获取屏幕中控件的高度和宽度
(一)获取屏幕的高度和宽度 有两种方法: 方法1: WindowManager wm = (WindowManager) getContext().getSystemService(Context.W ...
- 使用JS,获取URL中指定参数的值
/** * 获取URL中指定参数的值 * * @param name 参数名称 * @returns */ function getQueryString(name) { var reg = new ...
- jsp页面使用el 按key获取map中的对应值
jsp页面使用el 按key获取map中的对应值 转自:<jsp页面使用el 按key获取map中的对应值>地址:http://blog.csdn.net/baple/article/de ...
- 获取url中的参数\+发送ajax请求根路径|+获取复选框的值
//获取url中的参数function getUrlParam(name) { var reg = new RegExp("(^|&)" + name + "=( ...
- JavaScript 在函数中使用Ajax获取的值作为函数的返回值
解决:JavaScript 在函数中使用Ajax获取的值作为函数的返回值,结果无法获取到返回值 原因:ajax默认使用异步方式,要将异步改为同步方式 案例:通过区域ID,获取该区域下所有的学校 var ...
- 安卓Android控件ListView获取item中EditText值
可以明确,现在没有直接方法可以获得ListView中每一行EditText的值. 解决方案:重写BaseAdapter,然后自行获取ListView中每行输入的EditText值. 大概算法:重写Ba ...
随机推荐
- AIM Tech Round (Div. 2) D. Array GCD dp
D. Array GCD 题目连接: http://codeforces.com/contest/624/problem/D Description You are given array ai of ...
- Codeforces Beta Round #13 E. Holes 分块暴力
E. Holes Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/13/problem/E Des ...
- [Node.js] Level 7. Persisting Data
Simple Redis Commands Let's start practicing using the redis key-value store from our node applicati ...
- 深入了解android平台的jni---图像灰度化处理
一.涉及到的jni编程知识 Java基本类型的数组,在JNI中都是jArray的类型格式.具体类型如下: typedef jarray jbooleanArray; typedef jarray jb ...
- UVA 1484 - Alice and Bob's Trip(树形DP)
题目链接:1484 - Alice and Bob's Trip 题意:BOB和ALICE这对狗男女在一颗树上走,BOB先走,BOB要尽量使得总路径权和大,ALICE要小,可是有个条件,就是路径权值总 ...
- Xcode常见的编译、运行等错误的解决
Xcode常见的编译.运行等错误的解决 项目没找到Info.plist的错误 The solution for this particular instance of the error was “I ...
- SIFT算法的应用--目标识别之Bag-of-words模型
原文:http://blog.csdn.net/v_JULY_v/article/details/6555899 SIFT算法的应用 -目标识别之用Bag-of-words模型表示一幅图像 作者:wa ...
- linux用户权限
Linux下passwd和shadow文件内容详解 一./etc/passwd/etc/passwd 文件是一个纯文本文件,每行采用了相同的格式: name:password:uid:gid:comm ...
- git fetch和git pull之间的区别--转载
原文地址:http://blog.csdn.net/a19881029/article/details/42245955 git fetch和git pull都可以用来更新本地库,它们之间有什么区别呢 ...
- QQ会员AMS平台PHP7升级实践
作者:徐汉彬链接:https://zhuanlan.zhihu.com/p/21493018来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明出处. QQ会员活动运营平台(AMS ...