SftOptions 1.0

SftOptionsEntry.Picture Property

Softel vdm, Inc.

Defines the picture used for the entry.

Syntax       

Get

VB.NET

refPictureObj = object.Picture  As stdole.IPictureDisp

VB

Set refPictureObj = object.Picture  As IPictureDisp

C#.NET

stdole.IPictureDisp refPictureObj = object.Picture;

VC++

IPictureDisp* refPictureObj = object->GetPicture();

C

HRESULT object->get_Picture(IPictureDisp** refPictureObj);

Delphi

refPictureObj := object.Picture  : IPictureDisp;

Put

VB.NET

object.let_Picture(ByVal refPictureObj As stdole.IPictureDisp)

VB

object.Picture = refPictureObj  As IPictureDisp

C#.NET

void object.let_Picture(stdole.IPictureDisp refPictureObj);

VC++

void object->PutPicture(IPictureDisp* refPictureObj);

C

HRESULT object->put_Picture(IPictureDisp* refPictureObj);

Delphi

procedure object._Set_Picture(refPictureObj : IPictureDisp);

PutRef

VB.NET

object.Picture = refPictureObj  As stdole.IPictureDisp

VB

Set object.Picture = refPictureObj  As IPictureDisp

C#.NET

stdole.IPictureDisp object.Picture = refPictureObj;

VC++

void object->PutRefPicture(IPictureDisp* refPictureObj);

C

HRESULT object->putref_Picture(IPictureDisp* refPictureObj);

Delphi

object.Picture := refPictureObj  : IPictureDisp;

object

A SftOptionsEntry object.

refPictureObj

Defines the picture used for the entry.

Comments

The Picture property defines the picture used for the entry.  The image is used for Topic and Ellipse entries only (see SftOptionsEntry.Type).

If the Picture object refPictureObj defines a bitmap, the top, left pixel of the bitmap must contain the bitmap's background color. This color will be replaced throughout the bitmap with the actual background (see Bitmap Transparency).

The images can be of varying sizes. The entry height is automatically adjusted so images and text are never clipped vertically.

To remove an individual entry picture, set the property to Nothing (0, null, NULL), which will restore the default image defined using the DefaultTopicPicture property.

Using PutRef (see Syntax above) the control will use the reference to the Picture object. If the Picture object is later changed, this will also affect the image used by the control. Using Put instead causes the control to create a copy of the Picture object. If the Picture object is later changed, this will not affect the image used by the control as it uses a copy of the object. Because of the additional overhead and the increased resource use of Put, PutRef is the preferred method.

Example (VB.NET)

' A picture box is used to hold the bitmap for the topic's Picture property. A 
' suitable bitmap has been defined in the picture box using its Image property.
AxSftOptions1.Add("", "Topic1", "Sample Topic", SftOptionsEntryConstants.entrySftOptionsTopic, "", "", Nothing, "", "", "", "")
AxSftOptions1.Add("", "Topic2", "Sample Topic", SftOptionsEntryConstants.entrySftOptionsTopic, "", "", Nothing, "", "", "", "")
AxSftOptions1.get_Entry("Topic2").Picture = OLECvt.ToOLE_IPictureDisp(PictureBox1.Image)
AxSftOptions1.InitializationComplete()

Example (VB)

' A picture box is used to hold the bitmap for the topic's Picture property. A
' suitable bitmap has been defined in the picture box using its Picture property.
SftOptions1.Add "", "Topic1", "Sample Topic", entrySftOptionsTopic, "", "", _
    Nothing, "", "", "", ""
SftOptions1.Add "", "Topic2", "Sample Topic", entrySftOptionsTopic, "", "", _
    Nothing, "", "", "", ""
SftOptions1.Entry("Topic2").Picture = Picture1.Picture
SftOptions1.InitializationComplete

Example (C#.NET)

// A picture box is used to hold the bitmap for the topic's Picture property. A 
// suitable bitmap has been defined in the picture box using its Image property.
axSftOptions1.Add("", "Topic1", "Sample Topic", SftOptionsEntryConstants.entrySftOptionsTopic, "", "", null, "", "", "", "");
axSftOptions1.Add("", "Topic2", "Sample Topic", SftOptionsEntryConstants.entrySftOptionsTopic, "", "", null, "", "", "", "");
axSftOptions1.get_Entry("Topic2").Picture = OLECvt.ToOLE_IPictureDisp(pictureBox1.Image);
axSftOptions1.InitializationComplete();

Example (VC++)

ISftOptionsPtr vOptions1 = m_Options1.GetControlUnknown();

IPictureDispPtr pIPictureDisp;
PICTDESC PictDesc;
PictDesc.cbSizeofstruct = sizeof(PICTDESC);
PictDesc.picType = PICTYPE_ICON;
PictDesc.icon.hicon = LoadIcon(NULL, MAKEINTRESOURCE(IDI_APPLICATION));
HRESULT hr = OleCreatePictureIndirect(&PictDesc, IID_IPictureDisp, TRUE, (void**)&pIPictureDisp);
ASSERT(SUCCEEDED(hr));

vOptions1->Add(_bstr_t(""), _bstr_t("Topic1"), _bstr_t("Sample Topic"), 
    entrySftOptionsTopic, _bstr_t(""), _bstr_t(""), NULL,
    _bstr_t(""), _bstr_t(""), _bstr_t(""), _bstr_t(""));
vOptions1->Add(_bstr_t(""), _bstr_t("Topic2"), _bstr_t("Sample Topic"), 
    entrySftOptionsTopic, _bstr_t(""), _bstr_t(""), NULL,
    _bstr_t(""), _bstr_t(""), _bstr_t(""), _bstr_t(""));

vOptions1->Entry["Topic2"]->PutRefPicture(pIPictureDisp);

vOptions1->InitializationComplete();

Example (Delphi)

// uses ActiveX
// var pic: IPictureDisp;
// A TImage control is used to hold the bitmap for the topic's Picture property. A suitable
// bitmap has been defined in the image control using its Picture property.
SftOptions1.Add('', 'Topic1', 'Sample Topic', entrySftOptionsTopic, '', '', nil, '', '', '', '');
SftOptions1.Add('', 'Topic2', 'Sample Topic', entrySftOptionsTopic, '', '', nil, '', '', '', '');
GetOlePicture(Image1.Picture, pic);
SftOptions1.Entry['Topic2'].Picture := pic;
SftOptions1.InitializationComplete();

See Also  SftOptionsEntry Object | Object Hierarchy


Feedback / comments / error reports for this topic
© 2002 - Softel vdm, Inc. - www.softelvdm.com