拖动一个trackBar上来,很简单的打入如下代码:

private void trackBar1_ValueChanged(object sender, System.EventArgs e)
        
{
          
this.Opacity=(float)(100-this.trackBar1.Value*2)/100;
        }