Image editor for C # toolbar

I have an application with a toolbar and a collection of images. The problem is I don't have the original images and need to create another toolbar with some of the same buttons. Is there a way to save a collection of images from a toolbar to a file?

I tried to extract images from a resource file, but I don't know which one the images are stored in.

+3


source to share


2 answers


Although I couldn't find an answer to my question, I was able to get the images by reading the list of images in the toolbar and saving each file according to the given image.

for (int x = 0; x < this.imageListToolbar3small.Images.Count; ++x)
        {
            Image temp = this.imageListToolbar.Images[x];
            temp.Save(this.imageListToolbar.Images.Keys[x] + ".png");
        }

      

This is the answer to this question: How to export images from a list of images in VS2005?



I just added some code after calling InitializeComponent and saved all images in debug mode. I didn't need to run the complete application.

If anyone has a better idea or small application to extract images from a toolbox using just a resource file, that would be appreciated. I will not mark as an answer as this is a more workaround.

+3


source


I use this approach:



foreach (ToolBarButton b in toolBar.Buttons)
{
  //can be negative, for separators, because separators don't have images
  if (b.ImageIndex >= 0)
  {
    Image i = toolBar.ImageList.Images[b.ImageIndex];
    i.Save(b.ImageIndex + ".png");
  }
}

      

0


source







All Articles