共用方式為


background.addTextObject method

[The Windows Gadget Platform/Sidebar is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. ]

Adds a g:text element to the g:background element.

Syntax

iRetVal = background.addTextObject(
  strText,
  strFont,
  intFontSize,
  strColor,
  intXOffset,
  intYOffset
)

Parameters

strText [in]

A string that specifies the text to be added.

strFont [in]

A string that specifies the font name in which to render the text.

intFontSize [in]

An integer that specifies the absolute value for the point-size in which to render the text. This value is limited to an integer; there are no overload methods that allow the use of alternate HTML-standard values such as absolute sizes (xx-small | x-small | small | medium | large | x-large | xx-large), relative sizes (larger | smaller), percentages, or other length specifications (cm, mm, in, pc, px, em, or ex).

strColor [in]

A string that specifies the color of the text.

intXOffset [in]

An integer specifying the horizontal position of the text relative to the top-left corner of the background.

intYOffset [in]

An integer specifying the vertical position of the image relative to the top-left corner of the background.

Remarks

The default font and size is 12-point Times New Roman if the specified font and size are not available on the system.

Examples

The following example demonstrates how to add text to a gadget background.

\\ imgBackground is the value of the 'id' attribute for the g:background element.
var txtShadow = imgBackground.addTextObject("test", "Verdana", 25, "Red", 50, 50);

Requirements

Minimum supported client
Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2008 [desktop apps only]
End of client support
Windows 7
End of server support
Windows Server 2008
IDL
Sidebar.idl
DLL
Sidebar.Exe (version 1.00 or later)

See also

Reference

background

text