Search code examples
.netwinformsvisual-studioresourcesembedded-resource

How to edit embedded images in a Visual Studio project


I have a Windows Forms project. For some controls the property "Image" has value System.Drawing.Bitmap (not some file from the resources). I need to make some changes to the images. Is there a way I can get them out as a separate files and edit them?


Solution

  • I don't know which version of Visual Studio you are working with, but here's a quickie for Visual Studio 2010. For standard controls, those images are hosted in the project resource file or as a local resource.

    Project resource file: you can edit it via projects settings -> Resources. Right-click the image and choose "Open with".

    Local resource: Actually the images are not stored in the filesystem, but rather added to the resx file of your form (e.g. MainForm.resx) as a Base64-encoded serialized representation. If you know how to, you could Base64-decode that string, save the result in a flatfile and name it correctly (you must know the image type for that).

    Maybe there's a more comfortable way, but that's what I'd try in the first place. See also: http://www.nirsoft.net/utils/resources_extract.html (I haven't tried it, though).