共用方式為


text object

[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. ]

Specifies a text element to display in a gadget.

Members

The text object has these types of members:

Methods

The text object has these methods.

Method Description
addGlow Adds a glow effect to a g:text element.
addShadow Adds a shadow effect to a g:text element.

Properties

The text object has these properties.

Property Access type Description
align
Read/write
Gets or sets the text alignment.
blur
Read/write
Gets or sets the level of blur applied to the g:text element.
brightness
Read/write
Gets or sets the brightness of the g:text element.
color
Read/write
Gets or sets the text color.
font
Read/write
Gets or sets the font name.
fontsize
Read/write
Gets or sets the font size.
height
Read/write
Gets or sets the height of the g:text element.
left
Read/write
Gets or sets the number of pixels from the left edge of the gadget to position the g:text element.
opacity
Read/write
Gets or sets the opacity of the g:text element.
rotation
Read/write
Gets or sets the degree of rotation applied to the g:text element.
top
Read/write
Gets or sets the number of pixels from the top edge of the gadget to position the g:text element.
value
Read/write
Gets or sets the value of the g:text element.
width
Read/write
Gets or sets the width of the g:text element.

Remarks

This element can be declared in the gadget HTML file or created with the addTextObject method from a script file. However, if the element is declared in the HTML file, it will not be accessible from script and will affect the gadget element layout rather than being part of the background.

[!Important]
For Windows 7, when the new <autoscaleDPI> element of the gadget manifest is set to true (for high-DPI support) gadgets should explicitly specify a text size.

This element is not rendered.

This element requires a closing tag.

Examples

This example shows how to declare a g:text element in the gadget HTML file.

<g:text id="txtTest">test</g:text>

This example shows how to create a g:text element in a gadget script file.

\\ 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)