Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. for (int x = 0; x < this.imageListToolbar3small.Images.Count; ++x)
  2. {
  3. Image temp = this.imageListToolbar.Images[x];
  4. temp.Save(this.imageListToolbar.Images.Keys[x] + ".png");
  5. }
  6.  
  7. foreach (ToolBarButton b in toolBar.Buttons)
  8. {
  9. //can be negative, for separators, because separators don't have images
  10. if (b.ImageIndex >= 0)
  11. {
  12. Image i = toolBar.ImageList.Images[b.ImageIndex];
  13. i.Save(b.ImageIndex + ".png");
  14. }
  15. }
  16.  
  17. Dim cntrl = New TheClassWithThePrivateImageList
  18. Dim pi As Reflection.PropertyInfo, iml As System.Windows.Forms.ImageList, propName = "ThePropertyName"
  19. pi = cntrl.GetType.GetProperty(propName, Reflection.BindingFlags.NonPublic Or Reflection.BindingFlags.Instance)
  20. iml = CType(pi.GetValue(cntrl), System.Windows.Forms.ImageList)
  21. For Each key In iml.Images.Keys
  22. Dim image As Drawing.Image = iml.Images.Item(key)
  23. image.Save($"{propName}_{key}")
  24. Next
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement