在窗体上放置一个标签label1标签上写上要显示的信息,以下是源代码:
Private Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hdc As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Sub Form_Load()
Timer1.Enabled = True
Timer1.Interval = 1000
Label1.BackStyle = 0
Me.AutoRedraw = True
xx = CreateCompatibleBitmap(Me.hdc, 0, 0)
SelectObject Me.hdc, xx
Me.Refresh
End Sub
Private Sub Timer1_Timer()
Me.Hide
Me.Show
Me.Refresh
Randomize
Label1.ForeColor = RGB(250 * Rnd, 250 * Rnd, 250 * Rnd)
SetWindowPos Me.hwnd, -1, 0, 0, 0, 0, 3
End Sub
这样就只显示文字了,其他部分都是透明的,而且总在最前。
无边框窗体,窗体只有一个标签,标签显示字符串,并且窗体在前端显示
把窗体的Caption设置成空 BorderStyle设置为0 TOP设置成0
在加个文本框或者标签在窗体最上边就行了
Caption=空的
BorderStyle=0
TOP=0
这样就OK了 大小自己适当调下