C#工具栏图像采集编辑器

C#工具栏图像采集编辑器,c#,winforms,image,collections,toolbar,C#,Winforms,Image,Collections,Toolbar,我有一个带有工具栏和图像采集的应用程序。问题是我没有原始图像,我需要用一些相同的按钮创建另一个工具栏。有没有办法将图像集合从工具栏保存到文件中 我尝试从一个资源文件中提取图像,但我不知道哪个文件中存储了图像。虽然我没有找到问题的答案,但我还是通过读取工具栏图像列表并根据给定的图像键将每个图像保存到一个文件中,从而获得了图像 for (int x = 0; x < this.imageListToolbar3small.Images.Count; ++x) {

我有一个带有工具栏和图像采集的应用程序。问题是我没有原始图像,我需要用一些相同的按钮创建另一个工具栏。有没有办法将图像集合从工具栏保存到文件中


我尝试从一个资源文件中提取图像,但我不知道哪个文件中存储了图像。

虽然我没有找到问题的答案,但我还是通过读取工具栏图像列表并根据给定的图像键将每个图像保存到一个文件中,从而获得了图像

for (int x = 0; x < this.imageListToolbar3small.Images.Count; ++x)
        {
            Image temp = this.imageListToolbar.Images[x];
            temp.Save(this.imageListToolbar.Images.Keys[x] + ".png");
        }
for(int x=0;x
这是对这个问题的回答:

我只是在InitializeComponent调用之后添加了代码,并在调试模式下保存了所有图像。我不需要运行完整的应用程序

如果有人有更好的想法或小型应用程序,只使用资源文件从工具栏检索图像,那将不胜感激。我不会将其标记为答案,因为这更像是一种解决方法。

我使用这种方法:

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");
  }
}

我需要从控件的私有ImageList成员恢复图像。我使用了以下代码(对不起,这是VB,但是s/b很容易重构)


你好,UweKeim。对不起,我忘了指出。是的,它是windows窗体,windows 7中的VS2010
    Dim cntrl = New TheClassWithThePrivateImageList
    Dim pi As Reflection.PropertyInfo, iml As System.Windows.Forms.ImageList, propName = "ThePropertyName"
    pi = cntrl.GetType.GetProperty(propName, Reflection.BindingFlags.NonPublic Or Reflection.BindingFlags.Instance)
    iml = CType(pi.GetValue(cntrl), System.Windows.Forms.ImageList)
    For Each key In iml.Images.Keys
        Dim image As Drawing.Image = iml.Images.Item(key)
        image.Save($"{propName}_{key}")
    Next