Load Rescouce BMP image : Resource ResX « Development Class « C# / C Sharp

Home
C# / C Sharp
1.2D Graphics
2.Class Interface
3.Collections Data Structure
4.Components
5.Data Types
6.Database ADO.net
7.Design Patterns
8.Development Class
9.Event
10.File Stream
11.Generics
12.GUI Windows Form
13.Language Basics
14.LINQ
15.Network
16.Office
17.Reflection
18.Regular Expressions
19.Security
20.Services Event
21.Thread
22.Web Services
23.Windows
24.Windows Presentation Foundation
25.XML
26.XML LINQ
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source
C# / C Sharp » Development Class » Resource ResXScreenshots 
Load Rescouce BMP image
Load Rescouce BMP image

  using System;
  using System.Drawing;
  using System.Collections;
  using System.ComponentModel;
  using System.Windows.Forms;
  using System.Data;

  using System.Resources;

  public class MainForm : System.Windows.Forms.Form
  {
    private System.Windows.Forms.PictureBox pictureBox1;
    private System.Windows.Forms.Button btnLoadRes;
    private System.Windows.Forms.Label label1;
    private System.Windows.Forms.PictureBox pictureBox2;

    public MainForm()
    {
      InitializeComponent();
      CenterToScreen();
    }
    private void InitializeComponent()
    {
      System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(MainForm));
      this.pictureBox2 = new System.Windows.Forms.PictureBox();
      this.pictureBox1 = new System.Windows.Forms.PictureBox();
      this.btnLoadRes = new System.Windows.Forms.Button();
      this.label1 = new System.Windows.Forms.Label();
      this.SuspendLayout();
      // 
      // pictureBox2
      // 
      this.pictureBox2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
      this.pictureBox2.Location = new System.Drawing.Point(17672);
      this.pictureBox2.Name = "pictureBox2";
      this.pictureBox2.Size = new System.Drawing.Size(3232);
      this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
      this.pictureBox2.TabIndex = 5;
      this.pictureBox2.TabStop = false;
      // 
      // pictureBox1
      // 
      this.pictureBox1.Image = ((System.Drawing.Bitmap)(resources.GetObject("pictureBox1.Image")));
      this.pictureBox1.Location = new System.Drawing.Point(17616);
      this.pictureBox1.Name = "pictureBox1";
      this.pictureBox1.Size = new System.Drawing.Size(3232);
      this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
      this.pictureBox1.TabIndex = 1;
      this.pictureBox1.TabStop = false;
      // 
      // btnLoadRes
      // 
      this.btnLoadRes.Location = new System.Drawing.Point(880);
      this.btnLoadRes.Name = "btnLoadRes";
      this.btnLoadRes.Size = new System.Drawing.Size(14423);
      this.btnLoadRes.TabIndex = 4;
      this.btnLoadRes.Text = "Load Happy dude!";
      this.btnLoadRes.Click += new System.EventHandler(this.btnLoadRes_Click);
      // 
      // label1
      // 
      this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif"12F, System.Drawing.FontStyle.Bold);
      this.label1.Location = new System.Drawing.Point(816);
      this.label1.Name = "label1";
      this.label1.Size = new System.Drawing.Size(15240);
      this.label1.TabIndex = 0;
      this.label1.Text = "Here is the image:";
      // 
      // MainForm
      // 
      this.AutoScaleBaseSize = new System.Drawing.Size(513);
      this.ClientSize = new System.Drawing.Size(235128);
      this.Controls.AddRange(new System.Windows.Forms.Control[] {
                                      this.pictureBox2,
                                      this.btnLoadRes,
                                      this.pictureBox1,
                                      this.label1});
      this.Name = "MainForm";
      this.Text = "Resource Loader";
      this.ResumeLayout(false);

    }
    static void Main() 
    {
      Application.Run(new MainForm());
    }

    private void btnLoadRes_Click(object sender, System.EventArgs e)
    {
      ResourceManager resources = new ResourceManager (typeof(MainForm));
      
      this.pictureBox2.Image = 
        ((System.Drawing.Bitmap)(resources.GetObject("pictureBox1.Image")));
      resources.ReleaseAllResources();  
    }
      
  }


           
       
Related examples in the same category
1.Create resource file and read value from it using IDictionaryEnumeratorCreate resource file and read value from it using IDictionaryEnumerator
2.Create resource file and read value from itCreate resource file and read value from it
3.Create File Based Resource Manager
4.ResX Resource WriterResX Resource Writer
5.Save Image file to resource fileSave Image file to resource file
6.Compile resource into the final exe fileCompile resource into the final exe file
7.Generate resource file with image
8.Save and load image from resource file
9.Save and read value from resx resource file
10.Writing a resource file programmatically
11.Reading resourcesReading resources
12.Resource file generator application for difference languages
13.Read Resource for difference langaugesRead Resource for difference langauges
14.Creating a new resource readerCreating a new resource reader
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.