可以写字也可以在上面画画,写字的我写好了,画画的就你自己来了 ^_^Option Explicit Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As LongPrivate Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long Private Declare Function TextOut Lib "gdi32" Alias "TextOutA" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As String, ByVal nCount As Long) As LongPrivate Sub Command1_Click() If WriteOnFlashWindow("你好!我是绿豆!") Then MsgBox "成功了~~" Else MsgBox "失败了~~" End If End SubFunction FindFlashWindow(ByVal hWndParent As Long) As Long FindFlashWindow = FindWindowEx(hWndParent, 0&, "MacromediaFlashPlayerActiveX", "") End FunctionFunction WriteOnFlashWindow(ByVal sWord As String) As Boolean On Error Resume Next Dim hWndFlash As Long Dim hDCFlash As Long
sWord = "Hello World!" hWndFlash = FindFlashWindow(Form1.hwnd) If hWndFlash Then hDCFlash = GetDC(hWndFlash) If hDCFlash Then TextOut hDCFlash, 0, 0, sWord, Len(sWord) ReleaseDC hWndFlash, hDCFlash End If End If WriteOnFlashWindow = (Err.Number = 0) End Function
如果又要上面又要透明,就应该在控件的paint事件中textout.
我的意思不一定硬是要用LABEL控件来达到这个目的,如果有其它的好用的有透明功能的且也有句柄的控件就好了。或者可以有什么其它的方法可以实现?比如我现在确实要在做好的FLASH动画上叠加字要如何做呢?
alt + v,粘贴到所显示的控件上
我不知道平的PICBOX是什么意思,且PICBOX不能透明去掉背景啊。我现在的意图恐怕你没弄明白。我是要在具有活动背景上放置文字,比如GIF,FLASH控件上这样做出来的画面就会生动得多。
lhwnd = FindWindowEx(lhwnd, 0, sclassname, vbNullString)
这样获取flash控件的句柄,再在上面画
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As LongPrivate Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Private Declare Function TextOut Lib "gdi32" Alias "TextOutA" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As String, ByVal nCount As Long) As LongPrivate Sub Command1_Click()
If WriteOnFlashWindow("你好!我是绿豆!") Then
MsgBox "成功了~~"
Else
MsgBox "失败了~~"
End If
End SubFunction FindFlashWindow(ByVal hWndParent As Long) As Long
FindFlashWindow = FindWindowEx(hWndParent, 0&, "MacromediaFlashPlayerActiveX", "")
End FunctionFunction WriteOnFlashWindow(ByVal sWord As String) As Boolean
On Error Resume Next
Dim hWndFlash As Long
Dim hDCFlash As Long
sWord = "Hello World!"
hWndFlash = FindFlashWindow(Form1.hwnd)
If hWndFlash Then
hDCFlash = GetDC(hWndFlash)
If hDCFlash Then
TextOut hDCFlash, 0, 0, sWord, Len(sWord)
ReleaseDC hWndFlash, hDCFlash
End If
End If
WriteOnFlashWindow = (Err.Number = 0)
End Function
非常感谢,试了确实可以在上面写字,但是有两个问题不是我想要的。
1、背景不透明,是一个白色背景框上出字。
2、不能持久,只要背景的FLASH动画换场景就会将刚刚写上去的东东刷掉,这样就达不到我最初的初衷了。
me.currentx=****
me.currenty=5467456
me.print "sdfasfasfasdf"
对于透明处理,我在想是否可以用bitblt+mask来解决
呵呵,各位说呢?
我做了一个,你要吗?
若需要该控件,请将Mail发短消息给我.
没想过在FLASH上放个LABEL!
用SetWindowLong或者一个进程内钩子截取Flash控件的WM_TIMER消息,在这个消息中试试,也许行,因为跟Flash控件刷新速度是一致的。