hi
i need to create menu with icons from xml file, icons from url

xml look like this

- <Item name="cat" ico="http://....../cat.bmp">
  </Item>
- <Item name="dog" ico="http://....../dog.bmp">
  </Item>
- <Item name="cow" ico="http://....../cow.bmp">
  </Item>

my c# code is

XmlDocument doc = new XmlDocument();
            doc.Load("katalogs.xml");


            foreach (XmlNode node in doc.DocumentElement.ChildNodes)
            {

                ToolStripMenuItem childMenu = new ToolStripMenuItem(node.Attributes["name"].Value, new Bitmap(cow.bmp")));
                tools.DropDownItems.Add(childMenu);
            }

if i set icon from file, all working fine
but have can i get icon from url?
Thanks a lot

Recommended Answers

All 3 Replies

I think ImageList helps

ok, with icons done, but now i have new problem
i add new atribute "targetUrl" in xml doc
how can i add click events dynamicly? if i click on menu item, opens targeturl in new browser window?

//Here you create new MenuItem
//Here you play with some MenuItem properties 
MenuItem.Click+=new System.EventHandler(this.AnyMenuItem_Click);
private void AnyMenuItem_Click(object sender, System.EventArgs e)
{
// your code to get the URL and open it
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.