Board index » delphi » Changing panel color based on graphic adapter??

Changing panel color based on graphic adapter??

I have an application where the main screen panel color looks great
with 256 color graphic adapters and lousy with 16 color adapters. Is
there a function that can recognize the number of available colors so
that the panel color can be reset as necessary?

Mark Shapiro
info...@swbell.net

 

Re:Changing panel color based on graphic adapter??


Quote
info...@swbell.net (Mark Shapiro) wrote:
>I have an application where the main screen panel color looks great
>with 256 color graphic adapters and lousy with 16 color adapters. Is
>there a function that can recognize the number of available colors so
>that the panel color can be reset as necessary?

>Mark Shapiro
>info...@swbell.net

Mark,

Use the GetDeviceCaps API function call as follows:

var
     ScrRes:   Integer;
begin
     ScrRes := GetDeviceCaps(Canvas.Handle, BITSPIXEL);
     {returns the number of adjacent color bits for each pixel}
     if ScrRes < 8 then (set a color that looks good in 16 colors)
     else (set a color that looks good in 256 colors or above);
end;

HTH,

--
Michael Purcell
purc...@atlanta.com

Other Threads