How to get rid of dialog icon?

  • Thread starter Gregory Khrapunovich
  • Start date
G

Gregory Khrapunovich

Hi,
I am developing Windows Forms/C# application under VS 2003. Some dialogs
have wrong icons. I can easily replace the icon to another one using
dialog's "Icon" property, but what I really want is to remove the icon from
the dialog altogether. I tried to delete the Icon property value. It worked
on some dialogs and didn't work on the others, i.e. some dialogs appear
without an icon (that's what I want) and others appear with default Visual
Studio icon. If it happens I cannot remove the icon no matter what I try.

Is it a Visual Studio 2003 bug or I am doing something wrong?

Gregory
 
G

Gregory Khrapunovich

Sorry for not mentioning it, but I also use FixedDialog (also no
Minimize/Maximize boxes). So I am afraid your advice doesn't resolve it.
Gregory
 
M

Mike Hofer

Gregory said:
Hi,
I am developing Windows Forms/C# application under VS 2003. Some dialogs
have wrong icons. I can easily replace the icon to another one using
dialog's "Icon" property, but what I really want is to remove the icon from
the dialog altogether. I tried to delete the Icon property value. It worked
on some dialogs and didn't work on the others, i.e. some dialogs appear
without an icon (that's what I want) and others appear with default Visual
Studio icon. If it happens I cannot remove the icon no matter what I try.

Is it a Visual Studio 2003 bug or I am doing something wrong?

Gregory

It sounds like your dialog may have the wrong border style. The display
of the icon is closely linked with what the FormBorderStyle property is
set to on the form.

I always use FixedDialog, and icons don't show up on my forms at all.

(Note that in 2003 I used to get some wonkiness where the icon would
show up in the designer, but not when the application was running.)

Hope this helps!
 
H

Herfried K. Wagner [MVP]

Gregory Khrapunovich said:
Sorry for not mentioning it, but I also use FixedDialog (also no
Minimize/Maximize boxes). So I am afraid your advice doesn't resolve it.


Set 'Icon' to 'null'/'Nothing' in the constructor at runtime after the call
to 'InitializeComponent'.
 
G

Gregory Khrapunovich

Set 'Icon' to 'null'/'Nothing' in the constructor at runtime after the
call to 'InitializeComponent'.

I don't like this because in future somebody may try to set the icon from
Visual Studio and won't understand why it won't show up (it will be
overwritten at runtime)

Coincidentally I found what was wrong. The property "ShowOnTaskbar" should
be false, then default icon disappears.
Gregory
 
M

Mike Hofer

Gregory said:
I don't like this because in future somebody may try to set the icon from
Visual Studio and won't understand why it won't show up (it will be
overwritten at runtime)

Coincidentally I found what was wrong. The property "ShowOnTaskbar" should
be false, then default icon disappears.
Gregory

Excellent! And thanks for posting the solution!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top