以下是引用Dreamer_09在2007-11-15 14:55:52的发言:OK~真是太感谢了~ 但是还是想多问一句,如果我就是想实现“让按键始终浮在指定位置”这样的功能,要怎么做呢?属性里可以设置么?或者有什么代码么? Declare Function SetTimer _ Lib "user32" ( _ ByVal hWnd As Long, _ ByVal nIDEvent As Long, _ ByVal uElapse As Long, _ ByVal lpTimerFunc As Long) _ As Long Declare Function KillTimer _ Lib "user32" ( _ ByVal hWnd As Long, _ ByVal nIDEvent As Long) _ As Long Declare Function GetCursorPos _ Lib "user32" ( _ lpPoint As POINTAPI) _ As Long Type POINTAPI X As Long Y As Long End Type Dim ChangeOn As Boolean Dim m_lngTimerId As Long ' Sub StartTimer() If Not ChangeOn Then m_lngTimerId = SetTimer(0, 0, 200, AddressOf TimerProc) ChangeOn = True End If End Sub Public Function TimerProc(ByVal hWnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long On Error Resume Next If Sheets(1).CommandButton1.Top <> Cells(ActiveWindow.ScrollRow, ActiveWindow.ScrollColumn).Top + 60 Then Sheets(1).CommandButton1.Top = Cells(ActiveWindow.ScrollRow, ActiveWindow.ScrollColumn).Top + 60 If Sheets(1).CommandButton1.Left <> Cells(ActiveWindow.ScrollRow, ActiveWindow.ScrollColumn).Left + 100 Then Sheets(1).CommandButton1.Left = Cells(ActiveWindow.ScrollRow, ActiveWindow.ScrollColumn).Left + 100 TimerProc = 0 End Function Sub StopTimer() On Error Resume Next If ChangeOn = True Then KillTimer 0, m_lngTimerId ChangeOn = False End If End Sub 见附件
oCxelnbZ.rar
(11.95 KB, 下载次数: 1072)
|