Results 1 to 4 of 4

Thread: Visual C# 2005 Express - ToolboxBitmap

  1. #1

    Thread Starter
    Lively Member StoneTheCrows's Avatar
    Join Date
    Dec 2004
    Location
    UK
    Posts
    71

    Question Visual C# 2005 Express - ToolboxBitmap

    I am woking on a Control Library that I call CcNet2005. Some of the controls are based on exisiting windows forms controls whilst others are based on 'UserControl' or 'Component'. I have included a 16 x 16 Bitmap for each control as an Embedded Resource in the Library and each bitmap is named the same as its target Control.
    I cannot seem to get a working ToolboxBitmap for any of the controls in the library, I just get the default Gear bitmap.

    Is this a restriction because it is an Express Version?
    Am I missing something fundamental?
    Could there be something else that I need to do beyond using the correct constructor?

    Here is a sample of the ways I have tried to get the ToolboxBitmap to work.
    Code:
    // None of these constructor versions seem to work
    
    namespace CcNet2005
    {
        [ToolboxBitmap(@"..\Resources\C_DataView.bmp"), Description("CcNet2005 Data View/Edit Control")]
        public partial class C_DataView : UserControl
        {
           #region "The Code"
               Some Really Clever stuff .......... 
           #endregion 
        }
    
    }
    
    namespace CcNet2005
    {
    [ToolboxBitmap(typeof(C_DataView)), Description("CcNet2005 Data View/Edit Control")]
        public partial class C_DataView : UserControl
        {
           #region "The Code"
               Some Really Clever stuff .......... 
           #endregion 
        }
    
    }
    
    namespace CcNet2005
    {
    [ToolboxBitmap(typeof(C_DataView), "C_DataView"), Description("CcNet2005 Data View/Edit Control")]
        public partial class C_DataView : UserControl
        {
           #region "The Code"
               Some Really Clever stuff .......... 
           #endregion 
        }
    
    }

    FYI:
    Using Visual C# 2005 Express Edition to create the Control Library.
    Have tested the control libary and all controls work as expected other than the problem as described.
    Have tried the Control Library in a Windows Application using both Visual C# 2005 Express and Visual Basic 2005 Express Edition. Same Results in both cases.
    StoneTheCrows

    _______________

    The future will be better tomorrow. (George W. Bush)

    (If you think my post was useful, please Rate it. Thanks)

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Visual C# 2005 Express - ToolboxBitmap

    I believe that your third effort is on the right track but according to the help topic for that constructor you need to precede the resource name with the namespace and also include the extension. I would guess that that would mean it should be:
    Code:
    ToolboxBitmap(typeof(C_DataView), "CcNet2005.C_DataView.bmp")
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Lively Member StoneTheCrows's Avatar
    Join Date
    Dec 2004
    Location
    UK
    Posts
    71

    Re: Visual C# 2005 Express - ToolboxBitmap

    Quote Originally Posted by jmcilhinney
    I believe that your third effort is on the right track but according to the help topic for that constructor you need to precede the resource name with the namespace and also include the extension. I would guess that that would mean it should be:
    Code:
    ToolboxBitmap(typeof(C_DataView), "CcNet2005.C_DataView.bmp")
    Thanks for the suggestion. Having tried it, no luck unfortunately.

    It seems odd that this would be such a difficult thing to resolve. I can't believe that no-one bothers with creating ToolboxBitmaps for their control librarys and yet there seems to be a real issue over getting this one to work. It didn't work during the Beta phases of the Visual Studio product and I just (stupidly) thought that it was going to be resolved in the release version.

    When you think back to VB6 and how simple it was then (Select an image from the Properties window) you would have thought that MS would have got this right fairly quickly. That is of course if I am not just being thick and missing some fundamental part of the process!
    StoneTheCrows

    _______________

    The future will be better tomorrow. (George W. Bush)

    (If you think my post was useful, please Rate it. Thanks)

  4. #4

    Thread Starter
    Lively Member StoneTheCrows's Avatar
    Join Date
    Dec 2004
    Location
    UK
    Posts
    71

    Re: Visual C# 2005 Express - ToolboxBitmap

    I'm 'Bumping' this because the problem is really starting to bug me and I am hoping someone in the know will take pity on me.

    Surely this can't be such a big secret.
    StoneTheCrows

    _______________

    The future will be better tomorrow. (George W. Bush)

    (If you think my post was useful, please Rate it. Thanks)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width