Reasons for why a WinForms label does not want to be transparent?

Most simple solution is following:

  1. Set background color to transparency either in visual editor or in constructor of your form:

    this.label1.BackColor = System.Drawing.Color.Transparent;

  2. Set Parent property of your label to control that you want to be visible behind the text. This can be done in form constructor or in Load method:

    this.label1.Parent = progressBar1;

Its true that this is not true transparency as in DirectX. The result you see on display is composed only from two layers. You cant sum up more than two layers with this approach (each layer having its own transparency defined by alpha parameter). But its suitable for many practical situations you can encounter in Winforms programming.


WinForms doesn't really support transparent controls, but you can make a transparent control yourself. See my answer here.

In your case you should probably subclass the progress bar and override the OnPaint method to draw a text on the progress bar.


Add a new class to your project and post the code shown below. Build. Drop the new control from the top of the toolbox onto your form.

using System;
using System.Windows.Forms;

public class TransparentLabel : Label {
  public TransparentLabel() {
    this.SetStyle(ControlStyles.Opaque, true);
    this.SetStyle(ControlStyles.OptimizedDoubleBuffer, false);
  }
  protected override CreateParams CreateParams {
    get {
      CreateParams parms = base.CreateParams;
      parms.ExStyle |= 0x20;  // Turn on WS_EX_TRANSPARENT
      return parms;
    }
  }
}