CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2007
    Location
    Bangalore,India
    Posts
    164

    Smile Load image on tooBars toolbuttons.

    Dear Friends
    I am having trouble in placing images on the toolBar toolbuttons. The option is there to load a palette but there's no option for loading an image file onto the toolButtons. Please tell me if there's a ready made way to load an image icon on the toolbuttons. Thanks a lot in advance.

  2. #2
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,234

    Re: Load image on tooBars toolbuttons.

    Your question is far away to be clear.
    Are you using MFC, raw-WinAPI or something else?
    Where/in which function did you find "an option to load a palette but no option for loading an image file"?
    Please, clarify!
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  3. #3
    Join Date
    Sep 2007
    Location
    Bangalore,India
    Posts
    164

    Re: Load image on tooBars toolbuttons.

    I am using MFC. VC++...........I am loading a toolBar like this

    if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
    | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
    !m_wndToolBar.LoadToolBar(IDR_TOOLBAR1))
    {
    TRACE0("Failed to create toolbar\n");
    return -1; // fail to create
    }

    m_wndToolBar.LoadToolBar(IDR_TOOLBAR1);
    m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
    EnableDocking(CBRS_ALIGN_ANY);
    DockControlBar(&m_wndToolBar);

    Then using rosource option I am able to create variouis toolbuttons on the toolbar applying event-handling. But how can I put different pictures/images on the toolbuttons. I dont find interesting to use palette. Can we use ready made image files. like png, jpeg etc. Thanks sujan

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Load image on tooBars toolbuttons.

    Quote Originally Posted by sujan.dasmahapatra View Post
    I dont find interesting to use palette. Can we use ready made image files. like png, jpeg etc. Thanks sujan
    You could just open these image files in some editor and then copy/paste pictures to your toolbar button...
    Victor Nijegorodov

  5. #5
    Join Date
    Sep 2007
    Location
    Bangalore,India
    Posts
    164

    Re: Load image on tooBars toolbuttons.

    Its not possible just copy and paste. do u know MFC VC++ 2005.....This is not enabled.

  6. #6
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: Load image on tooBars toolbuttons.

    Open your toolbar resource in the resource editor of Visual Studio.
    Then you can edit each image for each button and then you can copy/paste images from other programs into a button.
    Or you can use a toolbar image editor, for example I'm using Axialis IconWorkshop and it's very easy to use.
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

Tags for this Thread

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

Featured