home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / tool / various / vbasm / lbs_hght.frm < prev    next >
Text File  |  1994-06-18  |  2KB  |  76 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "Form1"
  4.    ClientHeight    =   2775
  5.    ClientLeft      =   1320
  6.    ClientTop       =   1650
  7.    ClientWidth     =   2310
  8.    Height          =   3180
  9.    Left            =   1260
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   2775
  12.    ScaleWidth      =   2310
  13.    Top             =   1305
  14.    Width           =   2430
  15.    Begin ListBox List1 
  16.       Height          =   2565
  17.       Left            =   120
  18.       TabIndex        =   0
  19.       Top             =   120
  20.       Width           =   2055
  21.    End
  22. End
  23. Option Explicit
  24.  
  25.  
  26. Sub Form_Load ()
  27.     Dim i As Integer
  28.  
  29.     'Set LBS_NOINTEGRALHEIGHT bit--this bit is ignored if it is
  30.     'set after the control has been created so we set the bit
  31.     'and use vbRecreateCtrl to recreate the control
  32.     i = SetStyleBits(List1, LBS_NOINTEGRALHEIGHT, True)
  33.     
  34.     'Because listbox was not visible when model info was modified,
  35.     'visible property will be set to False, so change it to True
  36.     List1.Visible = True
  37.     
  38.     'Populate list box
  39.     For i = 1 To 50
  40.         List1.AddItem "List Item " & CStr(i)
  41.     Next i
  42.  
  43. End Sub
  44.  
  45. Sub Form_Resize ()
  46.     'Size list box to fill window
  47.     List1.Move 0, 0, ScaleWidth, ScaleHeight
  48. End Sub
  49.  
  50. Function SetStyleBits (Ctrl As Control, Bits As Long, SetMode As Integer) As Integer
  51.     Dim ModelInfo As MODEL, Pointer As Long
  52.  
  53.     'Get a pointer to the control's MODEL structure
  54.     Pointer = vbGetCtrlModel(vbGetLongPtr(Ctrl))
  55.  
  56.     'Copy MODEL structure to our own variable
  57.     Call vbGetData(Pointer, ModelInfo, Len(ModelInfo))
  58.  
  59.     'Modify the specified bits of the control's window style
  60.     If SetMode Then
  61.         'Set specified bit(s)
  62.         ModelInfo.flWndStyle = ModelInfo.flWndStyle Or Bits
  63.     Else
  64.         'Clear specified bit(s)
  65.         ModelInfo.flWndStyle = ModelInfo.flWndStyle And (Not Bits)
  66.     End If
  67.  
  68.     'Copy our variable back to the MODEL structure
  69.     Call vbSetData(Pointer, ModelInfo, Len(ModelInfo))
  70.  
  71.     'Now recreate control using new style
  72.     SetStyleBits = vbRecreateCtrl(vbGetLongPtr(Ctrl))
  73.  
  74. End Function
  75.  
  76.