|
让VB应用程序支持鼠标滚轮(2) ---- 2.Form1上ADO Data 控件对象datPrimaryRS的 ConnectionString为"PROVIDER=MSDataShape;Data PROVIDER=MSDASQL;dsn=SCHOOL;uid=;pwd=;", RecordSelectors 属性的SQL命令文本为"SHAPE {select * from 班级} AS ParentCMD APPEND ({select * from 学生 } AS ChildCMD RELATE 班级名称 TO 班级名称) AS ChildCMD"。
---- 3.TextBox的DataSource均为datPrimaryRS,DataFiled如图所示。
---- 4.窗口下部的网格是DataGrid控件,名称为grdDataGrid。
---- 5.表单From1.frm的清单如下:
Private Sub Form_Load() Set grdDataGrid.DataSource = _ datPrimaryRS.Recordset("ChildCMD").UnderlyingValue Hook Me.hWnd End Sub
Private Sub Form_Unload(Cancel As Integer) UnHook Me.hWnd End Sub
---- 6.标准模块Module1.bas清单如下: Option Explicit Public Type POINTL x As Long y As Long End Type Declare Function CallWindowProc _ Lib "USER32" Alias "CallWindowProcA" _ (ByVal lpPrevWndFunc As Long, _ ByVal hWnd As Long, _ ByVal Msg As Long, _ ByVal wParam As Long, _ ByVal lParam As Long) As Long
Declare Function SetWindowLong _ Lib "USER32" Alias "SetWindowLongA" _ (ByVal hWnd As Long, _ ByVal nIndex As Long, _ ByVal dwNewLong As Long) As Long
Declare Function SystemParametersInfo _ Lib "USER32" Alias "SystemParametersInfoA" _ (ByVal uAction As Long, _ ByVal uParam As Long, _ lpvParam As Any, _ ByVal fuWinIni As Long) As Long Declare Function ScreenToClient Lib "USER32" _ (ByVal hWnd As Long, xyPoint As POINTL) As Long
|