Home All Groups Group Topic Archive Search About
Author
28 Jun 2006 11:07 PM
OpticTygre
I have a control I built, for which I would like to add a tool bar icon, but
for some reason, it's not working correctly.

There is no default namespace (I removed it from the properies page of the
project), and the icon file has been included in the project and it's build
option is set to "Embedded Resource."

The only thing I can think of that could be messing it up (but I'm not sure)
is that the class file and the icon file are in subfolders in the project
itself.  Other than that, when I compile, and add the DLL to the Toolbox, it
comes up with the standard gear control icon instead of the icon I chose.

Any ideas?

Code is this:

Namespace OS.WinForms.Controls

<ToolboxBitmap(GetType(OS.WinForms.Controls.ProgressBar),
"ProgressBar.ico")> _
Public Class ProgressBar
    Inherits System.Windows.Forms.Control

    ...yadda yadda yadda...

End Class

End Namespace

Thanks for any help.
-Jason

Author
29 Jun 2006 12:21 AM
Ahmed
Try removing the .ico from the icon name.

OpticTygre wrote:
Show quoteHide quote
> I have a control I built, for which I would like to add a tool bar icon, but
> for some reason, it's not working correctly.
>
> There is no default namespace (I removed it from the properies page of the
> project), and the icon file has been included in the project and it's build
> option is set to "Embedded Resource."
>
> The only thing I can think of that could be messing it up (but I'm not sure)
> is that the class file and the icon file are in subfolders in the project
> itself.  Other than that, when I compile, and add the DLL to the Toolbox, it
> comes up with the standard gear control icon instead of the icon I chose.
>
> Any ideas?
>
> Code is this:
>
> Namespace OS.WinForms.Controls
>
> <ToolboxBitmap(GetType(OS.WinForms.Controls.ProgressBar),
> "ProgressBar.ico")> _
> Public Class ProgressBar
>     Inherits System.Windows.Forms.Control
>
>     ...yadda yadda yadda...
>
> End Class
>
> End Namespace
>
> Thanks for any help.
> -Jason
Author
29 Jun 2006 10:05 PM
OpticTygre
Removing the .ico from the name doesn't work.  I've also tried adding it
directly as a resource in the project properties pages, which doesn't work
either.  Perhaps there's an issue with the icon itself?

-Jason

Show quoteHide quote
"Ahmed" <ahmed1***@gmail.com> wrote in message
news:1151540464.222388.188190@d56g2000cwd.googlegroups.com...
> Try removing the .ico from the icon name.
>
> OpticTygre wrote:
>> I have a control I built, for which I would like to add a tool bar icon,
>> but
>> for some reason, it's not working correctly.
>>
>> There is no default namespace (I removed it from the properies page of
>> the
>> project), and the icon file has been included in the project and it's
>> build
>> option is set to "Embedded Resource."
>>
>> The only thing I can think of that could be messing it up (but I'm not
>> sure)
>> is that the class file and the icon file are in subfolders in the project
>> itself.  Other than that, when I compile, and add the DLL to the Toolbox,
>> it
>> comes up with the standard gear control icon instead of the icon I chose.
>>
>> Any ideas?
>>
>> Code is this:
>>
>> Namespace OS.WinForms.Controls
>>
>> <ToolboxBitmap(GetType(OS.WinForms.Controls.ProgressBar),
>> "ProgressBar.ico")> _
>> Public Class ProgressBar
>>     Inherits System.Windows.Forms.Control
>>
>>     ...yadda yadda yadda...
>>
>> End Class
>>
>> End Namespace
>>
>> Thanks for any help.
>> -Jason
>
Author
29 Jun 2006 11:01 PM
Ahmed
Maybe because it's an icon. Try a bitmap.

OpticTygre wrote:
Show quoteHide quote
> Removing the .ico from the name doesn't work.  I've also tried adding it
> directly as a resource in the project properties pages, which doesn't work
> either.  Perhaps there's an issue with the icon itself?
>
> -Jason
>
> "Ahmed" <ahmed1***@gmail.com> wrote in message
> news:1151540464.222388.188190@d56g2000cwd.googlegroups.com...
> > Try removing the .ico from the icon name.
> >
> > OpticTygre wrote:
> >> I have a control I built, for which I would like to add a tool bar icon,
> >> but
> >> for some reason, it's not working correctly.
> >>
> >> There is no default namespace (I removed it from the properies page of
> >> the
> >> project), and the icon file has been included in the project and it's
> >> build
> >> option is set to "Embedded Resource."
> >>
> >> The only thing I can think of that could be messing it up (but I'm not
> >> sure)
> >> is that the class file and the icon file are in subfolders in the project
> >> itself.  Other than that, when I compile, and add the DLL to the Toolbox,
> >> it
> >> comes up with the standard gear control icon instead of the icon I chose.
> >>
> >> Any ideas?
> >>
> >> Code is this:
> >>
> >> Namespace OS.WinForms.Controls
> >>
> >> <ToolboxBitmap(GetType(OS.WinForms.Controls.ProgressBar),
> >> "ProgressBar.ico")> _
> >> Public Class ProgressBar
> >>     Inherits System.Windows.Forms.Control
> >>
> >>     ...yadda yadda yadda...
> >>
> >> End Class
> >>
> >> End Namespace
> >>
> >> Thanks for any help.
> >> -Jason
> >
Author
30 Jun 2006 12:58 AM
OpticTygre
Finally figured it out.

For all those who are interested, the icon file MUST have a filename with a
prefix of the Namespace where the class is located at.

For example, the full path to my class is
"OS.WinForms.Controls.ProgressBar", so the filename of the Icon had to be
"OS.WinForms.Controls.ProgressBar.ico"

Once I renamed the file, I could reference the icon correctly using:

Namespace OS.WinForms.Controls

<ToolboxBitmap(GetType(ProgressBar), "ProgressBar")> _
Public Class ProgressBar
    Inherits System.Windows.Forms.Control

    .........

End Class

End Namespace

Basically, the icon file has to have a filename of the full path of the
class + ".ico"

-Jason

Show quoteHide quote
"Ahmed" <ahmed1***@gmail.com> wrote in message
news:1151622084.487581.141110@m73g2000cwd.googlegroups.com...
> Maybe because it's an icon. Try a bitmap.
>
> OpticTygre wrote:
>> Removing the .ico from the name doesn't work.  I've also tried adding it
>> directly as a resource in the project properties pages, which doesn't
>> work
>> either.  Perhaps there's an issue with the icon itself?
>>
>> -Jason
>>
>> "Ahmed" <ahmed1***@gmail.com> wrote in message
>> news:1151540464.222388.188190@d56g2000cwd.googlegroups.com...
>> > Try removing the .ico from the icon name.
>> >
>> > OpticTygre wrote:
>> >> I have a control I built, for which I would like to add a tool bar
>> >> icon,
>> >> but
>> >> for some reason, it's not working correctly.
>> >>
>> >> There is no default namespace (I removed it from the properies page of
>> >> the
>> >> project), and the icon file has been included in the project and it's
>> >> build
>> >> option is set to "Embedded Resource."
>> >>
>> >> The only thing I can think of that could be messing it up (but I'm not
>> >> sure)
>> >> is that the class file and the icon file are in subfolders in the
>> >> project
>> >> itself.  Other than that, when I compile, and add the DLL to the
>> >> Toolbox,
>> >> it
>> >> comes up with the standard gear control icon instead of the icon I
>> >> chose.
>> >>
>> >> Any ideas?
>> >>
>> >> Code is this:
>> >>
>> >> Namespace OS.WinForms.Controls
>> >>
>> >> <ToolboxBitmap(GetType(OS.WinForms.Controls.ProgressBar),
>> >> "ProgressBar.ico")> _
>> >> Public Class ProgressBar
>> >>     Inherits System.Windows.Forms.Control
>> >>
>> >>     ...yadda yadda yadda...
>> >>
>> >> End Class
>> >>
>> >> End Namespace
>> >>
>> >> Thanks for any help.
>> >> -Jason
>> >
>