'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);