IPicture  15MMZYC

The IPicture interface manages a picture object and its properties. Picture objects provide a language-neutral abstraction for bitmaps, icons, and metafiles. As with the standard font object, the system provides a standard implementation of the picture object. Its primary interfaces are IPicture and IPictureDisp1_JKP8A, the latter being derived from IDispatch to provide access to the picture s properties through Automation. A picture object is created with OleCreatePictureIndirectK14E0..

The picture object also supports the outgoing interface IPropertyNotifySink7DIPYB, so a client can determine when picture properties change. Since the picture object supports at least one outgoing interface, it also implements IConnectionPointContainer1CDHQR and its associated interfaces for this purpose.

The picture object also supports IPersistStream4KTV_NZ so it can save and load itself from an instance of IStream8MD3QE. An object that uses a picture object internally would normally save and load the picture as part of the object s own persistence handling. The function OleLoadPictureBR7DJ0 simplifies the creation of a picture object based on stream contents.

When to Implement

Typically, you use the OLE-provided picture object, which provides the IPicture and IPictureDisp interfaces for you. The IPicture interface is the primary interface implemented by the OLE-provided picture object. It allows the caller to manage picture properties and to use that picture in graphical rendering. Each property in the IPicture interface includes a get_PropertyName method if the property supports read access and a put_PropertyName method if the property supports write access. Most of the properties support only read access with the exception of hPal.


Property


Type

Access Allowed


Description

HANDLE

OLE_HANDLE (int)

R

The Windows GDI handle of the picture

hPal

OLE_HANDLE (int)

RW

The Windows handle of the palette used by the picture

Type

short

R

The type of picture (see below)

Width

OLE_XSIZE_HIMETRIC (long)

R

The width of the picture

Height

OLE_YSIZE_HIMETRIC (long)

R

The height of the picture

CurDC

HDC

R

The current device context

KeepOriginalFormat

BOOL

RW

If TRUE, the picture object maintains the entire original state of the picture in memory. If FALSE, any state not applicable to the user s machine is discarded

Attributes

DWORD

R

Miscellaneous bit attributes of the picture (see below)

 

When to Use

Use this interface to change the properties of a picture object.

Methods in Vtable Order

IUnknown Methods

Description

QueryInterface2Y54585

Returns pointers to supported interfaces.

AddRef1SHW0SS

Increments reference count.

ReleaseDUW01A

Decrements reference count.

 

IPicture Methods

Description

get_Handle1ONDWRU

Returns the Windows GDI handle of the picture managed within this picture object.

get_HpalHDSUFM

Returns a copy of the palette currently used by the picture object.

get_TypeHE53UF

Returns the current type of the picture.

get_Width1ALZ_7

Returns the current width of the picture in the picture object.

get_Height349WYRY

Returns the current height of the picture in the picture object.

Render2Z.15_

Draws the specified portion of the picture onto the specified device context, positioned at the specified location.

set_Hpal8DWXBV

Sets the current palette of the picture.

get_CurDCXY.X2

Returns the current device context into which this picture is selected.

SelectPicture212ZV95

Selects a bitmap picture into a given device context, returning the device context in which the picture was previously selected as well as the picture s GDI handle.

get_KeepOriginalFormat2._7HAP

Returns the current value of the picture object s KeepOriginalFormat property.

put_KeepOriginalFormat15VKIV4

Sets the picture object s KeepOriginalFormat property.

PictureChangedRK0SUT

Notifies the picture object that its picture resource changed.

SaveAsFileEAJBNX

Saves the picture s data into a stream in the same format that it would save itself into a file.

get_Attributes51WBLN

Returns the current set of the picture s bit attributes.

 

See Also

IPicture - Ole Implementation, IPictureDisp