Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Elegant Ribbon Tech Support » Elegant.Ui.Label ForeColor question. Collapse All
Subject Author Date
Paddy Jul 20, 2010 - 3:08 AM

Hi:


I am using the Elegant.Ui.Label and also the System.Windows.Forms.GroupBox and I would like to know how I can apply the ForeColor of the Elegant.Ui.Label to the ForeColor of the System.Windows.Forms.Groupbox?


The code I am trying to use is not changing anything for me.  Any ideas?


        For Each ctrl As Control In Me.Controls

            If TypeOf ctrl Is System.Windows.Forms.GroupBox Then

                ’Take the ForeColor of the Elegant Label and apply it to the

                ’Windows Forms GroupBox ForeColor.

                ctrl.ForeColor = Elegant.Ui.Label.DefaultForeColor

            End If

        Next ctrl

Technical Support Jul 20, 2010 - 4:54 AM

Actually, the DefaultForeColor property is not part of the Elegant.Ui.Label class. It belongs to the System.Windows.Forms.Control class.

Paddy Jul 20, 2010 - 5:11 AM

If I type in Elegant.Ui.Label., intellisense gives me the property DefaultForeColor in the drop down menu.  How am I going to be able to assign the ForeColor of the Elegant.Ui.Label to the ForeColor of the System.Windows.Forms.GroupBox?

Technical Support Jul 20, 2010 - 5:34 AM

You can do that by using the following code instead:

ControlSkin skin1;
Color color = Color.Empty;
if (SkinManager.TryGetSkin("Label", out skin1))
    color = skin1.GetPaintInformation(ControlState.Normal).ForegroundColor;

Paddy Jul 20, 2010 - 2:41 PM

This code doesn’t look like VB.net and when trying to use it, I get errors of undefined values all over the place.

Technical Support Jul 21, 2010 - 4:10 AM

Here is the code in VB.NET:

Dim skin1 As ControlSkin = Nothing
        Dim color As Color = color.Empty
        If SkinManager.TryGetSkin("Label", skin1) Then
            color = skin1.GetPaintInformation(ControlState.Normal).ForegroundColor
        End If
GroupBox1.ForeColor = color