ArcPad Scripting Object Model
ShowColor Method
See Also  Example  Send comments on this topic.
DefColor
 Optional. An OLE_COLOR that represents the default color.
Flags
CommonDialog Object : ShowColor Method

Glossary Item Box

Description

Displays a color picker dialog box.

Syntax

object.ShowColor ( [DefColor] )

Parameters

DefColor
 Optional. An OLE_COLOR that represents the default color.
Flags

Return Type

Variant

Remarks

The ShowColor method returns the selected color. DefaultColor is an OLE_COLOR representing the color that is initially selected. You can use any of the built-in color constants to specify a default color. Black is initially selected if no value is supplied. [Optional].

Example

Allows the user to select a color, displays the RGB values of the selected color, and displays a rectangle filled with selected color on the screen.
ShowColor Example (VBScript)Copy Code
Sub SymbolColor
      'Create a symbol object
      Dim pSymbol
      Set pSymbol = Application.CreateAppObject("Symbol")
      
      'Construct a default color of purple
      Dim lngDefaultColor
      lngDefaultColor = pSymbol.MakeColor(255,0,255)
      
      'Get a color from the user, using purple as the default
      Dim varSelColor
      varSelColor = CommonDialog.ShowColor (lngDefaultcolor)
      
      'Display RGB components of the selected color
      MsgBox "RGB components of your selected color:" & vbCrlf & _
               "Red: " & pSymbol.GetRed(varSelColor) & vbCrlf & _
               "Green: " & pSymbol.GetGreen(varSelColor) & vbCrlf & _
               "Blue: " & pSymbol.GetBlue(varSelColor),vbInformation,"RGB"
      
      'Create a rectangle to draw on the screen
      Dim pRect
      Set pRect = Map.Extent
      pRect.ScaleRectangle 0.3
      
      'Set the symbol's fill color to the color selected by the user
      pSymbol.FillColor = varSelColor
      pSymbol.FillStyle = 0
      
      'Draw the rectangle
      Map.DrawShape pRect, pSymbol
End Sub

See Also

© 2013 All Rights Reserved.