2007-06-26 08:03:36 +00:00
|
|
|
|
|
|
|
#region ================== Copyright (c) 2007 Pascal vd Heiden
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
|
|
|
|
* This program is released under GNU General Public License
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Namespaces
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.ComponentModel;
|
|
|
|
using System.Drawing;
|
|
|
|
using System.Text;
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
2007-06-26 08:46:55 +00:00
|
|
|
// This Form is a workaround for the slow drawing of the .NET Forms.
|
|
|
|
// By showing the Form at 0% Opacity it allows the .NET framework to complete
|
|
|
|
// drawing the Form first, then we set it to 100% Opacity to actually show it.
|
2007-06-26 09:11:52 +00:00
|
|
|
// To use this class properly, set the initial Opacity of your Form to 0.
|
2007-06-26 08:46:55 +00:00
|
|
|
|
2007-06-26 08:03:36 +00:00
|
|
|
namespace CodeImp.DoomBuilder.Interface
|
|
|
|
{
|
|
|
|
public class DelayedForm : Form
|
|
|
|
{
|
2007-06-26 08:46:55 +00:00
|
|
|
// Variables
|
2007-06-26 08:03:36 +00:00
|
|
|
private Timer formshowtimer;
|
|
|
|
|
|
|
|
// Constructor
|
|
|
|
public DelayedForm()
|
|
|
|
{
|
|
|
|
// Create a timer that we need to show the form
|
|
|
|
formshowtimer = new Timer();
|
|
|
|
formshowtimer.Interval = 1;
|
|
|
|
formshowtimer.Tick += new EventHandler(formshowtimer_Tick);
|
|
|
|
}
|
2007-06-26 08:46:55 +00:00
|
|
|
|
2007-06-26 08:03:36 +00:00
|
|
|
// When form is shown
|
|
|
|
protected override void OnShown(EventArgs e)
|
|
|
|
{
|
|
|
|
// Let the base class know
|
|
|
|
base.OnShown(e);
|
|
|
|
|
|
|
|
// Start the timer to show the form
|
|
|
|
formshowtimer.Enabled = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// When the form is to be shown
|
2007-06-26 08:46:55 +00:00
|
|
|
private void formshowtimer_Tick(object sender, EventArgs e)
|
2007-06-26 08:03:36 +00:00
|
|
|
{
|
|
|
|
// Get rid of the timer
|
|
|
|
formshowtimer.Dispose();
|
|
|
|
formshowtimer = null;
|
|
|
|
|
|
|
|
// Make the form visible
|
|
|
|
this.Opacity = 100;
|
|
|
|
}
|
2007-09-25 05:57:42 +00:00
|
|
|
|
2007-10-27 13:59:24 +00:00
|
|
|
// Block this
|
|
|
|
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
|
2007-09-25 05:57:42 +00:00
|
|
|
{
|
2007-10-27 13:59:24 +00:00
|
|
|
//return base.ProcessCmdKey(ref msg, keyData);
|
|
|
|
return false;
|
2007-09-25 05:57:42 +00:00
|
|
|
}
|
2007-06-26 08:03:36 +00:00
|
|
|
}
|
|
|
|
}
|