Visual Studio Development Bookmark and Share   
 index > Visual C# Express Edition > how to embed a bitmap (logo or immage) in c# excecutable?
 

how to embed a bitmap (logo or immage) in c# excecutable?

I like to have a logo or any image shown when this C# excecuteble is activated. That is whitout to have a bitmap-file be present at execution time. So it is like having a "splash immage" shown when opening this application.
How to do this.
new2ceecee  Thursday, October 08, 2009 2:42 PM
You can put the image on the form in a PictureBox or other control and set its Visible property to False so it doesn't appear.

Or you can add the image as a resource. Open the Project menu, select Properties (at the bottom), click the Resources tab, open the Add Resource dropdown, and select Add Existing File. Then you can refer to the resource as in the following (where WindowsFormsApplication1 is the application namespace):

    this.BackgroundImage = WindowsFormsApplication1.Properties.Resources.arrow;

Rod
Rod Stephens  Friday, October 09, 2009 1:35 PM

I guess you want what is known as a custom "splash screen" to display when the program first starts up.
How to Embed and Retrieve Resource in C#

Once you have attached the graphics file to your project, then you will need to create a separate form to display it on.
Do this by adding a PictureBox control to your form and retrieving the bitmap resource for display.

Next you will need to program the form to close by itself after a brief time delay.
There are a couple of ways to do this, but they all begin the moment the splash screen is first shown.
You need connect into the Shown event of your 'splash screen' form.

When this event fires, you method handler will need to either start a timer and set up a Tick handler, or do this .....

Thread.Sleep(3000);  // a 3 second delay.
this.Close();   // close this form.

Now you need to display it.  This is easiest to do in the main form's constructor by calling this method.


        private void DisplaySplashScreen()
        {
            using (SplashScreen form = new SplashScreen())
            {
                form.ShowDialog();
            }
        }

That assumes your form is named SplashScreeen.


Rudedog   =8^D

Mark the best replies as answers. "Fooling computers since 1971."
Rudedog2  Thursday, October 08, 2009 4:05 PM

I guess you want what is known as a custom "splash screen" to display when the program first starts up.
How to Embed and Retrieve Resource in C#

Once you have attached the graphics file to your project, then you will need to create a separate form to display it on.
Do this by adding a PictureBox control to your form and retrieving the bitmap resource for display.

Next you will need to program the form to close by itself after a brief time delay.
There are a couple of ways to do this, but they all begin the moment the splash screen is first shown.
You need connect into the Shown event of your 'splash screen' form.

When this event fires, you method handler will need to either start a timer and set up a Tick handler, or do this .....

Thread.Sleep(3000);  // a 3 second delay.
this.Close();   // close this form.

Now you need to display it.  This is easiest to do in the main form's constructor by calling this method.


        private void DisplaySplashScreen()
        {
            using (SplashScreen form = new SplashScreen())
            {
                form.ShowDialog();
            }
        }

That assumes your form is named SplashScreeen.


Rudedog   =8^D

Mark the best replies as answers. "Fooling computers since 1971."
Rudedog2  Thursday, October 08, 2009 4:05 PM
You can put the image on the form in a PictureBox or other control and set its Visible property to False so it doesn't appear.

Or you can add the image as a resource. Open the Project menu, select Properties (at the bottom), click the Resources tab, open the Add Resource dropdown, and select Add Existing File. Then you can refer to the resource as in the following (where WindowsFormsApplication1 is the application namespace):

    this.BackgroundImage = WindowsFormsApplication1.Properties.Resources.arrow;

Rod
Rod Stephens  Friday, October 09, 2009 1:35 PM

You can use google to search for other answers

Custom Search

More Threads

• Dynamic Hyperlink on DataGrid In Webform ?
• Reflection
• Development using IDE and custom code
• Always Getkeys?
• Anyway to put C# Express Edition into 32Bit compile mode
• Two forms, can't seem to access data
• adding a reference in a project
• How to run cmd prompt in C#
• What should i do?!?
• Unicode characters