CyDAS General Controls: Class ImageMapControl
The class ImageMapControl provides a click sensitive map for windows desktop applications. For more information on its deployment, see overview of the image map.
Overview
- Constructors
- Interfaces
- Enumerations
- Properties
- Methods
- Events
- Interaction with other classes
- Internal Processing
ImageMapControl |
New() |
AutoNavigate: Boolean |
AutoSize: Boolean |
Bitmap: System.Drawing.Bitmap {readonly} |
Data: ImageMapData |
AreaSelected(ByRef sender As Object, ByRef e As ImageMapAreaSelectedEventArgs) |
Programming Language
- Microsoft Visual Basic .Net.
Availability
- Copyrighted but free software under the GNU Public License.
- Binaries and source code can be obtained from the Download section.
Constructors
Public Sub New()
Instantiates a new ImageMapControl object. There are no parameters for this function. The constructor call andits coding will normally happen automatically within the windows form designer.
Interfaces
Inherits
System.Windows.Forms.UserControlEnumerations
The class does not provide enumerations.Properties
AutoNavigate As Boolean
Determines if the control will executed the command given in the Command property of a clicked ImageMapArea automatically or instead raise an AreaSelected event.Property Value
- true, if the control automatically executes the command linked to an area when it is clicked;
- false, if the control raises an AreaSelected event instead.
Remarks
- The commands are evaluated by "System.Diagnostics.Process.Start". Exceptions occuring when opening the application are suppressed.
- The default value is true.
- In the designer, the property is listed in the section "Behavior".
AutoSize As Boolean
Determines if the control is resized to fit the size of the image.Property Value
- true, if the control automatically adjusts to the image.
- false, otherwise.
Remarks
-
If false, the image will be resized to fit the control.
Its height to width relation is not preserved but adjusted to the control.
There is no need to recalculate the coordinates of the area elements of the map, the coordinates will be internally re-transformed. - The default value is true.
- In the designer, the property is listed in the section "Behavior".
ReadOnly Property Bitmap As System.Drawing.Bitmap
Gets the bitmap associated with the image map data.Property Value
- the bitmap associated with the image map data.
Remarks
- This property is a short cut to Data.Batmap.
- It is read-only because changing of the bitmap after setting the Data property could lead to unpredicatable behavior.
Data As ImageMapData
An ImageMapData object describing the image map including its image and its area elements.Property Value
- an ImageMapData object describing the image map
Remarks
- Changing the property value causes the control to refresh.
- Depending on the AutoSize property, it may also be resized.
- It is advisable not to exchange the Bitmap of the ImageMapData object later because some internal values are calculated from the contained bitmap when the Data property is set. Unexpected behavior could be caused.
- The property cannot be accessed in the designer.
Methods
The class does not provide public methods.Events
AreaSelected(ByRef sender As Object, ByRef e As ImageMapAreaSelectedEventArgs)
Occurs when an area of the image map was clicked and the AutoNavigate property of the ImageMapControl is set to false.Parameters
- sender: this instance of Multi-Select-Combobox Control
- e: the ImageMapAreaSelectedEventArgs contain a reference to the ImageMapArea object representing the clicked area.
Remarks
- The event is not raised when the AutoNavigate property is set to true.
- This is the default event of the ImageMapControl.
Interaction with other classes
Classes used by ImageMapControl
The ImageMapData class is the central data container of the ImageMapControl.Internal Processing
ImageMapControl_Click(...) Handles MyBase.Click
If the image map is clicked, the control determines the mouse position and, if AutoSize is false, calculates the position in the original image map. Thereafter, the control inquires from the Data property the clicked ImageMapArea object (ImageMapData.getSelectedArea()).
If an area was found for this position, the next steps depend on the AutoNavigate property. If it is false, the control will raise an AreaSelected event. Otherwise, it will have windows evaluate the Command property of the area element and start the appropriate program; errors occuring during this windows processing are suppressed.
ImageMapControl_MouseMove(...) Handles MyBase.MouseMove
If the mouse is positioned over the image map, the control determines the mouse position and, if AutoSize is false, calculates the position in the original image map. Thereafter, the control inquires from the Data property the clicked ImageMapArea object (ImageMapData.getSelectedArea()).
If an area was found for this position, the tooltip text of the control is set to the Title property of the area. Otherwise, the tooltip is removed.