获取屏幕中某个点的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 ...
随机推荐
- 跨浏览器实现盒阴影(box-shadow)效果
现在流行的设计里总是使用了大量的阴影,看看Vista.win7里夸张的box阴影,mac里的阴影比比皆是.CSS3的box-shadow属性可以让我们轻松实现图层阴影效果,使我们可以不再总是依赖于使用 ...
- 解决ArcGIS Android Could not find class 'com.esri.android.map.MapView'问题
环境win7 64bit sp1,eclipse 4.2.1 ,android API 16,ADT 23.0.2,arcgis android sdk 10.2.4 从arcgis-android- ...
- Codeforces Round #313 (Div. 1) A. Gerald's Hexagon 数学题
A. Gerald's Hexagon Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/559/p ...
- Nazo解密游戏攻略
啊,终于腾出时间来玩这个游戏了,顺手写一下攻略吧…… 第0关:http://cafebabe.cc/nazo/ 第一关:第一关很简单 点一下就好了 http://cafebabe.cc/nazo/le ...
- 《计算机问题求解》总结——2014年CCF计算机课程改革导教班(2014.07.11)
一:引言 "心想事成".这是自己获得导教班学习机会的最佳概括.2013年年末学习李晓明老师的<人群与网络>课程:随后网络认识烟台大学贺利坚老师,了解到2013年 ...
- [Angular2 Router] Build Angular 2 Navigation with routerLink
Angular 2 navigation is configured using the routerLink directive. The routerLink directive behaves ...
- 【PHP代码审计】 那些年我们一起挖掘SQL注入 - 2.全局防护Bypass之UrlDecode
0x01 背景 现在的WEB程序基本都有对SQL注入的全局过滤,像PHP开启了GPC或者在全局文件common.php上使用addslashes()函数对接收的参数进行过滤,尤其是单引号.遇到这种情况 ...
- MeepoPS——轻量级 Socket 服务
MeepoPS是Meepo PHP Socket的缩写.旨在提供高效稳定的由纯PHP开发的多进程SocketService. MeepoPS可以轻松构建在线实时聊天,即时游戏,视频流媒体播放,RPC, ...
- google gflags使用.
code.google.com 被墙的好开心... gflags很简单. 编译使用都很简单. (不像omaha这种丧心病狂的编译依赖). cmake 生成一下. 一路顺风顺水. 值得注意的是: 默认 ...
- vba用http发送xml所需技术
1.代理(invoke) CallByName 函数 •执行一个对象的方法,或者设置或返回一个对象的属性. •语法 •CallByName(object, procname, calltype,[ar ...

public static Color GetColor()