SoFunction
Updated on 2025-03-06

C# transparent form implementation method

This article describes the implementation method of C# transparent form. Share it for your reference. The specific implementation method is as follows:

namespace WindowsApplication1
{
  public partial class Form2 : Form
  {
    public Form2()
    {
      InitializeComponent();
       = 1;
       = "opacity=1";
       = true;
    }
    private void Form2_Activated(object sender, EventArgs e)
    {
      this. = true;
    }
    private void Form2_Deactivate(object sender, EventArgs e)
    {
      this. = false;
       = 1;
       = "opacity=" + ();
    }
    private void Form2_Load(object sender, EventArgs e)
    {
    }
    private void timer1_Tick(object sender, EventArgs e)
    {
      if ( > 0)
      {
         -= 0.1;
         = "opacity=" + ();
      }
      else if ( == 0)
      {
        ();
      }
      else this. = false;
    }
  }
}

I hope this article will be helpful to everyone's C# programming.