Highlighted
Outstanding Contributor.
Outstanding Contributor.
1758 views

Change Image in a Button

Jump to solution

Hi,

I have a button with two functions.
When you open the window has a symbol (symbol1).

When I pressed want you to have another symbol (symbol2).

Is it possible to do that? What is education?

You can also function in a MenuItem?

Regards

Alberto Ferraz

0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Change Image in a Button

Jump to solution

I have attached a small demo that will dynamically toggle the image of a button each time it is clicked between on and off state. This demo uses a button control outside of a menu and inside a menu.

View solution in original post

0 Likes
5 Replies
Highlighted
Super Contributor.
Super Contributor.

RE: Change Image in a Button

Jump to solution

1° Adicione uma imageList ao seu formulário.

2° Adicione as imagens ao seu imageList.

3° Atribua à propriedade imageList ao objeto, no caso o button

4° Atribua à propriedade ImageKey ou ImageIndex a chave ou indice do seu image list

          set button::ImageIndex to 0 *> para mudar a imagem

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

RE: Change Image in a Button

Jump to solution

Boa tarde:

Obrigado pela sua resposta.

Esta funcionalidade funciona em WPF? É que não consegui encontrar a imageList na toolbox para poder adicionar.

Cumprimentos

Alberto Ferraz

0 Likes
Highlighted
Super Contributor.
Super Contributor.

RE: Change Image in a Button

Jump to solution

Não fiz teste com WPF. Preciso aprender a programar assim. Abraços

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Change Image in a Button

Jump to solution

I have attached a small demo that will dynamically toggle the image of a button each time it is clicked between on and off state. This demo uses a button control outside of a menu and inside a menu.

View solution in original post

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

RE: Change Image in a Button

Jump to solution

Hi Chris

I apologize for not having answered before but I have a problem using Visual Cobol that have delayed development.

I have tried your solution and it works well.

I will try to adapt it to menuitem to get better.

Thank you.

Alberto Ferraz

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.