home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Tool Box
/
SIMS_2.iso
/
tool
/
various
/
vbasm
/
lbs_hght.frm
< prev
next >
Wrap
Text File
|
1994-06-18
|
2KB
|
76 lines
VERSION 2.00
Begin Form Form1
Caption = "Form1"
ClientHeight = 2775
ClientLeft = 1320
ClientTop = 1650
ClientWidth = 2310
Height = 3180
Left = 1260
LinkTopic = "Form1"
ScaleHeight = 2775
ScaleWidth = 2310
Top = 1305
Width = 2430
Begin ListBox List1
Height = 2565
Left = 120
TabIndex = 0
Top = 120
Width = 2055
End
End
Option Explicit
Sub Form_Load ()
Dim i As Integer
'Set LBS_NOINTEGRALHEIGHT bit--this bit is ignored if it is
'set after the control has been created so we set the bit
'and use vbRecreateCtrl to recreate the control
i = SetStyleBits(List1, LBS_NOINTEGRALHEIGHT, True)
'Because listbox was not visible when model info was modified,
'visible property will be set to False, so change it to True
List1.Visible = True
'Populate list box
For i = 1 To 50
List1.AddItem "List Item " & CStr(i)
Next i
End Sub
Sub Form_Resize ()
'Size list box to fill window
List1.Move 0, 0, ScaleWidth, ScaleHeight
End Sub
Function SetStyleBits (Ctrl As Control, Bits As Long, SetMode As Integer) As Integer
Dim ModelInfo As MODEL, Pointer As Long
'Get a pointer to the control's MODEL structure
Pointer = vbGetCtrlModel(vbGetLongPtr(Ctrl))
'Copy MODEL structure to our own variable
Call vbGetData(Pointer, ModelInfo, Len(ModelInfo))
'Modify the specified bits of the control's window style
If SetMode Then
'Set specified bit(s)
ModelInfo.flWndStyle = ModelInfo.flWndStyle Or Bits
Else
'Clear specified bit(s)
ModelInfo.flWndStyle = ModelInfo.flWndStyle And (Not Bits)
End If
'Copy our variable back to the MODEL structure
Call vbSetData(Pointer, ModelInfo, Len(ModelInfo))
'Now recreate control using new style
SetStyleBits = vbRecreateCtrl(vbGetLongPtr(Ctrl))
End Function