Hi!
I'm using IG 11.2 CLR4x, and in the application I have a Office 2007 like ribbon, on wich I'm trying to put a label. The problem is that the background of the label is not transparent (even though in its properties it is set to transparent).
What can I do ? Thank you!
Hi mismar,
The behavior that you are observing is in fact expected behavior. The reason that the UltraLabel does not appear to apply the transparent appearance as you are expecting is that .NET controls, which many controls such as the UltraLabel are derived from do not actually support true transparency.
In instances where you are setting the control’s background to transparent, they will actually take on the background color of their parent control.
In this case, the label that you are using is in fact taking on the background color of its parent control, which is the form or Fill_Panel if one was implemented; the color used in this case appears to be the default background color, “Control”.
In the following screen shot, this same behavior is demonstrated with the .NET Label, where the form's BackColor is set to blue; note how the transparent label takes on the new appearance of its parent.
If you are only trying to display text within the ribbon, I would recommend using the DrawString() method extended from the graphics object of the form, within the forms paint event handler.
Using this approach you will be able to place your text anywhere on the form while maintaining the transparency behavior that you are looking for.
If you have any questions at all regarding this approach, please let me know.
Sincerely,Chris KDeveloper Support EngineerInfragistics, Inc.www.infragistics.com/support
Thank you Chris or both the explanations and the suggestion.
I've gave it a shot, using your approach but Nothing gets painted on the ribbon. Wha am I doing wrong ?
private void MainForm_Paint(object sender, PaintEventArgs e)
{
System.Drawing.Graphics formGraphics = this.CreateGraphics();
string drawString = "Sample Text";
System.Drawing.Font drawFont = new System.Drawing.Font("Arial", 16);
System.Drawing.SolidBrush drawBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Black);
float x = 400;
float y = 84;
System.Drawing.StringFormat drawFormat = new System.Drawing.StringFormat();
formGraphics.DrawString(drawString, drawFont, drawBrush, x, y, drawFormat);
drawFont.Dispose();
drawBrush.Dispose();
formGraphics.Dispose();
}