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
//
// http://poleshchuk.spb.ru/cad/2010/TrSplashCse.htm
//
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.ComponentModel;
using System.Windows.Forms;
namespace Book16cs
{
}
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