There is another way. You can update the style bits for the control.
[System.Runtime.InteropServices.DllImport("coredll")]
private static extern IntPtr GetCapture();
[System.Runtime.InteropServices.DllImport("coredll")]
private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[System.Runtime.InteropServices.DllImport("coredll")]
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int
dwNewLong);
private const int GWL_STYLE = -16;
private const int SS_NOPREFIX = 0x00000080;
private void UpdateLabelStyle(Label ctrl)
{
IntPtr hWnd;
int style;
// If targeting CF 2.0 use the Handle property.
// hWnd = ctrl.Handle;
// If targeting CF 1.0 use the three lines below.
ctrl.Capture = true;
hWnd = GetCapture();
ctrl.Capture = false;
style = GetWindowLong(hWnd, GWL_STYLE);
SetWindowLong(hWnd, GWL_STYLE, (style | SS_NOPREFIX));
ctrl.Refresh();
}
And just make the following call for each Label that should be modified.
UpdateLabelStyle(this.label1);