Hide

SftOptions 1.0 - ActiveX Options Control

Display
Print

SftOptionsEntry.Picture Property

Defines the picture used for the entry.

Syntax

Get

VB.NETrefPictureObj = object.Picture As stdole.IPictureDisp
VBSet refPictureObj = object.Picture As IPictureDisp
C#.NETstdole.IPictureDisp refPictureObj = object.Picture;
VC++IPictureDisp* refPictureObj = object->GetPicture();
CHRESULT object->get_Picture(IPictureDisp** refPictureObj);

Put

VB.NETobject.let_Picture(ByVal refPictureObj As stdole.IPictureDisp)
VBobject.Picture = refPictureObj As IPictureDisp
C#.NETvoid object.let_Picture(stdole.IPictureDisp refPictureObj);
VC++void object->PutPicture(IPictureDisp* refPictureObj);
CHRESULT object->put_Picture(IPictureDisp* refPictureObj);

PutRef

VB.NETobject.Picture = refPictureObj As stdole.IPictureDisp
VBSet object.Picture = refPictureObj As IPictureDisp
C#.NETstdole.IPictureDisp object.Picture = refPictureObj;
VC++void object->PutRefPicture(IPictureDisp* refPictureObj);
CHRESULT object->putref_Picture(IPictureDisp* refPictureObj);

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 Entry.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


Last Updated 08/13/2020 - (email)
© 2024 Softel vdm, Inc.