home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / galaxy2 / galaxy.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-08-07  |  6.9 KB  |  214 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "Galaxy Viewer"
  4.    ClientHeight    =   3885
  5.    ClientLeft      =   1800
  6.    ClientTop       =   2550
  7.    ClientWidth     =   4590
  8.    Icon            =   "galaxy.frx":0000
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   3885
  11.    ScaleWidth      =   4590
  12.    Begin VB.ComboBox cboSelectText 
  13.       Height          =   315
  14.       Left            =   1560
  15.       TabIndex        =   4
  16.       Top             =   1320
  17.       Width           =   2955
  18.    End
  19.    Begin VB.TextBox txtContent 
  20.       Height          =   1155
  21.       Left            =   1560
  22.       MultiLine       =   -1  'True
  23.       ScrollBars      =   2  'Vertical
  24.       TabIndex        =   3
  25.       Top             =   120
  26.       Width           =   2955
  27.    End
  28.    Begin VB.CommandButton cmdQuit 
  29.       Caption         =   "&Quit"
  30.       Height          =   615
  31.       Left            =   3480
  32.       TabIndex        =   2
  33.       Top             =   3060
  34.       Width           =   1095
  35.    End
  36.    Begin VB.CommandButton cmdAbout 
  37.       Caption         =   "&About"
  38.       Height          =   615
  39.       Left            =   3480
  40.       TabIndex        =   1
  41.       Top             =   2460
  42.       Width           =   1095
  43.    End
  44.    Begin VB.ListBox lstPlanets 
  45.       Height          =   3570
  46.       Left            =   60
  47.       TabIndex        =   0
  48.       Top             =   120
  49.       Width           =   1455
  50.    End
  51.    Begin VB.Line linAccent 
  52.       BorderColor     =   &H80000002&
  53.       BorderWidth     =   5
  54.       X1              =   60
  55.       X2              =   4560
  56.       Y1              =   3780
  57.       Y2              =   3780
  58.    End
  59.    Begin VB.Image imgLogo 
  60.       BorderStyle     =   1  'Fixed Single
  61.       Height          =   660
  62.       Left            =   3480
  63.       Picture         =   "galaxy.frx":030A
  64.       Stretch         =   -1  'True
  65.       Top             =   1740
  66.       Width           =   1065
  67.    End
  68.    Begin VB.Image imgShow 
  69.       BorderStyle     =   1  'Fixed Single
  70.       Height          =   1935
  71.       Left            =   1560
  72.       Stretch         =   -1  'True
  73.       Top             =   1740
  74.       Width           =   1815
  75.    End
  76. Attribute VB_Name = "Form1"
  77. Attribute VB_GlobalNameSpace = False
  78. Attribute VB_Creatable = False
  79. Attribute VB_PredeclaredId = True
  80. Attribute VB_Exposed = False
  81. Option Explicit
  82. Private Sub cboSelectText_Change()
  83. Dim rs 'returned string from GetInfo function
  84. Dim Choice As Long
  85. ' *** get the text of the list
  86. Choice = Form1.lstPlanets.ListIndex
  87. ' *** call the function and get the display text
  88. rs = GetInfo(Choice)
  89. ' *** display the text
  90. Form1.txtContent.Text = rs
  91. End Sub
  92. Private Sub cboSelectText_Click()
  93. Dim rs
  94. Dim Choice As Long
  95. ' *** get the text of the list
  96. Choice = Form1.lstPlanets.ListIndex
  97. ' *** call the function and get the display text
  98. rs = GetInfo(Choice)
  99. ' *** display the text
  100. Form1.txtContent.Text = rs
  101. End Sub
  102. Private Sub cmdAbout_Click()
  103. '---------------------------------
  104. 'Creates a simple About box using
  105. 'the MsgBox function.
  106. '---------------------------------
  107.     MsgBox ("Created by: Your Name Here"), , "About"
  108. End Sub
  109. Private Sub cmdQuit_Click()
  110. '---------------------------------
  111. 'Exit the program first UnLoading
  112. 'the form using UnLoad Me and then
  113. 'the End statement.
  114. '---------------------------------
  115.     Unload Me
  116.     End
  117. End Sub
  118. Private Sub Form_Load()
  119. ' *** clear the combo and list boxes
  120. Form1.lstPlanets.Clear
  121. Form1.cboSelectText.Clear
  122. '---------------------------------
  123. 'Add items to the List box using
  124. 'AddItem method.
  125. '---------------------------------
  126.     Form1.lstPlanets.AddItem "Asteroids"
  127.     Form1.lstPlanets.AddItem "Earth"
  128.     Form1.lstPlanets.AddItem "Jupiter"
  129.     Form1.lstPlanets.AddItem "Mars"
  130.     Form1.lstPlanets.AddItem "Mercury"
  131.     Form1.lstPlanets.AddItem "Meteor"
  132.     Form1.lstPlanets.AddItem "Neptune"
  133.     Form1.lstPlanets.AddItem "Pluto"
  134.     Form1.lstPlanets.AddItem "Saturn"
  135.     Form1.lstPlanets.AddItem "Space Craft"
  136.     Form1.lstPlanets.AddItem "Sun"
  137.     Form1.lstPlanets.AddItem "Uranus"
  138.     Form1.lstPlanets.AddItem "Venus"
  139. '----------------------------------
  140. 'Add items to the Combo Box using
  141. 'AddItem method.
  142. '----------------------------------
  143.     Form1.cboSelectText.AddItem "General Info."
  144.     '
  145.     ' *** The ItemData area of a list box is a great place to
  146.     '     store numbers. These could be a record number from a
  147.     '     database. Here we are using the number as a pointer
  148.     '     that we can select the text with.
  149.     '
  150.     Form1.cboSelectText.ItemData(Form1.cboSelectText.NewIndex) = 1
  151.     Form1.cboSelectText.AddItem "Statistics"
  152.     Form1.cboSelectText.ItemData(Form1.cboSelectText.NewIndex) = 2
  153.     Form1.cboSelectText.AddItem "History"
  154.     Form1.cboSelectText.ItemData(Form1.cboSelectText.NewIndex) = 3
  155. End Sub
  156. Private Sub lstPlanets_Click()
  157. '--------------------------------------------------
  158. 'Path-stores path to picture files; cuts down on
  159. 'the repetition.
  160. 'Choice-string value passed to the GetInfo function
  161. 'in the Description.Bas module; indicates what text
  162. 'to return.
  163. '--------------------------------------------------
  164. Dim Path As String
  165. Dim Choice As String
  166. Path = "C:/download/galaxy2/"
  167. '------------------------------------------------------
  168. 'Set the default value for the ComboBox "cboSelectText"
  169. 'to 0 "General Info."
  170. '------------------------------------------------------
  171. cboSelectText.ListIndex = 0
  172.   Select Case lstPlanets.ListIndex
  173.       Case 0
  174.         imgShow.Picture = LoadPicture(Path + "asteroid.bmp")
  175.         txtContent.Text = GetInfo(0)
  176.       Case 1
  177.         imgShow.Picture = LoadPicture(Path + "earth.bmp")
  178.         txtContent.Text = GetInfo(1)
  179.       Case 2
  180.         imgShow.Picture = LoadPicture(Path + "jupiter.bmp")
  181.         txtContent.Text = GetInfo(2)
  182.       Case 3
  183.         imgShow.Picture = LoadPicture(Path + "mars.bmp")
  184.         txtContent.Text = GetInfo(3)
  185.       Case 4
  186.         imgShow.Picture = LoadPicture(Path + "merc.bmp")
  187.         txtContent.Text = GetInfo(4)
  188.       Case 5
  189.         imgShow.Picture = LoadPicture(Path + "meteor.bmp")
  190.         txtContent.Text = GetInfo(5)
  191.       Case 6
  192.         imgShow.Picture = LoadPicture(Path + "neptune.bmp")
  193.         txtContent.Text = GetInfo(6)
  194.       Case 7
  195.         imgShow.Picture = LoadPicture(Path + "pluto.bmp")
  196.         txtContent.Text = GetInfo(7)
  197.       Case 8
  198.         imgShow.Picture = LoadPicture(Path + "saturn.bmp")
  199.         txtContent.Text = GetInfo(8)
  200.       Case 9
  201.         imgShow.Picture = LoadPicture(Path + "craft.bmp")
  202.         txtContent.Text = GetInfo(9)
  203.       Case 10
  204.         imgShow.Picture = LoadPicture(Path + "sun.bmp")
  205.         txtContent.Text = GetInfo(10)
  206.       Case 11
  207.         imgShow.Picture = LoadPicture(Path + "uranus.bmp")
  208.         txtContent.Text = GetInfo(11)
  209.       Case 12
  210.         imgShow.Picture = LoadPicture(Path + "venus.bmp")
  211.         txtContent.Text = GetInfo(12)
  212.     End Select
  213. End Sub
  214.