home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / controls / geticon1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1993-05-16  |  4.2 KB  |  142 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "Subdirectory Icon Viewer"
  4.    ClientHeight    =   4020
  5.    ClientLeft      =   1425
  6.    ClientTop       =   1515
  7.    ClientWidth     =   7365
  8.    Height          =   4425
  9.    Left            =   1365
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   4020
  12.    ScaleWidth      =   7365
  13.    Top             =   1170
  14.    Width           =   7485
  15.    Begin CommandButton Command3 
  16.       Caption         =   "End"
  17.       Height          =   615
  18.       Left            =   2760
  19.       TabIndex        =   2
  20.       Top             =   3240
  21.       Width           =   1695
  22.    End
  23.    Begin CommandButton Command2 
  24.       Caption         =   "Show Icons"
  25.       Enabled         =   0   'False
  26.       Height          =   615
  27.       Left            =   4800
  28.       TabIndex        =   1
  29.       Top             =   3240
  30.       Width           =   2295
  31.    End
  32.    Begin CommandButton Command1 
  33.       Caption         =   "Choose a subdirectory"
  34.       Height          =   615
  35.       Left            =   240
  36.       TabIndex        =   0
  37.       Top             =   3240
  38.       Width           =   2175
  39.    End
  40.    Begin Label Label1 
  41.       Alignment       =   2  'Center
  42.       Caption         =   "Click on an Icon to See Its Path"
  43.       Height          =   255
  44.       Left            =   1920
  45.       TabIndex        =   3
  46.       Top             =   2880
  47.       Visible         =   0   'False
  48.       Width           =   3135
  49.    End
  50.    Begin Image Image1 
  51.       Height          =   495
  52.       Index           =   0
  53.       Left            =   0
  54.       Top             =   0
  55.       Width           =   495
  56.    End
  57. Option Explicit
  58. Dim pic_count As Integer
  59. Const DEFAULT = 0        ' 0 - Default
  60. Const ARROW = 1          ' 1 - Arrow
  61. Const CROSSHAIR = 2      ' 2 - Cross
  62. Const IBEAM = 3          ' 3 - I-Beam
  63. Const ICON_POINTER = 4   ' 4 - Icon
  64. Const SIZE_POINTER = 5   ' 5 - Size
  65. Const SIZE_NE_SW = 6     ' 6 - Size NE SW
  66. Const SIZE_N_S = 7       ' 7 - Size N S
  67. Const SIZE_NW_SE = 8     ' 8 - Size NW SE
  68. Const SIZE_W_E = 9       ' 9 - Size W E
  69. Const UP_ARROW = 10      ' 10 - Up Arrow
  70. Const HOURGLASS = 11     ' 11 - Hourglass
  71. Const NO_DROP = 12       ' 12 - No drop
  72. Sub clear_icons ()
  73.     Dim i As Integer
  74.     'Set the image control array back to just 1 control
  75.     For i = 1 To pic_count
  76.     Unload image1(i)
  77.     Next i
  78.     image1(0).Visible = False
  79.     pic_count = 0
  80. End Sub
  81. Sub Command1_Click ()
  82.     clear_icons
  83.     form2.Show
  84. End Sub
  85. Sub Command2_Click ()
  86.     Dim PictureName As String
  87.     Dim i As Integer, rc As Integer
  88.     Dim mytop As Integer, myleft As Integer
  89.     Dim widthdelta As Integer, heightdelta As Integer
  90.     widthdelta = 600: heightdelta = 500
  91.     mytop = 100: myleft = -widthdelta + 100
  92.     clear_icons
  93.     'Next, pull the files into the image controls.
  94.     screen.MousePointer = HOURGLASS
  95.     pic_count = form2.File1.ListCount - 1
  96.     For i = 0 To pic_count
  97.     If i <> 0 Then Load image1(i)
  98.     image1(i).Left = myleft
  99.     If image1(i).Left > Form1.ScaleWidth - 2 * widthdelta Then
  100.         myleft = 100
  101.         mytop = mytop + heightdelta
  102.     Else
  103.         myleft = myleft + widthdelta
  104.     End If
  105.     image1(i).Move myleft, mytop
  106.     PictureName = form2.Dir1.Path
  107.     If Right$(PictureName, 1) <> "\" Then
  108.         PictureName = PictureName + "\"
  109.     End If
  110.     form2.File1.ListIndex = i
  111.     PictureName = PictureName + form2.File1
  112.     image1(i).Picture = LoadPicture(PictureName)
  113.     Next i
  114.     'Now that they're all in memory, show 'em.
  115.     For i = 0 To pic_count
  116.     image1(i).Visible = True
  117.     Next i
  118.     screen.MousePointer = DEFAULT
  119.     command2.Enabled = False
  120.     label1.Visible = True
  121. End Sub
  122. Sub Command3_Click ()
  123.     End
  124. End Sub
  125. Sub Form_Load ()
  126.     Load form2
  127.     pic_count = 0
  128. End Sub
  129. Sub Image1_Click (index As Integer)
  130.     Dim PictureName As String
  131.     PictureName = form2.Dir1.Path
  132.     If Right$(PictureName, 1) <> "\" Then
  133.     PictureName = PictureName + "\"
  134.     End If
  135.     form2.File1.ListIndex = index
  136.     PictureName = PictureName + form2.File1
  137.     MsgBox UCase$(PictureName), 0, "The name of that file is"
  138. End Sub
  139. Sub Picture1_DragDrop (source As Control, X As Single, Y As Single)
  140.     source.Visible = False
  141. End Sub
  142.