Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. ToolboxBitmap isn't working... The on going saga

ToolboxBitmap isn't working... The on going saga

Scheduled Pinned Locked Moved C#
5 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    garaber
    wrote on last edited by
    #1

    I have created two UserControls to try and resolve this.

    namespace libSigCntrl
    {
    //[ToolboxItem(true)]
    //[ToolboxBitmap(typeof(ctrlBankBitSW), "ctrlBankBitSW.bmp")]
    [ToolboxBitmap(typeof(ctrlBankBitSW))]
    public partial class ctrlBankBitSW : UserControl
    {
    public ctrlBankBitSW()
    {
    InitializeComponent();
    }
    }
    }
    namespace libSigCntrl
    {
    //[ToolboxItem(true)]
    //[ToolboxBitmap(typeof(ctrlBitSW), "ctrlBitSW")]
    [ToolboxBitmap(typeof(ctrlBitSW))]
    public partial class ctrlBitSW : UserControl
    {
    public ctrlBitSW()
    {
    InitializeComponent();
    }
    }
    }

    The commented lines represent other attempts. There are bitmaps for each of the controls added to the project libSigCtrl - - - ctrlBankBitSW.bmp - ctrlBankBitSW.cs . . - ctrlBitSW.bmp - ctrlBitSW.cs The Bitmaps have there "Build Actions" = been set to "Embeded Resource" The Bitmaps are 16x16 at 16 color. The Output Type is "Class Library". This is driving me nuts. :wtf:

    H 1 Reply Last reply
    0
    • G garaber

      I have created two UserControls to try and resolve this.

      namespace libSigCntrl
      {
      //[ToolboxItem(true)]
      //[ToolboxBitmap(typeof(ctrlBankBitSW), "ctrlBankBitSW.bmp")]
      [ToolboxBitmap(typeof(ctrlBankBitSW))]
      public partial class ctrlBankBitSW : UserControl
      {
      public ctrlBankBitSW()
      {
      InitializeComponent();
      }
      }
      }
      namespace libSigCntrl
      {
      //[ToolboxItem(true)]
      //[ToolboxBitmap(typeof(ctrlBitSW), "ctrlBitSW")]
      [ToolboxBitmap(typeof(ctrlBitSW))]
      public partial class ctrlBitSW : UserControl
      {
      public ctrlBitSW()
      {
      InitializeComponent();
      }
      }
      }

      The commented lines represent other attempts. There are bitmaps for each of the controls added to the project libSigCtrl - - - ctrlBankBitSW.bmp - ctrlBankBitSW.cs . . - ctrlBitSW.bmp - ctrlBitSW.cs The Bitmaps have there "Build Actions" = been set to "Embeded Resource" The Bitmaps are 16x16 at 16 color. The Output Type is "Class Library". This is driving me nuts. :wtf:

      H Offline
      H Offline
      Henry Minute
      wrote on last edited by
      #2

      There are two scenarios, and it would be useful to know which applies, in order to try to help. Scenario 1. You are looking to add one of your controls to a designer in the same solution as the controls, but you have not yet explicitly added your controls to the toolbox. Scenario 2. You have explicitly added your controls to the toolbox, and they do not display the assigned image. Please say which.

      Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

      G 2 Replies Last reply
      0
      • H Henry Minute

        There are two scenarios, and it would be useful to know which applies, in order to try to help. Scenario 1. You are looking to add one of your controls to a designer in the same solution as the controls, but you have not yet explicitly added your controls to the toolbox. Scenario 2. You have explicitly added your controls to the toolbox, and they do not display the assigned image. Please say which.

        Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

        G Offline
        G Offline
        garaber
        wrote on last edited by
        #3

        I don't think either. I have created a project with to two controls in the project. The project is a class library that will hold a variety of "Controls" extending UserControl... Maybe it is Scenario 1. The user controls do show up in on my solution palette but with the default cog image. Does that help Henry. If now and I will try again to clarify. Gregg

        H 1 Reply Last reply
        0
        • H Henry Minute

          There are two scenarios, and it would be useful to know which applies, in order to try to help. Scenario 1. You are looking to add one of your controls to a designer in the same solution as the controls, but you have not yet explicitly added your controls to the toolbox. Scenario 2. You have explicitly added your controls to the toolbox, and they do not display the assigned image. Please say which.

          Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

          G Offline
          G Offline
          garaber
          wrote on last edited by
          #4

          If you can check out www.experts-exchange.com/Programming/Languages/C_Sharp/Q_24283292.html

          1 Reply Last reply
          0
          • G garaber

            I don't think either. I have created a project with to two controls in the project. The project is a class library that will hold a variety of "Controls" extending UserControl... Maybe it is Scenario 1. The user controls do show up in on my solution palette but with the default cog image. Does that help Henry. If now and I will try again to clarify. Gregg

            H Offline
            H Offline
            Henry Minute
            wrote on last edited by
            #5

            I thought that this might be the case. What you are getting is the correct behaviour. Whilst the Library containing your controls is included in a solution, the system does not use the assigned icon. It always uses the Cog icon. To find out if your icon assignments are working you have to manually install your controls into the Toolbox. For the easy way to do that take a look at this[^]. The 'standard' way to do it is to right click on the toolbox, in the section where you want your controls added, select 'add items' or 'choose items' depending on version of VS. When the dialogue appears click the browse button, navigate to and select your dll and then click OK. Before doing either of the above, you might also want to right click the toolbox and select 'Add Tab'. You can then call it 'My Controls' or whatever you like, to keep your stuff separate. If you do this, when you right-click to add the controls, make sure to right-click in your new tab, so that the controls are added there. Hope this helps.

            Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups