Assigns the passed ImageTTDatasource-object to the extended property provided to a specific control.[Visual Basic] <ExtenderProvidedProperty()> _ Public Sub SetImageToolTip( _ ByVal acontrol As Control, _ ByVal ds As ImageTTDataSource)[C#] [ExtenderProvidedProperty()] public void SetImageToolTip( Control acontrol, ImageTTDataSource ds );
The target-control. The passed ImageTTDatasource-object is attached to the extended property provided to this control by the tooltip-component.
The new ImageTTDatasource-object to attach to the extended property of acontrol.
This method assigns the passed ImageTTDatasource-object (ds) to the extended property provided to the specified control (acontrol) 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 acontrol.
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 assign a new or another instance of an ImageTTDatasource-object to the extended property 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 assign a new value to this property by code as to 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 SetImageToolTip() comes into play. SetImageToolTip() tells the tooltip-component to set the passed ImageTTDatasource-object (ds) as new value for the property provided to the specified control (acontrol).
The following example shows how this could look in code:
'Create a new ImageTTDataSource Dim myToolTipDS As ImageTTDataSource
myToolTipDS = New ImageTTDataSource
'We assign new content (an image retrieved from
myToolTipDS.Image = GetImage("ChangeCartridge")
'And - because we know that this image contains'interesting details - we have to make sure that it is 'displayed with an appropriate size. For this, 'we override the DefaultWidth defined by the 'tooltip-component with an adequate value.
myToolTipDS.Override.DefaultWidth = 480
'Finally we can assign the new ImageTTDataSource-object
'to the extended property provided to lblChangeCartridge