Showing a splash-screen from your AutoCAD .NET application
Thanks once again to Viru Aithal for the inspiration behind this post, although I did write most of the code, this time. :-)
Adding a splash screen can give a touch of class to your application, assuming it's done non-intrusively. This post focuses on how best to do so within AutoCAD, and use the time it's displayed to perform initialization for your application.
The first thing you need to do is add a Windows Form to your project:
You should select the standard "Windows Form" type, giving an appropriate name (in this case I've used "SplashScreen", imaginatively enough).
Once this is done, you should set the background for the form to be your preferred bitmap image, by browsing to it from the form's BackgroundImage property:
Now we're ready to add some code. Here's some C# code that shows how to show the splash-screen from the Initialize() method:
using Prompts; // This is the name of the module
public class Startup : IExtensionApplication
public void Initialize()
SplashScreen ss = new SplashScreen();
// Rather than trusting these properties to be set
// at design-time, let's set them here
ss.Opacity = 0.8;
ss.TopMost = true;
ss.ShowInTaskbar = false;
// Now let's disply the splash-screen
// This is where your application should initialise,
// but in our case let's take a 3-second nap
public void Terminate()
Some notes on the code:
- I used a sample application called "Prompts" - you should change the using directive to refer to your own module name.
- We're setting a number of properties dynamically (at runtime), rather than stepping through how to set them at design-time.
- We've set the splash screen to be 80% opaque (or 20% transparent). This is easy to adjust.
- Some of the additional properties may be redundant, but they seemed sensible to set (at least to me).
Here's the result... I've set up my application to demand-load when I invoke a command, which allowed me to load a DWG first to show off the transparency of the splash-screen (even though the above code doesn't actually define a command - so do expect an "Unknown command" message, if you do exactly the same thing as I have). You may prefer to set the module to load on AutoCAD startup, otherwise.
Roland Feletic brought it to my attention that this post needed updating for AutoCAD 2010. Thanks, Roland!
I looked into the code, and found that the call to ShowModelessDialog needed changing to this:
I also found I had to add an additional assembly reference to PresentationCore (a .NET Framework 3.0 assembly).