GetRubberStampItem Example VB

This example uses the GetRubberStampMenuItems method to populate a list box with the names of the rubber stamps that are currently available.  It also uses the GetRubberStampItem method to obtain the item number of the stamp that is currently selected.

You can use these methods when designing a custom tool palette to let users select the type of rubber stamp they want to use.

Private Sub cmdStamps_Click()
    'Get the names of all available rubber stamps and
    'write them to a listbox.  This could be used when
    'designing a custom tool palette so that when the
    'user clicks on the stamp icon, they could then
    'select the desired stamp from a list.
    Dim strAllStamps As String
    Dim strStampName As String
    Dim intCurStamp As Integer
    Dim intStartPos As Integer
    Dim intEndPos As Integer
    
    'Get the stamp list.
    strAllStamps = frmMain.ImgEdit1.GetRubberStampMenuItems
    'Load the list box.
    Load frmStampList
   
    intStartPos = 0
    intEndPos = 1
    
    'Loop to parse stamps
    Do While intEndPos <> 0
      'Find location of line feed characters which separate
      'stamp names.
      intEndPos = InStr(intStartPos + 1, strAllStamps, vbLf)
      'If intEndPos is 0 we are at the end of the string
      If intEndPos = 0 Then Exit Do
      'Retrieve text up to the line feed character
      strStampName = Mid(strAllStamps, (intStartPos + 1), (intEndPos - intStartPos - 1))
      frmStampList.List1.AddItem strStampName
      intStartPos = intEndPos
    Loop
    
    'Highlight the stamp that is the currently selected stamp.  This
    'will be the first stamp in the list if none have been selected;
    'otherwise it will be the most recently selected stamp.
    intCurStamp = frmMain.ImgEdit1.GetRubberStampItem
    frmStampList.List1.ListIndex = intCurStamp
        
    frmStampList.Show
End Sub