Results 1 to 6 of 6

Thread: User control & toolbox icon?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    top of the mountain
    Posts
    234

    Question User control & toolbox icon?

    I provide toolbox icon for my control like this:
    <ToolboxBitmap("C:\nb.bmp")> _
    Public Class MyControl

    and that works fine, but when I want to use my control on another computer, I must have .bmp file at the same location like on my computer (in this case 'C:\nb.bmp'). My question is: how to compile my control in that way that it contain .bmp file? Is that possible?

    regard j

  2. #2
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    Re: User control & toolbox icon?

    Originally posted by janis
    I provide toolbox icon for my control like this:
    <ToolboxBitmap("C:\nb.bmp")> _
    Public Class MyControl

    and that works fine, but when I want to use my control on another computer, I must have .bmp file at the same location like on my computer (in this case 'C:\nb.bmp'). My question is: how to compile my control in that way that it contain .bmp file? Is that possible?

    regard j
    well you have to convert it to a resource file... gotto search the forum
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  3. #3
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536
    Are you using the standard .NET installation project to install your program?

    If so, you just need to get the installation project to add the .bmp to the executable's installation directory. Your code can then find it through something like this:

    VB Code:
    1. Dim strPath As String = _
    2.                     Path.GetDirectoryName(Application.ExecutablePath) & _
    3.                                                 Path.DirectorySeparatorChar
    This world is not my home. I'm just passing through.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    top of the mountain
    Posts
    234
    That's not a program, it's only one control which I want to use on some other computer for develop other applications.
    I think that MrPolite has right
    you have to convert it to a resource file
    only problem is I don't know how to do that?
    I somebody know the way please share with us.

    regard j

  5. #5
    Addicted Member PeteD's Avatar
    Join Date
    Jun 2003
    Location
    Sydney
    Posts
    158

  6. #6
    Fanatic Member pax's Avatar
    Join Date
    Mar 2001
    Location
    Denmark
    Posts
    840

    Lightbulb By far the easiest way...

    Hi Guy's.

    The easiest way to add a toolboxbitmap is this:

    If you have a control called TestControl, then just add a bitmap called
    TestControl.bmp to the project, and compile it as an embedded
    resource.
    That's all. No need for attributes or anything else.

    You won't see the change right away, but the
    next time you add the tool to the toolbox, the bitmap
    will be there.

    BTW: The lower left pixel determines the transparent color.
    (I think it the lower left....At least it's one of the corners!)
    I wish I could think of something witty to put in my sig...

    ...Currently using VS2013...

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