ToolTipsFactory

Object Model - Additional Methods and Functions - GetImageToolTip

Returns the ImageTTDatasource-object provided as extended property to a specific control.

[Visual Basic]
<ExtenderProvidedProperty()> _ 
Public Function GetImageToolTip(ByVal acontrol As Control) As ImageTTDataSource
[C#]
[ExtenderProvidedProperty()] 
public ImageTTDataSource GetImageToolTip(
	Control acontrol
);

Parameters

acontrol

The control, for which to retrieve the provided ImageTTDatasource-object.

Description

This function is used to get access to the ImageTTDatasource-object of a specific control (acontrol) on the same form as the tooltip-component. An instance of this object is provided to each control on the same form by the ImageToolTip-component (ToolTipsFactoryImage). It is this object which holds the tooltip-content (and some other properties) used for the tooltip to be displayed for the specific control.

In the Visual Studio property-grid the access to the ImageTTDatasource-object of a specific control is seamlessly integrated in the property-list of the specific control. (See the chapter on "Provided Properties" for more information.)

To get access to the ImageTTDatasource-object of a specific control through code, things are not exactly as one would expect: The ImageTTDatasource-object is a property provided to a control by the tooltip component, and - if looking at the property-grid of the control - it definitely seems to be just a normal property of that control, but if you try to access this property by code as any other property of the control, you'll see that this is not possible, because the control does not expose such a property. Actually, the control, to which the tooltip-component provides this property, has absolutely no knowledge about this provided property, because this extended properties are managed by the providing component (in this case the ImageToolTip-component). Therefore the programmatic access to this properties has to happen through the providing component.  And that's where GetImageToolTip() comes into play. GetImageToolTip() requests and returns a reference to the ImageTTDatasource-object provided to the control (acontrol) specified in the function-call.

The following example shows how this looks in code:

 

Dim myToolTipDS As ImageTTDataSource

 

'Get a reference to the ImageTTDataSource-object

'of lblSales

myToolTipDS = Me.ImageTT.GetImageToolTip(Me.lblSales)

 

'Through this reference we get now full access to all

'properties of this object. In this example we

'use this to assign new content (a dynamically

'computed image) for the tooltip displayed

'by lblSales...

myToolTipDS.Image = CreateSalesChart()