 |
VFP 愛用者社區 本討論區為 Visual Foxpro 愛用者經驗交流的地方, 請多多利用"搜尋"的功能, 先查看看有無前例可循, 如果還有不懂的再發問. 部份主題有附加檔案, 須先註冊成為社區居民才可以下載.
|
上一篇主題 :: 下一篇主題 |
發表人 |
內容 |
sheuok
註冊時間: 2004-11-20 文章: 63 來自: Taiwan
第 1 樓
|
發表於: 星期五 五月 13, 2005 11:57 pm 文章主題: 使用VB寫成的 ToolTip 的程序,那個高手幫忙改寫成VFP程序???? |
|
|
以下為使用VB寫成的 ToolTip 的程序,那個高手幫忙改寫成VFP程序????
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Type TOOLINFO
cbSize As Long
uFlags As Long
hwnd As Long
uId As Long
cRect As RECT
hinst As Long
lpszText As String
End Type
Private Declare Function CreateWindowEx Lib "user32" Alias _
"CreateWindowExA" (ByVal dwExStyle As Long, _
ByVal lpClassName As String, ByVal lpWindowName As String, _
ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long, _
ByVal nWidth As Long, ByVal nHeight As Long, _
ByVal hWndParent As Long, ByVal hMenu As Long, _
ByVal hInstance As Long, lpParam As Any) As Long
Private Declare Function DestroyWindow Lib "user32" _
(ByVal hwnd As Long) As Long
Private Declare Sub InitCommonControls Lib "comctl32.dll" ()
Private Declare Function SendMessage Lib "user32.dll" Alias _
"SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, lParam As Any) As Long
Private Const WM_USER = &H400
Private Const TTM_ADDTOOL = WM_USER + 4
Private Const TTM_SETMAXTIPWIDTH = WM_USER + 24
Private Const TTF_IDISHWND = &H1
Private Const TTF_SUBCLASS = &H10
Private hToolTip As Long
Private Sub Form_Load()
InitCommonControls
hToolTip = CreateWindowEx( _
0, "tooltips_class32", "", 0, 0, 0, 0, 0, 0, 0, 0, 0)
SendMessage hToolTip, TTM_SETMAXTIPWIDTH, 0, 300
SetMultiLineToolTip Command1.hwnd, _
"Das ist ein" & vbNewLine & "Test !"
SetMultiLineToolTip Command2.hwnd, "Bei Klick auf diesen" & _
vbNewLine & "Button wird das" & vbNewLine & _
"Programm beendet "
End Sub
Private Sub Command1_Click()
SetMultiLineToolTip Text1.hwnd, Text1.Text
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, _
UnloadMode As Integer)
DestroyWindow hToolTip
End Sub
Private Sub SetMultiLineToolTip(ByVal hwnd As Long, _
ByVal sToolTip As String)
Dim udtTool As TOOLINFO
With udtTool
.cbSize = Len(udtTool)
.hwnd = hwnd
.uFlags = TTF_IDISHWND Or TTF_SUBCLASS
.uId = hwnd
.lpszText = sToolTip
End With
SendMessage hToolTip, TTM_ADDTOOL, 0, udtTool
End Sub |
|
回頂端 |
|
 |
rixw83
註冊時間: 2004-07-12 文章: 12
第 2 樓
|
發表於: 星期六 六月 18, 2005 10:40 am 文章主題: |
|
|
VFP 物件本身就有 ToolTip 屬性啊
幹嘛要改寫這個???不解  _________________ It's Me And My Super Rich Kw. |
|
回頂端 |
|
 |
sheuok
註冊時間: 2004-11-20 文章: 63 來自: Taiwan
第 3 樓
|
發表於: 星期日 六月 19, 2005 2:04 am 文章主題: |
|
|
並非所有的VFP物件都有 ToolTip 的屬性,如 Ole 便沒有提供,會有以上的需求是因筆者使用Flash(Ole物件)當【按鈕】時,因Ole沒有ToolTip的
屬性,所以才會想自行寫出ToolTip的功能 ,現已解決,謝謝! |
|
回頂端 |
|
 |
|
|
您 無法 在這個版面發表文章 您 無法 在這個版面回覆文章 您 無法 在這個版面編輯文章 您 無法 在這個版面刪除文章 您 無法 在這個版面進行投票 您 無法 在這個版面附加檔案 您 無法 在這個版面下載檔案
|
|