home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_code1 / buttons / bdemo.frm (.txt) < prev    next >
Visual Basic Form  |  1995-02-26  |  55KB  |  553 lines

  1. ButtonTest
  2. Picture-Button Demo
  3. wwwwwwwwwwwwwwp
  4. wwwwwwwwwwwwwp
  5. Form1%
  6. ButtonStrip
  7.     PictureUP
  8. DDD@w
  9.     PictureDN
  10. tDHDD
  11. PushButton
  12. ButtonPict
  13. 3338333
  14. 33338
  15. PushButton
  16. ButtonPict
  17. PushButton
  18. ButtonPict
  19. PushButton
  20. ButtonPict
  21. """'p
  22. PushButton
  23. ButtonPict
  24. DDD@w
  25. Picture1
  26. UUUUUUU
  27. UUUUUUUU
  28. UUUUUUUUP
  29. UUUUUUUU
  30. UUUUUUUUP
  31. UUUUUUUUU
  32. UUUUUUUUU
  33. UUUUUUUUP
  34. UUUUUUUUU
  35. UUUUUUUUU
  36. UUUUUUUUUP
  37. UUUUUUUUU
  38. UUUUUUUUUP
  39. UUUUUUUUUP
  40. UUUUUUUUU
  41. UUUUUUUUU
  42. wwwww
  43. UUUUUUUUUP
  44. UUUUUUUUUP
  45. wwwwwwwww
  46. UUUUUUUUU
  47. UUUUUUUUUP
  48. UUUUUUUUUU
  49. ppwpw
  50. UUUUUUUUU
  51. wwpppw
  52. fffffff`
  53. UUUUUUUUUP
  54. fffffffffff
  55. UUUUUUUUP
  56. fffffffffffffff
  57. UUUUUUUUU
  58. fffffffffffffffff
  59. UUUUUUUUU
  60. ffffffffffffffffffff
  61. UUUUUUUUP
  62. fffffffffffffffffffff`
  63. UUUUUUUUP
  64. ffffffffffffffffffffffff
  65. UUUUUUUU
  66. ffffffffffffffffffffffffff
  67. UUUUUUUU
  68. fffffffffffffffffffffffffff`w
  69. UUUUUUP
  70. fffffffffffffffffffffffffffff
  71. UUUUUUP
  72. fffffffffffffffffffffffffffffff
  73. UUUUUU
  74. ffffffffffffffffffffffffffffff`
  75. UUUUU
  76. ffffffffffffffffffffffffffffff
  77. UUUUP
  78. Ppwwwwpp
  79. 0fffffffffffffffffffffffffffffff
  80. ffffffffffffffffffffffffffffff`
  81. ffffffffffffffffffffffffffffff
  82. 0wwpfffffffffffffffffffffffffffffff
  83. ffffffffffffffffffffffffff
  84. ffffffffffffffffffffff`
  85. fffffffffffffffffff
  86. pffffffffffffffff`
  87. UUUPw
  88. wppwww
  89. ffffffffffffff
  90. pwwwww
  91. fffffffffff`
  92. UUUUP
  93. wwpffffffffff
  94. wwwwwww
  95. UUUUUP
  96. fffffff`
  97. UUUUUU
  98. fffff`
  99. UUUUUU
  100. UUUUUU
  101. UUUUUUU
  102. UUUUUUUP
  103. UUUUUUUUU
  104. pwwww
  105. UUUUUUUUUP
  106. UUUUUUUUUU
  107. UUUUUUUUUU
  108. wwwpwww
  109. UUUUUUUUUUPwp
  110. UUUUUUUUUUP
  111. wwwww
  112. UUUUUUUUUUU
  113. wwwww
  114. pUUUUUUUUUUUPwww
  115. UUUUUUUUUUUU
  116. ppwwwww
  117. UUUUUUUUUUUU
  118. UUUUUUUUUUUPpww
  119. pwwwpw
  120. UUUUUUUUUUUPp
  121. wpUUUUUUUUUUUU
  122. wwpwp
  123. ffffff`
  124. pwpppUUUUUUUUUUUU
  125. pwwpw
  126. fffffffff
  127. UUUUUUUUUUU
  128. wwppp
  129. wwwww
  130. ffffffffffff`
  131. UUUUUUUUUUUP
  132. pwpww
  133. wwwwwwp
  134. fffffffffffffff`
  135. UUUUUUUUUUUP
  136. ffffffffffffffffff
  137. pUUUUUUUUUUUU
  138. wpwww
  139. fffffffffffffffffffff`
  140. UUUUUUUUUUU
  141. wwpwp
  142. fffffffffffffffffffffffff`
  143. ppUUUUUUUUUUU
  144. pwwwww
  145. wwwww
  146. fffffffffffffffffffffffff
  147. pUUUUUUUUUUUP
  148. ffffffffffffffffffffffffff
  149. wpppw
  150. UUUUUUUUUUP
  151. ffffffffffffffffffffffffff`
  152. UUUUUUUUUUPpww
  153. wwwwww
  154. wwwww
  155. ffffffffffffffffffffffffff
  156. UUUUUUUUUUPppwpw
  157. fffffffffffffffffffffffffff
  158. UUUUUUUUUU
  159. ffffffffffffffffffffffffff`
  160. UUUUUUUUUU
  161. wwwww
  162. p`fffffffffffffffffffffffffff`ww
  163. UUUUUUUUU
  164. wpwwp
  165. fffffffffffffffffffffffffff
  166. UUUUUUUU
  167. wwwww
  168. fffffffffffffffffffffffffff`
  169. UUUUUUUPwwpp
  170. fffffffffffffffffffffffffff`
  171. UUUUUUUP
  172. wppwww
  173. ffffffffffffffffffffffffffff
  174. UUUUUPw
  175. ffffffffffffffffffff`
  176. ffffffffffffffffff
  177. pwwpwp
  178. wwwwp
  179. wwwww
  180. ffffffffffffffff`
  181. wwwww
  182. fffffffffffff`
  183. wwwwwww
  184. fffffffff
  185. pwpppp
  186. wwpwpwp
  187. wwwwp
  188. wwwwwww
  189. wwwwww
  190. wwwww
  191. wppwppp
  192. wwwww
  193. ppwpp
  194. wwwpwww
  195. wwwww
  196. wwwww
  197. wppwpp
  198. wpwppwwww
  199. ppwpppw
  200. wpwpw
  201. wpwwp
  202. wwwwp
  203. wwwpwwp
  204. ppwpppp
  205. sspwpw
  206. wppww
  207. wwwwwpwp
  208. spwww
  209. pwwww
  210. wwwww
  211. ppwww
  212. wwwwww
  213. wwwwwww
  214. pwwww
  215. pwppw
  216. pwwwp
  217. wwwwww
  218. wwwpwp
  219. 0pwpw
  220. wwwwww
  221. wpppw
  222. wwwwwp
  223. wwwwwww
  224. pppww
  225. pwwwwww
  226. wpwwwpw
  227. wwwppw
  228. wwwwwww
  229. pwwpppw
  230. wwwwpp
  231. ffffffffff`
  232. fffffffffff
  233. sspwp
  234. ffffffffff`
  235. pwwwp
  236. wwpwww
  237. pwwwwpwww
  238. fffffffffff`
  239. pppwpp
  240. wwwpwp
  241. ffffffffffff
  242. ppwwp
  243. pwwpw
  244. fffffffffff`
  245. ppwwww
  246. ffffffffffff
  247. 70ppp
  248. pwwwwp
  249. wwwww
  250. ffffffffffff
  251. ppppwwww
  252. `ffffffffffff`
  253. wpwww
  254. ffffffffffff
  255. pwwpw
  256. fffffffffffff
  257. pwpwww
  258. ffffffffffff`
  259. ppwwwp
  260. fffffffffffff
  261. ffffffffffff`
  262. ppppwpw
  263. wpwwpwpw
  264. wwwppwwwwwpwwp
  265. ffffffffffff`
  266. fffffffffff
  267. DDDDD
  268. wwwwwwww
  269. ffffffffff`
  270. ppwppww
  271. DDDDDDDDDDDDD@
  272. fffffff
  273. wppwpww
  274. DDDDDDDDDDDDDDDDDDDDD
  275. DDDDDDDDDDDDDDDDDDDD@
  276. wwwww
  277. DDDDDDDDDDDDDDDDDDD@
  278. ppwwwww
  279. DDDDDDDDDDDDDDDDDDD@
  280. pDDDDDDDDDDDDDDDDDDD@
  281. DDDDDDDDDDDDDDDDDD@
  282. wwwwwpDDDDDDDDDDDDDDDDDD@
  283. wwwww
  284. DDDDDDDDDDDDDDD
  285. ppwpwp
  286. wpwww
  287. DDDDDDDD@wpww
  288. pwppw
  289. wpwpwp
  290. wwwwww
  291. wpwww
  292. pppwp
  293. ppwww
  294. wwwwwp
  295. wwwww
  296. wwwwpw
  297. wwppp
  298. wwwwpw
  299. wpwwpw
  300. DDDDD@
  301. pwwww
  302. DDDDDDDDDDDD
  303. DDDDDDDDDDDDDDD
  304. 70DDDDDDDDDDDDDD@
  305. DDDDDDDDDDDDD
  306. 0DDDDDDDDDDDD@
  307. pwwpwp
  308. pppwp
  309. DDDDDDDDDDD@
  310. pwwww
  311. ppwwpp
  312. DDDDDDDDDD@
  313. ppwww
  314. pwppw
  315. wwpwwwpw
  316. DDDD@
  317. pDDDDDDDDDD@
  318. wwwpw
  319. wwwwww
  320. wpwww
  321. DDDDDD
  322. DDDDDDDDD@
  323. DDDDDDD
  324. DDDDDDDDD
  325. wwwpw
  326. DDDDDDD@
  327. 0DDDDDDDD
  328. pppwpw
  329. pwwppwpw
  330. DDDDDDDD@
  331. DDDDDDD@
  332. wwpwppp
  333. DDDDDDDD
  334. DDDDDDDD
  335. DDDDDDD
  336. DDDDDDD
  337. DDDDDDDDDDDDDD@
  338. wwppw
  339. DDDDDDDDDDDDD
  340. DDDDDDDDDD@
  341. DDDDDDD
  342. wwpwww
  343. DDDDD
  344. wwpwwp
  345. pwppw
  346. pwwwp
  347. wpppw
  348. ppppw
  349. pppww
  350. pwwww
  351. pwppww
  352. wwppw
  353. wwpwpww
  354. pwppp
  355. pwwwp
  356. pppwwpwpww
  357. pwwppww
  358. pppwp
  359. wpwwww
  360. wwwwp
  361. wppppppw
  362. pwwwpwwpwww
  363. pwpwpp
  364. pwwwpw
  365. wwwww
  366. wwpppp
  367. wpwpp
  368. wppppw
  369. wwwwww
  370. wwwww
  371. wpwwp
  372. ppwpww
  373. wpwpwwwwww
  374. wwwppwwww
  375. wpwww
  376. pppwpwpwpppwwww
  377. wpwwppp
  378. pwppwwwwww
  379. wwppww
  380. DDDDDDDDDDD
  381. DDDDDDDDDDDDDDDDDD
  382. DDDDDDDDDDDDDDDDDDD@
  383. DDDDDDDDDDDDDDDDDD@
  384. DDDDDDDDDDDDDDDDDD@
  385. DDDDDDDDDDDDDDDDDDD
  386. UUUUP
  387. DDDDDDDDDDDDDDDDDDD
  388. DDDDDDDDDDDDDDDDDDD
  389. UUUUU
  390. DDDDDDDDDDDDDDDDDD@
  391. UUUUUU
  392. DDDDDDDDDDD
  393. UUUUUUP
  394. UUUUUU
  395. UUUUUUU
  396. UUUUUUP
  397. UUUUUUU
  398. MS Sans Serif
  399. NumButtons
  400. ButtPictTop
  401. ButtPictLeft
  402. @    Form_Load
  403. ButtonPict{
  404. LeftH
  405. ButtonUP
  406. PictureUP_MouseDown
  407. ButtonL
  408. Shift
  409.     PictureDN
  410. VisibleX
  411.     PictureUP
  412. picture1
  413. CurrentXe
  414. CurrentY
  415. PictureUP_MouseUp0
  416. ButtonDown
  417. PushButton
  418.     DrawWidth^
  419. ScaleWidth
  420. ScaleHeight
  421. PushButton_MouseDown
  422. index
  423. PushButton_MouseUp
  424. Picture1_MouseDown
  425. Picture1_MouseUp
  426. ButtonPict_MouseDown
  427. ButtonPict_MouseUpm
  428. placed
  429. The main procedures in this program are the generall
  430. procedures ButtonUp and ButtonDown. Form_Load initializess
  431. the buttons in the up position and stores the locationss
  432. of their pictures.
  433. To use these procedures in your program:
  434.    1.  Create a picture box control with the CtlName set
  435.  to "PushButton"
  436.    2.  Create a picture box control on top of the PushButttonn
  437.  picture box and set the CtlName to "ButtonPict".i
  438.    3.  Copy both picture boxes by selecting the PushButton
  439.  picture box and executing the "Edit-Copy" command.m
  440.    4.  Paste a copy for each button you want to create and
  441.  create the control arrays PushButton() and ButtonPict().c
  442.  These procedures were obviously designed to control
  443.  more than one button. You can, however, modify them
  444.  if you need only one simulated button.t
  445.    6.  Adjust the buttons to the sizes you want. Although thee
  446.  routines should work with any size buttons, there isr
  447.  a practical limit because of the time it takes for VB
  448.  to draw the lines on them.t
  449.    5.  Load your pictures (icon, bmp, etc) into the picturee
  450.  boxes on top of your buttons (ButtonPict()), size and
  451.  position them as necessary.  
  452.    6.  Copy the subs ButtonUp and ButtonDown into the.
  453.  (general) (declarations) section for your form and thed
  454.  initializing routine into your Form_Load procedure.
  455.    7.  Put a CALL to ButtonDown in your PushButton_MouseDown and
  456.  ButtonPict_MouseDown event procedures. Likewise, put callsc
  457.  to ButtonUp in your PushButton_MouseUp and ButtonPict_P
  458.  MouseUp event procedures. t
  459.    8.  Copy the declarations below into your program and changee
  460.  the value of NumButtons% to the number of simulated
  461.  buttons on your form.
  462. That is all there is to it. See the comments in ButtonUp and
  463. ButtonDown for more information.
  464. The camera button (the camera that is a button) is handled differently.
  465. it is simply two separate pictures (not an array). The picture
  466. that represents the object in the up position is called PictureUp andd
  467. is placed over the other (PictureDn). Your code only needs too
  468. handle the MouseUp and MouseDown events for the top picture, since
  469. the user cannot access the bottom picture. In your mouse event
  470. handlers, you just have to switch visibility between the two pictures.
  471. You could, of course, do all of your buttons this way by makingg
  472. two control arrays for the pictures, just like the other buttons,,
  473. but this method requires a little more manual work, because you have
  474. to create both up and down representations of each picture. The camera
  475. was first drawn (using Iconwrks) in the up position with shadows on the
  476. right and bottom. Then the icon was copied and pasted into another
  477. icon - offset one pixel to the right and one pixel down from the original.
  478. The shadow was removed from the right and bottom and shadow was addedd
  479. to the top and left. You can load both icons into Icon Works to seee
  480. what I mean.
  481. Change the Constant NumButtons% to the actual number of simulateds
  482. buttons on your form. 
  483. used to pass the index to the general procedures
  484. These are used for
  485.    coordinates when
  486.    moving the pictures
  487.    on the buttons.
  488. These will store the locations
  489.    of the button pictures when
  490.    the form is loaded.  
  491. ButtonDown
  492. This procedure draws the button in the down position..
  493. Remember ScaleMode must be set to 3 (pixels) on PushButton()
  494. for this to work properly.
  495. Set line width to one pixelt
  496. *** First draw a black box around the button
  497. *** Next erase the white and dark inside lines and
  498. *** change the white outside lines to dark grey.
  499. *** Move the picture down and right 1 pixel
  500.  *** 
  501. ** The following code puts the demo text on the picture. **A
  502. ** You could process your button commands here or in the **A
  503. ** ButtonUP procedure.  Processing in the ButtonUP pro-  **A
  504. ** cedure would act like a Command_Click event.
  505. ix is the button index
  506. Camera
  507. Apple
  508. Folder
  509.  Button
  510. ButtonPict_MouseDown
  511. *** This is necessary in case someone presses the mouse ***
  512. *** button while the pointer is over the picture on the ***
  513. *** button instead of the button itself.
  514. ButtonPict_MouseUp
  515. *** This is necessary in case someone pressed the mouse ***
  516. *** button while the pointer was over the picture on
  517. *** the button instead of the button itself.
  518. ButtonUP
  519. *** Draw 2 white lines accross the top of the button. ****
  520. *** The second is 1 pixel shorter than the first.
  521.  ****
  522. ***  Draw 2 dark lines on the left side of the button. **
  523. ***  The second is 2 pixels shorter than the first.
  524. *** Draw 2 white lines down the left side of the button *
  525. *** The second is 2 pixels shorter than the first.
  526. *** Draw 2 dark lines at the bottom of the button.
  527. *** The second is 2 pixels longer than the first.
  528.  ****
  529. *** Move the picture up and left 1 pixel
  530. **  You could put your button processing code here   **-
  531. **  to look like a Command_Click event.
  532. For this demo just erase the text*
  533. on the picture.o
  534. Form_Load
  535. Display all the buttons-
  536. in the up position.l
  537. Picture1_MouseDown
  538. This picture is just for decoration.
  539. Picture1_MouseUp
  540. PictureUP_MouseDown
  541. *** This handles the camera that is not on a button ***i
  542. **  Process code here - just like a command_MouseDown **
  543. **  event. Or you could put your code in the MouseUP  **
  544. **  procedure to make it look like a Command_Click.   **
  545. You're holding the camera down.
  546. PictureUP_MouseUp
  547. ** This procedure handles the camera that is not on **
  548. ** a button.
  549. ( ** 
  550. **  Process code here - just like a command button  **
  551. PushButton_MouseDown
  552. PushButton_MouseUp
  553.