NP CAD Page | Articles | Download | Russian

Transparent Splash Screen As a Modeless Dialog (C#)

In the book "AutoCAD: Application Development, Tuning and Customization" there was a sample application in C++ with using .NET technology. When running the application a transparent splash window started and disappeared either in five seconds or after user's click in the window area.

We shall give an example of a similar application with using .NET technology but with adding of a subsequent change of window transparency (up to window vanishing). Here is a main file Wform16.cs:

// N.Poleshchuk, 2010.
// Wform.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.ComponentModel;
using System.Windows.Forms;

namespace Book16cs

public class Wform16 : System.Windows.Forms.Form
private System.ComponentModel.IContainer components;

public Wform16()

protected override void Dispose(bool disposing)
if (disposing)
if (components != null)

private void InitializeComponent()
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Wform16));

// Dialog box parameters
this.Size = new System.Drawing.Size(370, 300);
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.BackColor = System.Drawing.Color.Aquamarine;
this.Opacity = 1.0;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;

// Font
System.Drawing.FontFamily Ff = new FontFamily("Arial");
System.Drawing.Font Font = new System.Drawing.Font(Ff, 36, FontStyle.Bold);

// Label in the window center
System.Windows.Forms.Label Txt1 = new Label();
Txt1.Text = "Book16cs";
Txt1.Location = new Point(60, 110);
Txt1.AutoSize = true;
Txt1.ForeColor = Color.Black;
Txt1.Font = Font;

// Add Click event handler for the form
this.Click += new System.EventHandler(this.Wform16_OnClick);

// Timer creation
System.Windows.Forms.Timer tm = new System.Windows.Forms.Timer();
tm.Interval = 100; // signal interval = 0.1 sec.
tm.Tick += new System.EventHandler(this.Wform16_OnTimerTick);
tm.Enabled = true; //or tm.Start();


void Wform16_OnClick(object sender, System.EventArgs e)
// on click close window

// Reaction on timer signals
void Wform16_OnTimerTick(object sender, System.EventArgs ea)
System.Windows.Forms.Timer t1 = (System.Windows.Forms.Timer)sender;
// Change window transparency in 0.1 sec.
this.Opacity -= 0.02;
// Stop timer on window disappearance (Opacity = 0)
if (this.Opacity <= 0.0)
// Close window

Realization scheme is as in the mentioned application written in C++ language. A slice difference is connected with another method of using timer and influencing on window in order to get more transparency and at last window should merge with the background.
To create a continuity effect the timer interval was set to 100 (it coresponds to 0.1 sec). The start value for Opacity property was chose as 1.0 (absolute opaqueness). At every timer signal Opacity is decreased at 0.02. It is easy to clculate that after 50 timer signals Opacity will become 0 and the window will fully disappear (dissolve). So the window lifetime is equal to 5 seconds unless the user will left-click in the window area (but not on the text label).

The application works in AutoCAD 2006-2010. To launch it use BOOK16CS command.

On writing C# and VB.NET applications see chapter 7 of the book "AutoCAD: Application Development, Tuning and Customization". Transparency changing effect could be implemented in the C++ example too (let the reader do it himself).

One can download Visual Studio 2008 project (with source files) at the Download page.

NP CAD Page | Articles | Download | Russian