Obtains the RGB value of a certain point on the screen and the pixel value of the CAD screen.

Source: Internet
Author: User

'Get the ratio of pixels on the CAD Screen

") 'Screen width and height of the current viewport Dim H As Variant H = ThisDrawing. getVariable ("") 'viewscreen = Abs (H/ScreenSize (1) End FunctionPublic Declare Function GetCursorPos Lib "(lpPoint As POINTAPI) As Long

Obtains the RGB value of a certain point on the screen.

  Color GetColor()         {             POINT _Point =  POINT();             GetCursorPos( _Point);             IntPtr _Hwnd = WindowFromPoint(()_Point.x, ()_Point.y);             IntPtr _DC = GetDC(_Hwnd);             ScreenToClient(_Hwnd,  _Point);              _ColorLong = GetPixel(_DC, _Point.x, _Point.y);                Color _Color = Color.FromArgb(()_ColorLong & 0xFF, ()(_ColorLong & 0xFF00) / 256, ()(_ColorLong & 0xFF0000) / 65536);             ReleaseDC(_Hwnd, _DC);              _Color;         }         [StructLayout(LayoutKind.Sequential)]           POINT         {               x;               y;         }         [DllImport("", CharSet = CharSet.Auto)]             ReleaseDC(IntPtr hWnd, IntPtr hDC);         [DllImport("")]             GetPixel(IntPtr hDC,  XPos,  YPos);         [DllImport("")]             ScreenToClient(IntPtr hwnd,  POINT p_Point);         [DllImport("")]             GetCursorPos( POINT p_Point);         [DllImport("")]            IntPtr WindowFromPoint( x_point,  y_point);         [DllImport("", CharSet = CharSet.Auto)]            IntPtr GetDC(IntPtr hWnd); 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.