home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / VISUAL_B / FERRAMEN / VB_ASM / LBS_HGHT.ZIP / LBS_HGHT.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-06-19  |  2.1 KB  |  60 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. Option Explicit
  23. Sub Form_Load ()
  24.     Dim i As Integer
  25.     'Set LBS_NOINTEGRALHEIGHT bit--this bit is ignored if it is
  26.     'set after the control has been created so we set the bit
  27.     'and use vbRecreateCtrl to recreate the control
  28.     i = SetStyleBits(List1, LBS_NOINTEGRALHEIGHT, True)
  29.     'Because listbox was not visible when model info was modified,
  30.     'visible property will be set to False, so change it to True
  31.     List1.Visible = True
  32.     'Populate list box
  33.     For i = 1 To 50
  34.         List1.AddItem "List Item " & CStr(i)
  35.     Next i
  36. End Sub
  37. Sub Form_Resize ()
  38.     'Size list box to fill window
  39.     List1.Move 0, 0, ScaleWidth, ScaleHeight
  40. End Sub
  41. Function SetStyleBits (Ctrl As Control, Bits As Long, SetMode As Integer) As Integer
  42.     Dim ModelInfo As MODEL, Pointer As Long
  43.     'Get a pointer to the control's MODEL structure
  44.     Pointer = vbGetCtrlModel(vbGetLongPtr(Ctrl))
  45.     'Copy MODEL structure to our own variable
  46.     Call vbGetData(Pointer, ModelInfo, Len(ModelInfo))
  47.     'Modify the specified bits of the control's window style
  48.     If SetMode Then
  49.         'Set specified bit(s)
  50.         ModelInfo.flWndStyle = ModelInfo.flWndStyle Or Bits
  51.     Else
  52.         'Clear specified bit(s)
  53.         ModelInfo.flWndStyle = ModelInfo.flWndStyle And (Not Bits)
  54.     End If
  55.     'Copy our variable back to the MODEL structure
  56.     Call vbSetData(Pointer, ModelInfo, Len(ModelInfo))
  57.     'Now recreate control using new style
  58.     SetStyleBits = vbRecreateCtrl(vbGetLongPtr(Ctrl))
  59. End Function
  60.