ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 IEColorPalette walk through colours and test for match

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
andyhill Posted - Feb 23 2023 : 15:54:54
I have a ColorPalette with 500 assigned colors.

I want to iterate the colors and test for a match, if found I want to set SelectedIndex accordingly.

I tried rows and cols but same problem.

for i:= 0 to ColorPalette1.ColorCount-1 do begin
  if ColorPalette1.Color[i] = MyColor then begin
    ColorPalette1.SelectedIndex:= i;
    Break;
  end;
end;


Andy
1   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Feb 23 2023 : 21:11:39
Hi Andy

You can just use:

ColorPalette1.SelectedColor := MyColor;

Of course if the color is not in your list of 500 colors nothing will be selected.

In the coming update you can use:

ColorPalette1.SelectNearestColor( clBlue );

Nigel
Xequte Software
www.imageen.com