Scf.Clr Method

Creates a Simple Content Format Clr element.

Namespace: Microsoft.SideShow.SimpleContentFormat
Assembly: Microsoft.SideShow (in microsoft.sideshow.dll)

Usage

Syntax

'Declaration
Public Shared Function Clr ( _
    color As Color, _
    ParamArray content As Object() _
) As ScfElement
public static ScfElement Clr (
    Color color,
    params Object[] content
)
public:
static ScfElement^ Clr (
    Color color, 
    ... array<Object^>^ content
)
public static ScfElement Clr (
    Color color, 
    Object[] content
)
public static function Clr (
    color : Color, 
    ... content : Object[]
) : ScfElement

Parameters

  • color
    Indicates the color of the text.
  • content
    An array of ScfElement objects that make up this element's content.

Return Value

An ScfElement object that represents a color.

Example

This example code shows how to specify an alternate color to apply to Scf Content if a connected device cannot display the original specified color. If the original specified color cannot be used, then the device will use the closest color to the one specified by the Clr method. If a Clr is not applied, and the device cannot display the original specified color, then it will use the device's default color to display content.

private static void SampleClr()
{
    // Set the gadget's GUID.
    Guid gadgetId = new Guid("{0530B726-F6D5-4a66-900E-3C7673316F3B}");

    // Add the gadget's registry subkey and values.
    GadgetRegistration.Register(
        false,                           // Register gadget for current user only
        gadgetId,                        // Guid for the registry subkey
        ScfSideShowGadget.ScfEndpointId, // Endpoints registry value
        "Example SideShow gadget",       // FriendlyName registry value
        null,                            // StartCommand registry value
        null,                            // Icon registry value, this gadget will use the generic gadget icon.
        false,                           // OnlineOnly registry value
        GadgetCachePolicies.KeepNewest,  // CachePolicy registry value
        null);

    // Construct a Simple Content Format SideShow gadget for the gadget's Guid.
    using (ScfSideShowGadget gadget = new ScfSideShowGadget(gadgetId))
    {
        // Add Glance content.
        gadget.AddGlanceContent(
           String.Format("Some glance content"));

        // Set element ids;
        int mainMenuPageId = 1;
        int page1Id = 2;
        int menuItem1Id = 3;

        // The menu page. 
        string content =
            Scf.Body(
                Scf.Menu(mainMenuPageId, "Main Menu", ScfSelectAction.Target,
                    // If the device cannot display blue violet text, then it should display the closest color to blue that it is capable of.
                    Scf.Clr(Color.Blue,    
                        Scf.Txt(ScfAlign.Left, true, Color.BlueViolet, "Some left aligned text."),
                        Scf.Item(menuItem1Id, "Navigate to content page."))));
        gadget.AddContent(content);

        // The content page.
        string page1 = Scf.Body(
            // If the device cannot display blue violet text, then it should display the closest color to blue that it is capable of.
            Scf.Clr(Color.Blue,
                Scf.Content(page1Id, "Page 1 Title",
                    Scf.Txt(ScfAlign.Left, true, Color.BlueViolet, "Some left aligned text."),
                    Scf.Div(),
                    Scf.Txt(ScfAlign.Left, true, Color.BlueViolet, "Some right aligned text."))));
        gadget.AddContent(page1);
    }
}

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

Windows Vista Home Premium, Windows Vista Business, Windows Vista Enterprise, Windows Vista Ultimate

Target Platforms

Windows Vista Home Premium, Windows Vista Business, Windows Vista Enterprise, Windows Vista Ultimate

See Also

Reference

Scf Class
Scf Members
Microsoft.SideShow.SimpleContentFormat Namespace