home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_code1 / 3d_tabs / win.frm (.txt) < prev   
Visual Basic Form  |  1994-05-30  |  12KB  |  230 lines

  1. Resizable Window
  2. wwwwwwwwwwwwwwp
  3. wwwwwwwwwwwwwwp
  4. wwwwwwwwwwwwwwp
  5. wwwwwwwwwwwwwwp
  6. wwwwwwwwwwwwwwp
  7. wwwwwwwwwwwwwwp
  8. wwwwwwwwwwwwwwp
  9. wwwwwwwwwwwwwwp
  10. wwwwwwwwwwwwwwp
  11. wwwwwwwwwwwwwwp
  12. wwwwwwwwwwwwwwp
  13. wwwwwwwwwwwwwwp
  14. wwwwwwwwwwwwwp
  15. wwwwwwwwwwwwwp
  16. wwwwwwwwwwwwwwp
  17. wwwwwwwwwwwwwwp
  18. wwwwwwwwwwwwwwp
  19. wwwwwwwwwwwwwwp
  20. wwwwwwwwwwwwwwp
  21. wwwwwwwwwwwwwwp
  22. wwwwwwwwwwwwwwp
  23. wwwwwwwwwwwwwwp
  24. wwwwwwwwwwwwwwp
  25. wwwwwwwwwwwwwwp
  26. wwwwwwwwwwwwwwp
  27. wwwwwwwwwwwwwp
  28. wwwwwwwwwwwwwp
  29. Form21
  30. tabbox
  31. invbox
  32. SSFrame
  33. 3d Containers
  34. MS Sans Serif
  35. V. A note on 3d effects.
  36. MS Sans Serif
  37. SSFrame
  38. Dummy
  39. MS Sans Serif
  40. MS Sans Serif
  41. SSFrame
  42. Intro
  43. MS Sans Serif
  44. SSFrame
  45. Step 1
  46. MS Sans Serif
  47. I. Creating the controls.
  48. MS Sans Serif
  49. SSFrame
  50. Step 2
  51. MS Sans Serif
  52. II. Adding the code.
  53. MS Sans Serif
  54. SSFrame
  55. Step 3
  56. MS Sans Serif
  57. III. Set additional properties.
  58. MS Sans Serif
  59. SSFrame
  60. Step 4
  61. MS Sans Serif
  62. IV. That's it!
  63. MS Sans Serif
  64. zfile
  65. &File
  66. zedit
  67. &Edit
  68. &Options
  69. Dummy
  70. Dummy
  71. Dummy
  72.     Form_Load
  73. Initialize
  74. numpages
  75. PicBox
  76. active
  77. orientY
  78. tabsup
  79. tLeft<
  80. DefineControl
  81. tabbox
  82. invboxP
  83. control
  84. TabData
  85. Form_Resize:
  86. windowstate
  87.     TabResize
  88. tabbox_Click
  89. tabbox_MouseUp
  90. Button^
  91. Shift[
  92. TabClick
  93. tabbox_Paint
  94. DrawTextu
  95. Visible
  96. PageResizeJ
  97.     minheight
  98. minwidthA
  99. f3d_DragDrop
  100. Index
  101. Source
  102. invbox_Click
  103. zedit_Click
  104. zfile_Clickg
  105. zopt_Click
  106. paint
  107. tabbox_Resize
  108. l_Click
  109. leftO
  110. tightening
  111. resizing5
  112. Width
  113. Height
  114. LoadText+
  115. specify
  116. larger
  117. sizes
  118. ResizeTextboxes
  119. z1_Click
  120. t_Change
  121. SendMessageq
  122. EM_SETRECT
  123. rightc
  124. screen
  125. TwipsPerPixelX    
  126. bottom
  127. TwipsPerPixelY
  128. WM_USER
  129. wParam-
  130. lParam
  131. EM_GETRECT
  132. dummy
  133. added
  134. check>
  135.     alignment
  136. wrapsm
  137. SomeX
  138. pages
  139. still
  140. contain
  141. labels
  142. place
  143.     container
  144. panel
  145. modify
  146. DrawTabs
  147. routine
  148. shading
  149. lines
  150. match
  151. Form_Load
  152. Form_Resize
  153. Initialize
  154. set to highest index (total-1)
  155. ===create an array of controls 
  156. ===fill in the fields of the struct
  157. number of tabs
  158. initial focusa
  159. number of tabs in each row
  160. 0 = up, 1 = down
  161. for resizable forms, set a minimum for a page h,wa
  162. LoadText
  163.    This sample shows how to create a tab control on a sizable Form.
  164.  The initial width of the window and the tab control is still determined by the design-time size of Page(0), but if the window is resized, the tab control and each of the pages will be resized to fit the window.
  165.    The window can be maximized and minimized.
  166.  If the window is resized too small to allow display of the tab captions, the window size is reset to a minimum size.
  167.  The default minimum width is the width needed for the display of the captions; the default minimum height is set (in TabResize()) to tab control height + 20 pixels.
  168.  You may specify larger sizes by setting tb.minwidth and tb.minheight before calling DefineControl().
  169.    The tab control will resize the tabs and pages(), but it does not resize the controls on each page().
  170.  You must do this in response to one of the resize events.
  171.  This sample uses textboxes for the display of text so that a scrolling functionality can be enabled as needed, and it resizes them in response to form_resize.
  172.    The tabbox and invbox are exactly the same as in the first sample.
  173.  This sample uses 3D frames instead of pictureboxes for the pages, and a single textbox in place of multiple labels on each page(). The 3d frames are named f3d(0) - f3d(6).
  174.  The textboxes are named t(0) - t(6).
  175.  Some of the pages still contain some labels.
  176.  There are 7 pages on this sample, which produces one blank (unused) tab.
  177.    To create a sizable window, set the borderstyle = 2.
  178.  Create controls on each page with an eye toward how they will be affected by resizing.
  179.  A dummy menu was added to the form to check the alignment of the tabs when the menu wraps.
  180.  The solution to this problem was sloppy (it simply resizes the form again) and if there is no better solution that can be implemented from within VB, there are at least 2 possible workarounds.
  181.      1. Use a message subclass control to intercept WM_GETMINMAXINFO.
  182.      2. Set the tb.minwidth to a size that accomodates all the menu text.
  183.  The code is similar to the code in the first sample with a few additions.
  184.    1. Add the following lines to the general declarations section:
  185.        Dim page() As Control
  186.        Dim tb As TabData
  187.    2. Add the following lines to the form_load procedure (note that in the samples this code is actually in the procedure 'Initialize()' called from form_load):
  188.        Redim page(0 To 6)
  189.        For i = 0 to 6: Set page(i) = f3d(i): Next
  190.        tb.num = 6
  191.        tb.active = 0
  192.        tb.cols = 4
  193.        tb.orient = 0
  194.    (Note the following lines may be necessary if you have multiple instances of the tab control and the tb.structure is not being properly initialized to 0.  Note also that all 4 must be 0 or it will be assumed you are creating a 'nonaligned' tab and the form will not be fitted to the tab. See sample 3 for an example of this type.)
  195.        tb.left = 0
  196.        tb.top = 0
  197.        tb.width = 0
  198.        tb.height = 0
  199.    (the following lines are optional but should be used if you have a menu and wish to prevent wrapping)
  200.        tb.minwidth = (some value)
  201.        tb.minheight = (some value)
  202.        DefineControl Me, tabbox, invbox, page(), tb
  203.    3. Add the following line to the form_resize event:
  204.        If windowstate <> 1 then TabResize Me, -1, -1, tabbox, invbox, page(), tb
  205.    4. Add the following to tabbox_MouseUp:
  206.        TabClick Button, X, Y, tabbox, page(), tb
  207.    5. Add the following to tabbox_Paint:
  208.        DrawText tabbox, page(), tb
  209.    Size page(0) to the size to which you wish all the other page()s and the tab control to be initialized when the form is loaded.
  210.    Again, set the Font properties of the tabbox to those you wish the captions to have.
  211.    Add the following line to form_load before calling DefineControl() if you wish the tabs to be at the bottom of the pages:      
  212.        tb.orient = 1
  213.    Add the following line to form_KeyDown if you wish to toggle through the pages:
  214.        If KeyCode = (some value) Then PageNext
  215.        If KeyCode = (some value) Then PagePrev
  216.    The resizing of the window is handled by TabResize(). It is not a good idea to manipulate the form size from within this event and the routine uses flags to keep from redrawing the tabs and text more than once.
  217.  The refresh rate is nontheless poor, and as mentioned previously, it must resize the form twice if a menu wraps.
  218.  I'm sure this section could be improved, but I just haven't hit on it. All in all, the resizable window is not the optimal use for this control.
  219.  That's it. The final sample includes some controls to manipulate the tabs at runtime.
  220.  The tab control assumes one pixel shading outline in white and dark grey around the inside of the container in which it sits.
  221.  The first sample uses line controls to shade the form's borders for convenience.
  222.  This sample omitted the shading to avoid having to write code to move and resize the line controls.
  223.  If you place the control in a 3d container such as a 3d panel, you may need to modify the DrawTabs routine to get the shading lines to match up.
  224.  The third sample uses a 3d panel, but the size of the tab control must be specified at designtime and it is not resizable.
  225. ResizeTextboxes
  226. this just buts the text in a little off the scroll bar
  227. tabbox_MouseUp
  228. tabbox_Paint
  229. call DrawText   from tabbox_Paint=========
  230.