What our code does is get the image we set as Background Image and
creates a Bitmap object as a copy of the same image. Next, we call Make
Transparent method of the Bitmap class that gets a color as an argument
and makes it transparent.
Splash.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace splashscreen
{
public partial class Splash : Form
{
public Splash()
{
InitializeComponent();
Bitmap b = new Bitmap(this.BackgroundImage);
b.MakeTransparent(b.GetPixel(1, 1));
this.BackgroundImage = b;
}
private void Splash_Load(object sender, EventArgs e)
{
}
}
}
Form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;
namespace splashscreen
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
Thread th = new Thread(new ThreadStart(DoSplash));
th.Start();
Thread.Sleep(3000);
th.Abort();
Thread.Sleep(1000);
}
public void DoSplash()
{
Splash sp = new Splash();
sp.ShowDialog();
}
}
}
OUTPUT
Splash.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace splashscreen
{
public partial class Splash : Form
{
public Splash()
{
InitializeComponent();
Bitmap b = new Bitmap(this.BackgroundImage);
b.MakeTransparent(b.GetPixel(1, 1));
this.BackgroundImage = b;
}
private void Splash_Load(object sender, EventArgs e)
{
}
}
}
Form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;
namespace splashscreen
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
Thread th = new Thread(new ThreadStart(DoSplash));
th.Start();
Thread.Sleep(3000);
th.Abort();
Thread.Sleep(1000);
}
public void DoSplash()
{
Splash sp = new Splash();
sp.ShowDialog();
}
}
}
OUTPUT