7,763
社区成员
发帖
与我相关
我的任务
分享
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 Const BS_CENTER& = &H300&
Private Const BS_LEFT& = &H100&
Private Const BS_RIGHT& = &H200&
Private Const BS_TOP& = &H400&
Private Const GWL_STYLE& = (-16)
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_TRANSPARENT = &H20&
Private Const WS_THICKFRAME = &H40000
Private Const WS_BORDER = &H400000
Private Const WS_EX_CLIENTEDGE = &H200&
'API Calls
Private Declare Function GetWindowLong& Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long)
Private Declare Function SetWindowLong& Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long)
Private Declare Function FlashWindow Lib "user32" (ByVal hwnd As Long, ByVal bInvert As Long) As Long
Const SWP_DRAWFRAME = &H20
Const SWP_NOMOVE = &H2
Const SWP_NOSIZE = &H1
Const SWP_NOZORDER = &H4
Const SWP_FRAMECHANGED = &H20 ' The frame changed: send WM_NCCALCSIZE
Private Sub Command1_Click()
Dim tmpValue&, ret&
Dim Align&
'Check if the state is checked
tmpValue& = (GetWindowLong&(Text1.hwnd, GWL_STYLE) Or WS_THICKFRAME) And Not WS_BORDER
ret& = SetWindowLong&(Text1.hwnd, GWL_STYLE, tmpValue&)
SetWindowPos Text1.hwnd, Me.hwnd, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE Or SWP_NOZORDER Or SWP_DRAWFRAME
Text1.Refresh
End Sub
Option Explicit
Private Sub UserControl_Initialize()
UserControl.BackColor = 0
UserControl.ScaleMode = vbPixels
Text1.BorderStyle = 0
End Sub
Private Sub UserControl_Resize()
Text1.Move 1, 1, UserControl.ScaleWidth - 2, UserControl.ScaleHeight - 2
End Sub
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
Text1.Text = PropBag.ReadProperty("Text")
UserControl.BackColor = PropBag.ReadProperty("BorderColor")
End Sub
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
Call PropBag.WriteProperty("Text", Text1.Text)
Call PropBag.WriteProperty("BorderColor", UserControl.BackColor)
End Sub
Public Property Get Text() As String
Text = Text1.Text
End Property
Public Property Let Text(ByVal New_Value As String)
Text1.Text = New_Value
UserControl.PropertyChanged "Text"
End Property
Public Property Get BorderColor() As OLE_COLOR
BorderColor = UserControl.BackColor
End Property
Public Property Let BorderColor(ByVal New_Value As OLE_COLOR)
UserControl.BackColor = New_Value
UserControl.PropertyChanged "BorderColor"
End Property
Private Sub Form_Load()
Timer1.Interval = 200
End Sub
Private Sub Timer1_Timer()
Static i As Long
Text1.BackColor = QBColor(i)
i = i + 1
If i Mod 15 = 0 Then i = 0
End Sub