怎么可以得到屏幕的颜色数?24位色,16位色或256色?

解决方案 »

  1.   

    1 screen
    2 GetSystemMatrix
      

  2.   

    procedure TForm1.Button1Click(Sender: TObject);
    begin
      case GetDeviceCaps(GetDC(GetDesktopWindow), BITSPIXEL) of
        8:  ShowMessage('256色');
        16: ShowMessage('16位增强色');
        32: ShowMessage('32位真彩色');
      end;
    end;
    The GetDeviceCaps function retrieves device-specific information about a specified device.
    The GetDC function retrieves a handle of a display device context (DC) for the client area of the specified window. The display device context can be used in subsequent GDI functions to draw in the client area of the window.
    The GetDesktopWindow function returns the handle of the Windows desktop window. The desktop window covers the entire screen. The desktop window is the area on top of which all icons and other windows are painted.