|
CreateCaret 按功能说明,允许以位图创建新的标记形状,允许调节插入符的宽度和高度
在网上找到一篇在ACCESS调用CreateCaret文章(Dev Ashish)
- Private Declare Function apiCreateCaret Lib "user32" _
- Alias "CreateCaret" _
- (ByVal hwnd As Long, _
- ByVal hBitmap As Long, _
- ByVal nWidth As Long, _
- ByVal nHeight As Long) _
- As Long
- Private Declare Function apiShowCaret Lib "user32" _
- Alias "ShowCaret" _
- (ByVal hwnd As Long) _
- As Long
- Private Declare Function apiGetFocus Lib "user32" _
- Alias "GetFocus" _
- () As Long
- Sub sMakeCaret(ctl As Control, _
- intX As Integer, _
- intY As Integer)
- Dim hwnd As Long
- hwnd = fhWnd(ctl)
- Call apiCreateCaret(hwnd, 0&, intX, intY)
- Call apiShowCaret(hwnd)
- End Sub
- Function fhWnd(ctl As Control) As Long
- On Error Resume Next
- ctl.SetFocus
- If Err Then
- fhWnd = 0
- Else
- fhWnd = apiGetFocus
- End If
- On Error GoTo 0
- End Function
- Private Sub Form_GotFocus()
- sMakeCaret Me.Text0, 10, 10
- End Sub
复制代码
令人迷惑的是,执行上面的代码并不能在ACCESS感觉有任务改变,用GetSystemMetrics查看光标的大小也没任何变化
备注:在VB能正常调用位图 |
|