Jump to content

Icon na aplicação


memyself

Recommended Posts

boas pessoal...

fiz uma pesquisa e nao encontrei o que procuro

é o seguinte:

como faco para colocar um icone na minha aplicacao ??

(usando codigo no load da form)

tentei com este codigo mas nao me deu resultado:

Me.Icon = Image.FromFile("C:\Users\maps\Documents\My Projects\My Library\Movie Library\bin\Debug\icons\file 1.jpg") 

ao usar isso, da-me este erro:

Error	1	Value of type 'System.Drawing.Image' cannot be converted to 'System.Drawing.Icon'

aguardo uma resposta de alguem

sei que neste forum ha sempre alguem que consegue ajudar

cumpz

Link to comment
Share on other sites

Nem te deste sequer ao trabalho de ler a mensagem de erro. Estás a carregar uma imagem em JPG em vez de ICO.

Podes tb definir o icon directamente nas propriedades do formulário, nao necessitas de fazer por código.

aí é que te enganas...

eu percebo bastante bem ingles...

o meu problema é que eu estou a usar uma imagem ICO (é um icone)...

dai a minha duvida quanto a este erro

nao percebo porque

obrigado na mesma pela tentativa

cumpz

Link to comment
Share on other sites

Image.FromFile <--- Obtens um objecto do tipo System.Drawing.Image

Me.Icon <--- Recebe um objecto do tipo System.Drawing.Icon

Estás a ver o problema? É exactamente essa a mensagem de erro.

O que queres é

Me.Icon = new Icon("C:\Users\maps\Documents\My Projects\My Library\Movie Library\bin\Debug\icons\file 1.jpg")

"Give a man a fish and he will eat for a day; Teach a man to fish and he will eat for a lifetime. The moral? READ THE MANUAL !"

Sign on a computer system consultant's desk

Link to comment
Share on other sites

brigadao Betovsky

era isso mesmo que tava a precisar...

agora outra coisa

ainda nao experimentei mas ja vou tentar...

posso usar o mesmo metodo para introduzir os icones/imagens nos menus e toolbars ??

é que eu preciso de saber isso, porque a minha aplicacao vai usar uma janela mas mudar os comandos consoante o que se esta a fazer...

agradeco desde ja

cumpz

Link to comment
Share on other sites

É isto que queres?

Fonte: ms-help://MS.VSExpressCC.v80/MS.NETFramework.v20.en/dv_fxmclictl/html/aa5f19bb-b545-4378-bfa6-36ba592f0d7c.htm

"To add an image to a menu command:

Set the menu command's Image property to the name of the image. If the ToolStripItemDisplayStyle property of this menu command is set to Text or None, the image cannot be displayed.

Note: 

The image margin can also show a check mark if you so choose. Also, you can set the Checked property of the image to true, and the image will appear with a hatched border around it at run time."

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.