How .::. Extract image from .dll


  • Hi everyone
    I create a windowsControlLibrary and Add a ResourceFile to it.
    next Add an image to resource file and Build The dll file.
    next I Adding this dll to a Windows Forms Application.
    now,i want to use image that stored in dll resource.

    My dll name is:                           MyDll.dll
    My resource file name is:           MyResource.resx

    i need a suitable source code!
    enyone can help me?
    Tuesday, October 28, 2008 1:01 PM


  • Let's think this problem through.  When you added the images to the DLL they were added to Properties.  When you browse the DLL in the Object Browser Window, you should see the Properties Folderm which contains 2 classes; Resources and Settings.  Your images are saved as a regular C# property within Resources.

    internal static System.Drawing.Bitmap Blank {  
                get {  
                    object obj = ResourceManager.GetObject("Blank", resourceCulture);  
                    return ((System.Drawing.Bitmap)(obj));  

    That is how a file named Blank.bmp would look.  Notice that it is declared "internal", just like the containing class Resources.  That means the class and its' properties are not "public".  You will need to expose them as public to access them from other assemblies.

    I would create a class that served just that purpose.  It should be pretty easy to do.  Just like exposing controls on a form as public properties.  Just use a separate class to expose the Resources.

    Rudedog   =8^D
    Mark the best replies as answers. "Fooling computers since 1971."
    • Proposed as answer by Harry Zhu Friday, October 31, 2008 4:43 AM
    • Marked as answer by Harry Zhu Monday, November 03, 2008 1:03 AM
    • Marked as answer by Harry Zhu Monday, November 03, 2008 1:03 AM
    Tuesday, October 28, 2008 1:35 PM