home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / whatsm / numform.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-06-12  |  12.1 KB  |  485 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    BackColor       =   &H00FFFFFF&
  4.    Caption         =   "What's My Number?"
  5.    ClientHeight    =   4575
  6.    ClientLeft      =   1245
  7.    ClientTop       =   1755
  8.    ClientWidth     =   7695
  9.    Height          =   5265
  10.    Icon            =   NUMFORM.FRX:0000
  11.    Left            =   1185
  12.    LinkMode        =   1  'Source
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    ScaleHeight     =   4575
  16.    ScaleWidth      =   7695
  17.    Top             =   1125
  18.    Width           =   7815
  19.    Begin CommandButton Command1 
  20.       Caption         =   "Give up"
  21.       Height          =   735
  22.       Left            =   1440
  23.       TabIndex        =   8
  24.       Top             =   3600
  25.       Width           =   1455
  26.    End
  27.    Begin CommandButton OK 
  28.       Caption         =   "OK"
  29.       Default         =   -1  'True
  30.       Height          =   735
  31.       Left            =   5520
  32.       TabIndex        =   2
  33.       Top             =   1080
  34.       Width           =   1575
  35.    End
  36.    Begin TextBox Text1 
  37.       FontBold        =   0   'False
  38.       FontItalic      =   0   'False
  39.       FontName        =   "Times New Roman"
  40.       FontSize        =   24
  41.       FontStrikethru  =   0   'False
  42.       FontUnderline   =   0   'False
  43.       Height          =   735
  44.       Left            =   3240
  45.       TabIndex        =   0
  46.       Top             =   1080
  47.       Width           =   1935
  48.    End
  49.    Begin Label Label5 
  50.       BackColor       =   &H00FFFFFF&
  51.       FontBold        =   0   'False
  52.       FontItalic      =   0   'False
  53.       FontName        =   "Times New Roman"
  54.       FontSize        =   24
  55.       FontStrikethru  =   0   'False
  56.       FontUnderline   =   0   'False
  57.       Height          =   495
  58.       Left            =   5160
  59.       TabIndex        =   5
  60.       Top             =   3720
  61.       Width           =   615
  62.    End
  63.    Begin Label Label4 
  64.       BackColor       =   &H00FFFFFF&
  65.       Caption         =   "Turns:"
  66.       FontBold        =   0   'False
  67.       FontItalic      =   0   'False
  68.       FontName        =   "Times New Roman"
  69.       FontSize        =   24
  70.       FontStrikethru  =   0   'False
  71.       FontUnderline   =   0   'False
  72.       Height          =   495
  73.       Left            =   3600
  74.       TabIndex        =   4
  75.       Top             =   3720
  76.       Width           =   1455
  77.    End
  78.    Begin Label Label3 
  79.       Alignment       =   2  'Center
  80.       BackColor       =   &H00FFFFFF&
  81.       FontBold        =   -1  'True
  82.       FontItalic      =   0   'False
  83.       FontName        =   "Times New Roman"
  84.       FontSize        =   24
  85.       FontStrikethru  =   0   'False
  86.       FontUnderline   =   0   'False
  87.       Height          =   615
  88.       Left            =   840
  89.       TabIndex        =   6
  90.       Top             =   2160
  91.       Width           =   5775
  92.    End
  93.    Begin Label Label1 
  94.       BackColor       =   &H00FFFFFF&
  95.       Caption         =   "Enter your guess in the box to the right, then press Enter."
  96.       Height          =   495
  97.       Left            =   480
  98.       TabIndex        =   1
  99.       Top             =   1200
  100.       Width           =   2535
  101.    End
  102.    Begin Label Label6 
  103.       BackColor       =   &H00FFFFFF&
  104.       Caption         =   "1000"
  105.       FontBold        =   -1  'True
  106.       FontItalic      =   0   'False
  107.       FontName        =   "MS Sans Serif"
  108.       FontSize        =   12
  109.       FontStrikethru  =   0   'False
  110.       FontUnderline   =   0   'False
  111.       ForeColor       =   &H00000000&
  112.       Height          =   375
  113.       Left            =   5880
  114.       TabIndex        =   7
  115.       Top             =   480
  116.       Width           =   1095
  117.    End
  118.    Begin Label Label2 
  119.       BackColor       =   &H00FFFFFF&
  120.       Caption         =   "Please choose a number between 1 and "
  121.       FontBold        =   -1  'True
  122.       FontItalic      =   0   'False
  123.       FontName        =   "MS Sans Serif"
  124.       FontSize        =   12
  125.       FontStrikethru  =   0   'False
  126.       FontUnderline   =   0   'False
  127.       ForeColor       =   &H00000000&
  128.       Height          =   375
  129.       Left            =   960
  130.       TabIndex        =   3
  131.       Top             =   480
  132.       Width           =   4935
  133.    End
  134.    Begin Menu file 
  135.       Caption         =   "&Game"
  136.       Begin Menu new 
  137.          Caption         =   "&New"
  138.          Shortcut        =   {F2}
  139.       End
  140.       Begin Menu ex 
  141.          Caption         =   "E&xit"
  142.          Shortcut        =   ^X
  143.       End
  144.       Begin Menu dash 
  145.          Caption         =   "-"
  146.          Index           =   2
  147.       End
  148.       Begin Menu abt 
  149.          Caption         =   "&About WM#?..."
  150.       End
  151.    End
  152.    Begin Menu options 
  153.       Caption         =   "&Options"
  154.       Begin Menu highlow 
  155.          Caption         =   "&Higher/Lower"
  156.          Checked         =   -1  'True
  157.       End
  158.       Begin Menu hotcold 
  159.          Caption         =   "Hot/&Cold"
  160.       End
  161.       Begin Menu dasher 
  162.          Caption         =   "-"
  163.          Index           =   1
  164.       End
  165.       Begin Menu boundaries 
  166.          Caption         =   "&Set Boundaries..."
  167.       End
  168.       Begin Menu colorscheme 
  169.          Caption         =   "&Background Color"
  170.          Begin Menu green 
  171.             Caption         =   "&Green"
  172.          End
  173.          Begin Menu blue 
  174.             Caption         =   "&Blue"
  175.          End
  176.          Begin Menu red 
  177.             Caption         =   "&Red"
  178.          End
  179.          Begin Menu yellow 
  180.             Caption         =   "&Yellow"
  181.          End
  182.          Begin Menu purple 
  183.             Caption         =   "&Purple"
  184.          End
  185.          Begin Menu bluegray 
  186.             Caption         =   "Bl&ue-Gray"
  187.          End
  188.          Begin Menu gray 
  189.             Caption         =   "Gr&ay"
  190.          End
  191.          Begin Menu white 
  192.             Caption         =   "&White"
  193.             Checked         =   -1  'True
  194.          End
  195.       End
  196.    End
  197.    Begin Menu help 
  198.       Caption         =   "&Help"
  199.    End
  200. Sub about_Click ()
  201. Load about
  202. about.Show
  203. End Sub
  204. Sub abt_Click ()
  205. Load about
  206. about.Show
  207. End Sub
  208. Sub blue_Click ()
  209. green.checked = 0
  210. blue.checked = -1
  211. red.checked = 0
  212. yellow.checked = 0
  213. purple.checked = 0
  214. bluegray.checked = 0
  215. gray.checked = 0
  216. white.checked = 0
  217. h = &HFFFF00
  218. form1.backColor = h
  219. label1.backColor = h
  220. label2.backColor = h
  221. label3.backColor = h
  222. label4.backColor = h
  223. label5.backColor = h
  224. label6.backColor = h
  225. End Sub
  226. Sub bluegray_Click ()
  227. green.checked = 0
  228. blue.checked = 0
  229. red.checked = 0
  230. yellow.checked = 0
  231. purple.checked = 0
  232. bluegray.checked = -1
  233. gray.checked = 0
  234. white.checked = 0
  235. h = &H808000
  236. form1.backColor = h
  237. label1.backColor = h
  238. label2.backColor = h
  239. label3.backColor = h
  240. label4.backColor = h
  241. label5.backColor = h
  242. label6.backColor = h
  243. End Sub
  244. Sub boundaries_Click ()
  245. message$ = "Pick a number between 1 and:"
  246. response$ = InputBox$(message$, "What's My Number?", label6.caption)
  247. If response$ = "" Then response$ = label6.caption
  248. t = Val(response$)
  249. label6.caption = Str$(t)
  250. Randomize
  251. x = Int(t * Rnd + 1)
  252. label5.caption = ""
  253. label3.caption = ""
  254. text1.enabled = -1
  255. OK.enabled = -1
  256. turns = 0
  257. command1.enabled = -1
  258. End Sub
  259. Sub Command1_Click ()
  260. command1.enabled = 0
  261. text1.enabled = 0
  262. OK.enabled = 0
  263. label3.caption = ""
  264. w$ = "The number was " + Str$(x)
  265. MsgBox w$, 64, "Chicken!!!"
  266. End Sub
  267. Sub ex_Click ()
  268. label4.caption = ""
  269. label5.caption = ""
  270. label3.caption = ""
  271. Unload form1
  272. End Sub
  273. Sub Form_Click ()
  274. If about.visible = -1 Then
  275.     Beep
  276.     about.Show
  277. End If
  278. End Sub
  279. Sub Form_Load ()
  280. t = 1000
  281. Randomize
  282. x = Int(t * Rnd + 1)
  283. End Sub
  284. Sub gray_Click ()
  285. green.checked = 0
  286. blue.checked = 0
  287. red.checked = 0
  288. yellow.checked = 0
  289. purple.checked = 0
  290. bluegray.checked = 0
  291. gray.checked = -1
  292. white.checked = 0
  293. h = &HC0C0C0
  294. form1.backColor = h
  295. label1.backColor = h
  296. label2.backColor = h
  297. label3.backColor = h
  298. label4.backColor = h
  299. label5.backColor = h
  300. label6.backColor = h
  301. End Sub
  302. Sub green_Click ()
  303. green.checked = -1
  304. blue.checked = 0
  305. red.checked = 0
  306. yellow.checked = 0
  307. purple.checked = 0
  308. bluegray.checked = 0
  309. gray.checked = 0
  310. white.checked = 0
  311. h = &HFF00&
  312. form1.backColor = h
  313. label1.backColor = h
  314. label2.backColor = h
  315. label3.backColor = h
  316. label4.backColor = h
  317. label5.backColor = h
  318. label6.backColor = h
  319. End Sub
  320. Sub help_Click ()
  321. MsgBox ("For help on What's My Number?, use Windows Notepad to open the file WHATSMYN.TXT."), 64, "What's My Number?"
  322. End Sub
  323. Sub highlow_Click ()
  324. command1.enabled = -1
  325. hotcold.checked = 0
  326. highlow.checked = -1
  327. h = 0
  328. x = Int(t * Rnd + 1)
  329. label5.caption = ""
  330. label3.caption = ""
  331. text1.enabled = -1
  332. OK.enabled = -1
  333. turns = 0
  334. End Sub
  335. Sub hotcold_Click ()
  336. command1.enabled = -1
  337. hotcold.checked = -1
  338. highlow.checked = 0
  339. h = 1
  340. x = Int(t * Rnd + 1)
  341. label5.caption = ""
  342. label3.caption = ""
  343. text1.enabled = -1
  344. OK.enabled = -1
  345. turns = 0
  346. End Sub
  347. Sub new_Click ()
  348. command1.enabled = -1
  349. Randomize
  350. x = Int(t * Rnd + 1)
  351. label5.caption = ""
  352. label3.caption = ""
  353. text1.enabled = -1
  354. OK.enabled = -1
  355. turns = 0
  356. End Sub
  357. Sub OK_Click ()
  358. If h = 1 Then
  359.     turns = turns + 1
  360.     label5.caption = Str$(turns)
  361.     y = Val(text1.text)
  362.     r = t * .001
  363.     If y < 1 Or y > t Then
  364.         label3.caption = "Invalid answer."
  365.         turns = turns - 1
  366.     ElseIf Abs(x - y) > r * 700 Then
  367.         label3.caption = "Freezing cold!"
  368.     ElseIf Abs(x - y) > r * 500 Then
  369.         label3.caption = "You're pretty cold."
  370.     ElseIf Abs(x - y) > r * 200 Then
  371.         label3.caption = "A light breeze."
  372.     ElseIf Abs(x - y) > r * 100 Then
  373.         label3.caption = "Kinda lukewarm."
  374.     ElseIf Abs(x - y) > r * 50 Then
  375.         label3.caption = "Pretty hot."
  376.     ElseIf Abs(x - y) > r * 20 Then
  377.         label3.caption = "Getting very hot."
  378.     ElseIf Abs(x - y) > r * 10 Then
  379.         label3.caption = "Ouch, it's so hot!"
  380.     ElseIf Abs(x - y) > r * 5 Then
  381.         label3.caption = "It's boiling hot!"
  382.     ElseIf Abs(x - y) > r Then
  383.         label3.caption = "You're burning up!!"
  384.     ElseIf Abs(x - y) > 0 Then
  385.         label3.caption = "The heat is unbearable!!!"
  386.     Else
  387.         text1.enabled = 0
  388.         OK.enabled = 0
  389.         label3.caption = ""
  390.         command1.enabled = 0
  391.         MsgBox "You got the number!", 48, "Congratulations"
  392.     End If
  393.     turns = turns + 1
  394.     label5.caption = Str$(turns)
  395.     y = Val(text1.text)
  396.     If y < 1 Or y > t Then
  397.         label3.caption = "Invalid answer."
  398.         turns = turns - 1
  399.     ElseIf y < x Then
  400.         label3.caption = "Higher"
  401.     ElseIf y > x Then
  402.         label3.caption = "Lower"
  403.     Else
  404.         text1.enabled = 0
  405.         OK.enabled = 0
  406.         label3.caption = ""
  407.         command1.enabled = 0
  408.         MsgBox "You got the number!", 48, "Congratulations"
  409.     End If
  410. End If
  411. text1.text = ""
  412. End Sub
  413. Sub purple_Click ()
  414. green.checked = 0
  415. blue.checked = 0
  416. red.checked = 0
  417. yellow.checked = 0
  418. purple.checked = -1
  419. bluegray.checked = 0
  420. gray.checked = 0
  421. white.checked = 0
  422. h = &HFF00FF
  423. form1.backColor = h
  424. label1.backColor = h
  425. label2.backColor = h
  426. label3.backColor = h
  427. label4.backColor = h
  428. label5.backColor = h
  429. label6.backColor = h
  430. End Sub
  431. Sub red_Click ()
  432. green.checked = 0
  433. blue.checked = 0
  434. red.checked = -1
  435. yellow.checked = 0
  436. purple.checked = 0
  437. bluegray.checked = 0
  438. gray.checked = 0
  439. white.checked = 0
  440. h = &HFF&
  441. form1.backColor = h
  442. label1.backColor = h
  443. label2.backColor = h
  444. label3.backColor = h
  445. label4.backColor = h
  446. label5.backColor = h
  447. label6.backColor = h
  448. End Sub
  449. Sub white_Click ()
  450. green.checked = 0
  451. blue.checked = 0
  452. red.checked = 0
  453. yellow.checked = 0
  454. purple.checked = 0
  455. bluegray.checked = 0
  456. gray.checked = 0
  457. white.checked = -1
  458. h = &HFFFFFF
  459. form1.backColor = h
  460. label1.backColor = h
  461. label2.backColor = h
  462. label3.backColor = h
  463. label4.backColor = h
  464. label5.backColor = h
  465. label6.backColor = h
  466. End Sub
  467. Sub yellow_Click ()
  468. green.checked = 0
  469. blue.checked = 0
  470. red.checked = 0
  471. yellow.checked = -1
  472. purple.checked = 0
  473. bluegray.checked = 0
  474. gray.checked = 0
  475. white.checked = 0
  476. h = &HFFFF&
  477. form1.backColor = h
  478. label1.backColor = h
  479. label2.backColor = h
  480. label3.backColor = h
  481. label4.backColor = h
  482. label5.backColor = h
  483. label6.backColor = h
  484. End Sub
  485.