473,404 Members | 2,187 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Cannot get ToolboxBitmap to work

Hello,

I have developed a library of controls but for the life of me cannot get
ToolboxBitmapAttribute to work -- my image simply will not display in the
toolbox of any project using my controls.

First, what I have:

Visual Studio 2005, .NET 2.0. An assembly name of "Jfx.Framework" and a
default namespace of "Jfx". All the controls work fine when dropped into
other projects as a reference. The images just do not display in any
toolboxes, even those on my own machine.

In my VS project I have a class named JfxButton under a folder structure of
<Project root>/Jfx/Controls:

using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;

namespace Jfx.Controls
{
[ToolboxItem(true)]
[ToolboxBitmapAttribute(typeof(JfxButton))] // Other constructors don't
work either
public class JfxButton : System.Windows.Forms.Button
{
....
}
}

Inside this same folder, Jfx/Controls, I have an embedded resource named
JfxButton.bmp which is a 16x16 bitmap. JfxButton.cs and JfxButton.bmp are in
the same folder.

I know that the embedded resource is there because it appears in a call to
Assembly.GetManifestResourceNames() as "Jfx.Jfx.Controls.JfxButton.bmp".
After reading other posts on this topic and, although it doesn't make much
sense to me, I know why the double Jfx is at the beginning.

What I've tried:

All combinations of ToolboxBitmapAttribute constructors *including* just
fully-referencing the path on my hard drive. Cleaning the solution,
rebuilding the solution, re-installing VS2005, even screwing around with
project properties and making the default namespace and assembly name the
same failed to work for me. I tried building the project on another
development machine. I've messed around with a whole variety
ToolboxBitmapAttribute constructors including with and without the typeof,
with and without the string image name, combinations of paths, combinations
of paths and image names, etc.

I found many references to this excellent and promising article
http://www.bobpowell.net/toolboxbitmap.htm. Nevertheless, I couldn't get the
'resfinder' trick to work for me. I tried the gamut of approaches outlined
on that page as well but to no avail.

There are also several references to MSDN articles on this topic (and MSDN
itself) but that darn image simply won't display for me.

I assume I'm missing something somewhere...

Given my 'project structure' above, is there a way to get
ToolboxBitmapAttribute to work or am I going to have to like the gear icon?
If it can work, I sure could use some enlightment on how?

Thank you very much in advance for the time.

Mar 7 '06 #1
1 5910
"Jeff" wrote:
Hello,

I have developed a library of controls but for the life of me cannot get
ToolboxBitmapAttribute to work -- my image simply will not display in the
toolbox of any project using my controls.

First, what I have:

Visual Studio 2005, .NET 2.0. An assembly name of "Jfx.Framework" and a
default namespace of "Jfx". All the controls work fine when dropped into
other projects as a reference. The images just do not display in any
toolboxes, even those on my own machine.

In my VS project I have a class named JfxButton under a folder structure of
<Project root>/Jfx/Controls:

using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;

namespace Jfx.Controls
{
[ToolboxItem(true)]
[ToolboxBitmapAttribute(typeof(JfxButton))] // Other constructors don't
work either
public class JfxButton : System.Windows.Forms.Button
{
...
}
}

Inside this same folder, Jfx/Controls, I have an embedded resource named
JfxButton.bmp which is a 16x16 bitmap. JfxButton.cs and JfxButton.bmp are in
the same folder.

I know that the embedded resource is there because it appears in a call to
Assembly.GetManifestResourceNames() as "Jfx.Jfx.Controls.JfxButton.bmp".
After reading other posts on this topic and, although it doesn't make much
sense to me, I know why the double Jfx is at the beginning.

What I've tried:

All combinations of ToolboxBitmapAttribute constructors *including* just
fully-referencing the path on my hard drive. Cleaning the solution,
rebuilding the solution, re-installing VS2005, even screwing around with
project properties and making the default namespace and assembly name the
same failed to work for me. I tried building the project on another
development machine. I've messed around with a whole variety
ToolboxBitmapAttribute constructors including with and without the typeof,
with and without the string image name, combinations of paths, combinations
of paths and image names, etc.

I found many references to this excellent and promising article
http://www.bobpowell.net/toolboxbitmap.htm. Nevertheless, I couldn't get the
'resfinder' trick to work for me. I tried the gamut of approaches outlined
on that page as well but to no avail.

There are also several references to MSDN articles on this topic (and MSDN
itself) but that darn image simply won't display for me.

I assume I'm missing something somewhere...

Given my 'project structure' above, is there a way to get
ToolboxBitmapAttribute to work or am I going to have to like the gear icon?
If it can work, I sure could use some enlightment on how?

Thank you very much in advance for the time.


I am unsure this is useful information but I'm beginning to think I have a
messed up Visual Studio.NET 2005 installation or something is caches funny.
I tried just hardcoding the paths above as in

[ToolboxBitmapAttribute(@"C:\JfxButton.bmp")]

where C:\JfxButton.bmp is a 16 color 16 x 16 bitmap file and the default
gear icon still is the only one to display for this control. My bitmap icon
simply will not show in the toolbox.

Any suggestions?

Thank you for your time.

Mar 14 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: jean-dot-paul-at-opelwilly-dot-com | last post by:
Hello, Can I use the ToolboxBitmap from the inherted Control to show up in my toolbox and if so how? Greetings Jean Paul
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
10
by: Jean-David Beyer | last post by:
I have some programs running on Red Hat Linux 7.3 working with IBM DB2 V6.1 (with all the FixPacks) on my old machine. I have just installed IBM DB2 V8.1 on this (new) machine running Red Hat...
0
by: Adam Dockter | last post by:
I want my custom controls to have customer bitmaps but I can't get them to work if I try to pull the icon from a resource file. I know that I can add the icon to the project as an embedded...
1
by: Simon | last post by:
Hi How do I to change toolbox bitmap of my custom control using ToolboxBitmap in MC++ ? Thanks in advance
0
by: nicolas.hilaire | last post by:
Hi all, i'm creating an User Control (that is working). I would like to see my own image for this control, in the toolbox. Then, i'm using ToolboxBitmap namespace testUserControl { ...
10
by: MyndPhlyp | last post by:
(Second posting attempt) I have been through tons of old postings, several web sites, books, and even tried consulting a psychic but nothing is yielding the majik answer. I'm using VB '05...
0
by: John | last post by:
I've created a component in VS.NET 2003 and I'm having a hard time getting my bitmap to show up in the Designer Toolbox in Visual Studio. I have designed an .ico file and have included the...
2
by: Nathan Sokalski | last post by:
I am attempting to create icons for controls I have created using VB.NET by using the System.Drawing.ToolboxBitmap attribute. I have managed to do this in C# by specifying the path to the *.ico...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.