CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2002
    Location
    Australia
    Posts
    207

    [RESOLVED] get image from Properties.Resources

    Hi,

    I currently using the below code to assign image from Resources to menu.

    rm = new RibbonMenu();
    rm.Text="Search";
    rm.LargeImage = Properties.Resources.search;

    can i replace "Properties.Resources.search" with a variable? something like this:

    string imgName="search";
    rm = new RibbonMenu();
    rm.Text="Search";
    rm.LargeImage = imgName;

    Please help.

    Thanks

  2. #2
    Join Date
    Apr 2008
    Location
    Cleveland, OH USA
    Posts
    20

    Re: get image from Properties.Resources

    Hi Yolip,
    How about this?
    Code:
    string imgName = "Search"; 
    Bitmap bmp = (Bitmap)Properties.Resources.ResourceManager.GetObject(imgName); 
    
    rm = new RibbonMenu();
    rm.Text="Search";
    rm.LargeImage = bmp;
    Last edited by mckee.kyle; April 3rd, 2008 at 08:51 PM.

  3. #3
    Join Date
    Oct 2002
    Location
    Australia
    Posts
    207

    Re: get image from Properties.Resources

    Thank you! you are my legend

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