Scf.Txt Method

Creates a Simple Content Format Txt element.

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

Usage

Syntax

'Declaration
Public Shared Function Txt ( _
    align As ScfAlign, _
    txtWrap As Boolean, _
    color As Nullable(Of Color), _
    ParamArray content As Object() _
) As ScfElement
public static ScfElement Txt (
    ScfAlign align,
    bool txtWrap,
    Nullable<Color> color,
    params Object[] content
)
public:
static ScfElement^ Txt (
    ScfAlign align, 
    bool txtWrap, 
    Nullable<Color> color, 
    ... array<Object^>^ content
)
public static ScfElement Txt (
    ScfAlign align, 
    boolean txtWrap, 
    Nullable<Color> color, 
    Object[] content
)
public static function Txt (
    align : ScfAlign, 
    txtWrap : boolean, 
    color : Nullable<Color>, 
    ... content : Object[]
) : ScfElement

Parameters

  • align
    Indicates the alignment of the text.
  • txtWrap
    Indicates whether the text is allowed to wrap.
  • color
    Indicates the color of the text.
  • content
    An array of ScfElement objects that make up this content element’s content.

Return Value

Returns an ScfElement object that represents a text element.

Example

This example code shows how the Txt method can be used to add formatted text elements to Dialog, Content, and Menu pages.

private static void SampleTxt()
{
    // 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 page2Id = 3;

        // The menu page. 
        string content =
            Scf.Body(
                Scf.Menu(mainMenuPageId, "Main Menu", ScfSelectAction.Target,
                    // This red, left aligned, wrapping text will be display after the menu title and above the menu items.
                    Scf.Txt(ScfAlign.Left, true, Color.Red, "Some left aligned text."),
                    Scf.Item(page1Id, "Navigate to the content page."),
                    Scf.Item(page2Id, "Nvaigate to the dialog page.")
                    )
                );
        gadget.AddContent(content);

        // The content page.
        string page1 = Scf.Body(
         Scf.Content(page1Id, "Page 1 Title",
            // Left aligned, wrapping, black text.
            Scf.Txt(ScfAlign.Left, true, Color.Black, "Some left aligned text."),
            Scf.Div(),
            // Right aligned, wrapping text that will use the device's default color.
            Scf.Txt(ScfAlign.Right, false, null, "Some right aligned text.")));
        gadget.AddContent(page1);

        // The dialog page.
        string page2 = Scf.Body(
            Scf.Dialog(page2Id, "Dialog Page Options.",
            // This black, left aligned, wrapping text will display below the dialog page title. 
            Scf.Txt(ScfAlign.Left, true, Color.Black, "Dialog page text."),
            // This button navigates to the content page.
            Scf.Btn(DeviceButton.Enter, "Page 1", page1Id),
            // This button navigates to the main menu.
            Scf.Btn(DeviceButton.Back, "Main Menu.", mainMenuPageId)
            ));
        gadget.AddContent(page2);
    }
} 

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