[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 295
  • Last Modified:

Form Icons

How do you use an image from and ImageList as a forms icon ?
0
blue220
Asked:
blue220
  • 3
  • 2
1 Solution
 
shaneholmesCommented:
var
 Icon: TIcon;

  Icon := TIcon.Create;
  ImgList.GetIcon(0, Icon);
  Application.Icon.Assign(Icon);
  Icon.Free;


Shane
0
 
blue220Author Commented:
Thx for the reply and in most cases that would do the trick but in this case it wont and here is why.

I have 2 forms in my program (Main & Sub) and on the Main form I have an ImageList and 2 buttons and what I need to do is when I click on one of the buttons an icon from the ImageList is assigened to the Icon of the Sub form.

Example (pseudo code)

Main Form
------------------
ImageList (with image of happy face and sad face)
2 Buttons

Button1.Click (assign happy face Icon to Sub Form)
SubForm.ShowModal;

Button2.Click (assign sad face Icon to Sub Form)
SubForm.ShowModal

Hope that helps explain things better and thx again for any and all replies.
0
 
blue220Author Commented:
Nvm I modified your code abit and it's working thx
0
 
shaneholmesCommented:
Well, you never said anything about a second form in your question,

please be specific on exactly what you want when asking questions, so experts do not have to recode.....

Sahne
0
 
shaneholmesCommented:
OK, i was doing a solution up to modify the icon of the second form

Anyway, thanks and good luck!

Shane
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now