How to use enumerated types |
|
The use of enumerated types improves the readability of your code and, thanks to the features offered by Microsoft's Intellisense, will ease the coding phase.
The following is the full list of enumerated types with their associated properties:
Enumerated type |
Corresponding properties or parameters |
enumWanErrorCodes |
LastError property |
enumWaveformTypes |
nWaveformType parameter of the BitmapViewSaveToFile and GetMinMaxPeakLevelsForRange methods |
enumTrackerCursorModes |
nCursorMode parameter of the SetTrackerCursors method |
enumAnalyzerResolutions |
nResolution field of the WANALYZER_GENERAL_SETTINGS data structure |
enumWaveformStereoModes |
nStereoVisualizationMode field of the WANALYZER_WAVEFORM_SETTINGS and WSCROLLER_SETTINGS data structures and nWaveformStereoMode parameter of the BitmapViewDrawToHdc method |
enumVolumeScales |
nAmplitudeScale field of the WANALYZER_RULERS_SETTINGS data structure |
enumMouseActions |
nAction parameter of the WaveAnalyzerMouseNotification event |
enumWaveAnalyzerRectangles |
nIdRectangle parameter of the GetRectangle method |
enumGraphicFormats |
nFormat parameter of the BitmapViewSaveToFile method |
enumHorizontalLineHeadlineType |
nHeadlineType parameter of the GraphicItemHorizontalLineAdd and GraphicItemHorizontalLineParamsSet methods |
enumHorizontalLineChannel |
nChannel parameter of the GraphicItemHorizontalLineAdd, GraphicItemHorizontalLineParamsSet methods and nChannel field of the WANALYZER_HORIZONTAL_LINE data structure |
enumGraphicItemType |
nType parameter of the GraphicItemTypeGet, GraphicItemsTypeShow and GraphicItemUniqueIdGet methods |
enumGraphicItemMaskValues |
nGraphicItemsMask parameter of the GraphicItemsMouseMoveEnable and BitmapViewGraphicItemsMaskSet methods and nGraphicItemsMask field of the WANALYZER_SCROLLBARS_SETTINGS and WSCROLLER_SETTINGS data structures |
enumWaveformLineDashStyles |
Some field of the WANALYZER_GENERAL_SETTINGS, WANALYZER_VERTICAL_LINE, WANALYZER_HORIZONTAL_LINE and WSCROLLER_SETTINGS data structures |
enumLineCaps |
Some field of the WANALYZER_GENERAL_SETTINGS, WANALYZER_VERTICAL_LINE, WANALYZER_HORIZONTAL_LINE and WSCROLLER_SETTINGS data structures |
enumLineDashCaps |
Some field of the WANALYZER_GENERAL_SETTINGS, WANALYZER_VERTICAL_LINE, WANALYZER_HORIZONTAL_LINE and WSCROLLER_SETTINGS data structures |
enumBuddyAlignment |
nAlignment field of the WANALYZER_BUDDY_PICTURE and WANALYZER_BUDDY_TEXT data structures |
enumMouseButtons |
nButton parameter of the WaveAnalyzerGraphicItemClick and WaveAnalyzerGraphicItemDblClick events |
enumWaveformSelectionMode |
nSelectionMode field of the WANALYZER_WAVEFORM_SETTINGS data structure |
enumTranspGlassType |
nTransparentGlassType field of the WANALYZER_WAVEFORM_SETTINGS and WANALYZER_SCROLLBARS_SETTINGS data structures |
enumWaveScrollbarType |
nType field of the WANALYZER_SCROLLBARS_SETTINGS data structure |
enumScrollbarWaveVisibleRangeType |
nVisibleRangeType field of the WANALYZER_SCROLLBARS_SETTINGS data structure |
enumWaveScrollerAutoUpdate |
nUpdateSpeed field of the WSCROLLER_SETTINGS data structure |
The following examples, under different development environments, show how to use enumerated types in your code.
After typing the code
If audioWaveformAnalyzerBig.LastError
press the "=" character on your keyboard: IntelliSense automatically displays the enumerated type of the LastError property
Select the enumWanErrorCodes.ERR_WAN_NOERROR value so the complete line of code will be:
If audioWaveformAnalyzerBig.LastError = enumWanErrorCodes.ERR_WAN_NOERROR Then
' do something
...
Else
' do something else
...
End If
This environment requires a couple of additional lines of code to make use of Intellisense. First, you must add the components namespace to your code so the following line must be inserted at the beginning of the form management file:
using AudioWaveformAnalyzer;
After typing the code...
if (audioWaveformAnalyzerBig.LastError == enumWanErrorCodes
press the "==" sequence of keys followed by a blank character (space) on your keyboard: IntelliSense automatically displays the enumerated type of the LastError property
by pressing the "." (dot) character the IDE will display the list of values accepted by the property:
Select the ERR_WAN_NOERROR value so the complete line of code will be:
if (audioWaveformAnalyzerBig.LastError == enumWanErrorCodes.ERR_WAN_NOERROR)
// do something
....
else
// do something else
....