Windows Develop Bookmark and Share   
 index > Windows Forms Designer > Problem Updating .resx file
 

Problem Updating .resx file

In the resx file i have
<data name="imageList1.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
    <value>
        AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
        LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
        ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADq
        CAAAAk1TRnQBSQFMAgEBAwEAAQgBAAEEAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
        AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
        AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
        AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
        AWYDAAGZAwABzAIAATMDAAIzAgABMwFmAgABMwGZAgABMwHMAgABMwH/AgABZgMAAWYBMwIAAmYCAAFm
        AZkCAAFmAcwCAAFmAf8CAAGZAwABmQEzAgABmQFmAgACmQIAAZkBzAIAAZkB/wIAAcwDAAHMATMCAAHM
        AWYCAAHMAZkCAALMAgABzAH/AgAB/wFmAgAB/wGZAgAB/wHMAQABMwH/AgAB/wEAATMBAAEzAQABZgEA
        ATMBAAGZAQABMwEAAcwBAAEzAQAB/wEAAf8BMwIAAzMBAAIzAWYBAAIzAZkBAAIzAcwBAAIzAf8BAAEz
        AWYCAAEzAWYBMwEAATMCZgEAATMBZgGZAQABMwFmAcwBAAEzAWYB/wEAATMBmQIAATMBmQEzAQABMwGZ
        AWYBAAEzApkBAAEzAZkBzAEAATMBmQH/AQABMwHMAgABMwHMATMBAAEzAcwBZgEAATMBzAGZAQABMwLM
        AQABMwHMAf8BAAEzAf8BMwEAATMB/wFmAQABMwH/AZkBAAEzAf8BzAEAATMC/wEAAWYDAAFmAQABMwEA
        AWYBAAFmAQABZgEAAZkBAAFmAQABzAEAAWYBAAH/AQABZgEzAgABZgIzAQABZgEzAWYBAAFmATMBmQEA
        AWYBMwHMAQABZgEzAf8BAAJmAgACZgEzAQADZgEAAmYBmQEAAmYBzAEAAWYBmQIAAWYBmQEzAQABZgGZ
        AWYBAAFmApkBAAFmAZkBzAEAAWYBmQH/AQABZgHMAgABZgHMATMBAAFmAcwBmQEAAWYCzAEAAWYBzAH/
        AQABZgH/AgABZgH/ATMBAAFmAf8BmQEAAWYB/wHMAQABzAEAAf8BAAH/AQABzAEAApkCAAGZATMBmQEA
        AZkBAAGZAQABmQEAAcwBAAGZAwABmQIzAQABmQEAAWYBAAGZATMBzAEAAZkBAAH/AQABmQFmAgABmQFm
        ATMBAAGZATMBZgEAAZkBZgGZAQABmQFmAcwBAAGZATMB/wEAApkBMwEAApkBZgEAA5kBAAKZAcwBAAKZ
        Af8BAAGZAcwCAAGZAcwBMwEAAWYBzAFmAQABmQHMAZkBAAGZAswBAAGZAcwB/wEAAZkB/wIAAZkB/wEz
        AQABmQHMAWYBAAGZAf8BmQEAAZkB/wHMAQABmQL/AQABzAMAAZkBAAEzAQABzAEAAWYBAAHMAQABmQEA
        AcwBAAHMAQABmQEzAgABzAIzAQABzAEzAWYBAAHMATMBmQEAAcwBMwHMAQABzAEzAf8BAAHMAWYCAAHM
        AWYBMwEAAZkCZgEAAcwBZgGZAQABzAFmAcwBAAGZAWYB/wEAAcwBmQIAAcwBmQEzAQABzAGZAWYBAAHM
        ApkBAAHMAZkBzAEAAcwBmQH/AQACzAIAAswBMwEAAswBZgEAAswBmQEAA8wBAALMAf8BAAHMAf8CAAHM
        Af8BMw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/wLsAv8BAAH/EAAB/wEA
        DP8BAAL/AQAJ+wIAAfsBAAL/AQAI/wEHAuwB/wEAAf8QAAH/AQAM/wEAAv8BAAn7AuwB+wEAAv8BAAn/
        AgcB/wEAAf8QAAH/AQAM/wEAAv8BAAz7AQAC/wEADP8BAAH/EAAB/wEADP8BAAL/AQAM+wEAAv8BAAz/
        AQAB/xAAAf8OAAL/DgAC/w4AAf8QADD/EAABQgFNAT4HAAE+AwABKAMAAUADAAEQAwABAQEAAQEFAAGA
        FwAD/4EACw==
</value>
  </data>

This is base64 equivalent of 3 icons.

these are loaded in codebehind using the following code
this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream");<br/>
this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
this.imageList1.Images.SetKeyName(0, "UnChecked.ico");
this.imageList1.Images.SetKeyName(1, "Checked.ico");
this.imageList1.Images.SetKeyName(2, "Indeterminated.ico");


Now i wanted to replace these images with my own images.anyone please post a step by step process by which i can generate Base64 of my images and replace it with my images.

PhaniBitra  Wednesday, April 08, 2009 11:22 AM

Hi PhaniBitra,

If you already have image files, the following way is recommended to take.
1. Double click the "Resources.resx" under the Properties node of your project.
2. Click the "Add Resource" drop down button and choose "Add Existing Files...", you can select the file you need.
3. In your code, add these images to the ImageList like this.
ImageList imgList = new ImageList();
Image image = WindowsFormsApplication1.Properties.Resources.Image1;
imgList.Images.Add(image);
WindowsFormsApplication1 is your project namespace, Image1 is the image you have just added.

If you have anything unclear, please feel free to tell me.

Sincerely,
Kira Qian


Please mark the replies as answers if they help and unmark if they don't.
Kira Qian  Friday, April 10, 2009 3:39 AM

Hi PhaniBitra,

If you already have image files, the following way is recommended to take.
1. Double click the "Resources.resx" under the Properties node of your project.
2. Click the "Add Resource" drop down button and choose "Add Existing Files...", you can select the file you need.
3. In your code, add these images to the ImageList like this.
ImageList imgList = new ImageList();
Image image = WindowsFormsApplication1.Properties.Resources.Image1;
imgList.Images.Add(image);
WindowsFormsApplication1 is your project namespace, Image1 is the image you have just added.

If you have anything unclear, please feel free to tell me.

Sincerely,
Kira Qian


Please mark the replies as answers if they help and unmark if they don't.
Kira Qian  Friday, April 10, 2009 3:39 AM
Thanks, this helped me a lot, but then how can we embed images into .resx file in Base64 encoding as i shown in the above sample code
PhaniBitra  Tuesday, April 14, 2009 9:02 AM

Hi PhaniBitra,

You can convert it to image and save it as a file first, then use add existing file. Look at this example.
http://www.dailycoding.com/Posts/convert_image_to_base64_string_and_base64_string_to_image.aspx

Sincerely,
Kira Qian


Please mark the replies as answers if they help and unmark if they don't.
Kira Qian  Tuesday, April 14, 2009 9:08 AM

You can use google to search for other answers

Custom Search

More Threads

• problem wid datagridcolumnstyle ... urgent
• Getting the focus of Custom Controls
• How can MDI parent access controls on the active MDI child form?
• About combo box.
• Unable to view designer in vs2005 c#
• Custom constructors with types from separate project breaks winforms designer (VS2010)
• Incrementing the file version of an EXE created when building a Visual Basic 2005 Express project
• Hard to explain....but please read.
• Excel functionality in listview
• Container Control