C# Splash Screen

c# splash screen

Application Splash Screen

Professional .NET software applications very often have a splash screen that appears while an application loads. A splash-screen not only gives the user something to look at while the program loads, but it gives a professional presentation to your C# applications.

While applications can have very simple C# splash screens, in this article let’s go over the components of making an advanced splash screen. For shadows and transparency, you’ll need a few API calls to enabled transparency in a Window Form background image.

API Calls Required

The most important API function to create our C# splash screen will be UpdateLayeredWindow. UpdateLayerWindow is a very useful function. Not only will it enable our application to display background images with transperancy, that includes shadows, but it will also eliminate the need to manually custom-shape the Windows Form.

However it will not be the only API call, since the splash Form will display an image we need some common API calls to handle images:


The declarations are all included in the API class in the source code.

Extend Style – Windows Form

There is one final adjustment to set to the Windows Form. The Form style needs to be extended to allow “layers” which the API calls will utilize. To set WS_EX_LAYERED to the splash-screen, you will need to override the CreateParams property:

protected override CreateParams CreateParams
         CreateParams cp = base.CreateParams;
         cp.ExStyle |= 0x00080000; // Required: set WS_EX_LAYERED extended style
         return cp;

Combined with the API calls, the C# splash screen can now display shadows and even transparent areas like a professional software application. The only drawback is the UpdateLayeredWindow API call (which is the one that renders the image) makes normal controls not appear. There is no way around this, except to draw the image with other methods or move to newer technologies such as WPF.

Download the provided source code to see a working example of the splash-screen and to see the detailed C# function that calls the appropriate API functions.

Download C# Splash Screen Source Code

Referenced by: http://www.vcskicks.com/splash-screen.php

Generic plug-in application in C#

At work, we are about to build a new internal tool for administration of different systems. We developers need certain applications and the sales department needs some other ones. All the different people need to be able to administrate different systems, so we decided to create one application that hosts only the applications the individual needs.

Last weekend I played with a generic application that hosts other applications by using reflection. The Plug-in Application does nothing but manages the different plug-ins and let you add and remove plug-ins as you please. When a plug-in is added, it is added to the menu so that every time you open the application, you have easy access to the plug-in.

Each plug-in is in essence a .NET Windows Forms application, but you can also compile the WinForm into a .dll file so it cannot be opened outside the application.

This is what it looks like when the plug-in “TestForm” is running in the application.

Now the plug-in is maximized.

By clicking on the menu item “Manage Plug-ins” it pops up a manager that lets you add and remove plug-ins.

How it works

To make your Windows Forms application compatible with the application, you need to let the main form inherit from a class called PluginForm. The PluginForm resides in its own assembly and is also referenced by the Plug-in Application. It only contains a property called Description and that is used to display tooltips on the menu and in the Plug-in Manager. Your main form needs to inherit from the PluginForm in order to know which form is the one to use in the Plug-in Application.

When you add a plug-in then the Plug-in Application creates an XML document that describes its location, icon, description and name. Because it does not copy the .exe or .dll file but only points to it, means that app.config and other files still work with the plug-in.

This is a simplified version of the one we need at Traceworks where we also needs security and other features. The Plug-in Application is so simple that it is easy to add such features.


The solution contains three projects. The application, the PluginForm base class project and a test plug-in.

PluginApplication.zip (243,15 KB)


Referenced by: http://madskristensen.net/post/Generic-plug-in-application-in-C.aspx#comment

Metallic Chrome Text

In this tutorial, i’ll show you some simple steps in creating a chrome text effect= by applying just a few styles..

Start a new document and fill the background with white.

Press “D” to reset your colors to black and white

Use the type tool to create your text. Make it fairly large.


Then go to Layers » Layer Style » Satin

Then go to Layers » Layer Style » Bevel & Emboss (just check the bevel & emboss box since you already got the layer style box open)

Then go to Layers » Layer Style » Drop Shadow. (just check the drop shadow box since you already got the layer style box open)

Referenced by: http://www.tutorialwiz.com/chrome/

A Quick Code Igniter and JQuery Ajax Tutorial

This tutorial assumes a basic working knowledge of Code Igniter. If you have never used CI before, please refer to the framework documentation

In the old days (2 years ago), working the Javascript magic to create a cool AJAX based event took a fairly decent working knowledge of the mechanisms behind the process.

With the increasing popularity of Javascript libraries however, this type of functionality became available to the web site hobbyist, and was made much easier for the web site professional.

The following step-by-step tutorial will show you how to combine the power of JQuery (a javascript library that weighs in at about 20k) with Code Igniter (a PHP framework based on the MVC design pattern) to quickly and painlessly pass a record ID through the javascript and over to the server, where it will be passed to a mysql database, used to retrieve some data, and sent back to the page for display.

Step 1
We begin by assuming that you have a div with an id of content, which is where you would like your freshly retrieved data to display, once it has been freshly retrieved. For this exercise, you have already taken an action to call your javascript function with a record ID parameter.

The first thing you need to do, is make sure JQuery is being loaded, and to create a function for your AJAX request.

Step 2:
Next, youll use the JQuery function load, and attach it to your content div:

function get_record_id(record_id) {

Step 3:
The load function accepts three arguments. The page to be called on the other side of the HTTPRequest, the array to pass through the POST, and a callback function. It looks like this:

function get_record_id(record_id) {


Lets go back to that. Code Igniter URLs are created by calling the name of your controller, followed by the function inside the controller class that will handle your request. If your server does not support mod-rewrite, you may also need to append an index.php to the beginning. The str inside the callback function is the results of your AJAX request. There isnt much use for the str when using the .load function, but it does come in handy using the other JQuery AJAX functions – $.post and $.get, which I assume are self explanatory.

Step 4

var p = {}; //instantiate the array
p[record_id] = record_id //assign your record_id variable to it.

Thats all there is to it. Your final javascript function looks like this:

function get_record_id(record_id) {
     var p = {};
     p[record_id] = record_id


Step 5
On the CI side, you have a controller and method setup something like this:

class Controller
   function Controller()

   function method()

The important part is the method() function, as it will contain some of the code we need to make things happen.

Step 6
The first thing you need to do on the CI side is retrieve the value passed through the request object. This is simple enough, using $_POST[record_id]. You also want to load up your database model so you can get the record out of your database. So, well load the database library, and then load the actual model. Then, we want to send the record ID to the database, get the resulting data, and pass it back out to the request. our function starts to look like its doing something useful pretty quickly.

function method()
   $record_id = $_POST[record_id];
   //set the record ID
   //load the database library to connect to your database
   //inside your system/application/models folder, create a model based on the procedure
   //outlined in the CI documentation
   $results = $this->records->get_record($record_id);
   //get the record from the database

Step 7
At this point, we need to go into our records.php file in the model folder. Since Code Igniter uses a Model-View-Controller structure, database activity, server-side processing, and client-side display should be as separate from one another as possible. You dont NEED to do this for Code Igniter to do its thing, but its good practice.

Inside the records.php file, well create a method called get_record to match the method referenced above. Well use it to get a record by its primary key of ID, put the resulting data into an array, and send it back to the controller, out to the view, and ultimately into the content div we started with.

function get_record($record_id)
   //we want the row whose ID matches the value were passing in
   $query = $this->db->get(record_table);
   //get the table and put it into an object named $query
   $row = $query->row();
   //gets the first row of the resulting dataset.  In this case, only 1 row will ever be returned
   $results[record][$row->ID][name] = $row->name;
   //here, we create a multi-dimensional array holding the returned values
   //based on the key.
   return $results;
   //send the record back to the controller

The trickiest part of this section is the array. It seems pretty complex from here, but youll see soon enough how it breaks down into something more manageable as we go along.

Step 8
Were back to the controller again, and we have one more line to add – this time to pass the resulting data into a view to be formatted and printed to the content div. The whole method() function now looks like this:

function method()
   $ID = $_POST[record_id];  //set the record ID
   //load the database library to connect to your database
   //inside your system/application/models folder, create a model based on
   //the procedure outlined in the CI documentation
   $results = $this->records->get_record($record_id);
   //get the record from the database

Step 9
The AJAX_record.php file should be in your system/application/views folder. Keep in mind, that when you pass an array to a view (in this case the $results array), it will be exploded inside the view. So, the path to your record is now $record, instead of $results[record]. Also inside will be your standard HTML markup, and something like this:

< ?php foreach($record as $id=>$value) { ?>
     The name associated with this record is: < ?php print $value[name];?>
< ?php } ?>

This output is what php is sending to the request object, and is also what gets loaded into the content div. Code Igniter and JQuery make it that easy to dynamically load data using AJAX.

Referenced by: http://www.mrforbes.com/blog/2009/01/a-quick-code-igniter-and-jquery-ajax-tutorial/