Trouble With Menu Image
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Trouble With Menu Image

  1. #1
    Join Date
    Dec 2013
    Posts
    6

    Trouble With Menu Image

    Hey,

    I spent the day learning how to get an icon to show on my window, lol. Quite a task, but now I'm having trouble getting images to show on menu items.

    I've added the png image to a resource file called Icons.resx The file now contains an icon file and the png I'm trying to show called NewFile.png. I also have the png I'm trying to show in my Resource folder. The icons there two. The reason I mention both is because the xmal method I used to show the icon doesn't seem to have anything to do with the resource file... Not sure if I'm doing this right, so thought maybe someone could mention something on that lol.

    The weird thing is the image shows up in the preview window...but when I run the app with the play button and drop down my file menu there's no image..

    Just wondering if someone could explain this to me.

    Anyway back to the png that I'm trying to show on the menu. Here's the Xmal code.

    Code:
     <MenuItem Header="_File">
                        <MenuItem Header="_New File">
                            <MenuItem.Icon>
                                <Image Source="Pack://application,,,Water SV1;component/Resources/NewFile.png"></Image>
                            </MenuItem.Icon>
                        </MenuItem>
    Thanks in advanced.

  2. #2
    Join Date
    Dec 2013
    Posts
    6

    Re: Trouble With Menu Image

    lol, at the way I wrote that, sorry. I jumped back in forth in paragraphs and didn't get it edited good.

  3. #3
    Join Date
    Dec 2013
    Posts
    6

    Re: Trouble With Menu Image

    I found the solution to this for anyone that's interested. I had to select the tag of the menu item and in the right hand site in the properties options I had to set the source. It reverted my code back to the simple way of setting the source "Source="Resources/image.png" which I had tried in the first place, but for some reason going through the properties method made it work... must have been a bug or hitch of somekind in VS, not sure.

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center