共用方式為


image 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 an image element to display in a gadget.

Members

The image object has these types of members:

Methods

The image object has these methods.

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

Properties

The image object has these properties.

Property Access type Description
blur
Read/write
Gets or sets the level of blur applied to the g:image element.
brightness
Read/write
Gets or sets the brightness of the g:image element.
height
Read/write
Gets or sets the height of the g:image element.
left
Read/write
Gets or sets the number of pixels from the left edge of the gadget to position the g:image element.
opacity
Read/write
Gets or sets the opacity of the g:image element.
rotation
Read/write
Gets or sets the degree of rotation applied to the g:image element.
softEdge
Read/write
Gets or sets the amount of edge softening that is applied to the g:image element.
src
Read/write
Gets or sets the image file used by the g:image element.
top
Read/write
Gets or sets the number of pixels from the top edge of the gadget to position the g:image element.
width
Read/write
Gets or sets the width of the g:image element.

Remarks

The Windows Sidebar supports JPEG, bitmap (BMP), Graphics Interchange Format (GIF), and Portable Network Graphics (PNG) image types. Only PNG supports alpha channel transparency.

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

[!Caution]
Other than g:background, avoid images that render to the absolute edges of a gadget. In high-DPI, rounding errors can cause a magenta fringe around the border of the gadget.

This element is a $disp element.

This element requires a closing tag.

Examples

This example shows how to create a g:image element in a gadget script file that exposes all g:image members.

\\ imgBackground is the value of the 'id' attribute for the g:background element.
var imgGlow = imgBackground.addImageObject("file://img.png", 0, 0);

This example shows how to declare a g:image element in the gadget HTML file that exposes a subset of g:image members (similar funtionality to g:background).

<g:image src="..\aerologo.png" id="imgTest" onclick="changeText()" />

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)