USUÁRIO:      SENHA:        SALVAR LOGIN ?    Adicione o VBWEB na sua lista de favoritos   Fale conosco 

 

  Dicas

  Visual Basic    (Forms/MDI)

Título da Dica:  Está cansado do "visual cotidiano" de seus forms? Mude-o com poucas linhas!
Postada em 10/12/2003 por PC            
Option Explicit
Private Declare Function GetWindowLong Lib "user32" Alias _
        "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias _
        "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, _
        ByVal dwNewLong 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 Const GWL_EXSTYLE = (-20)
Private Const WS_EX_CLIENTEDGE = &H200
Private Const WS_EX_STATICEDGE = &H20000
Private Const SWP_FRAMECHANGED = &H20
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOOWNERZORDER = &H200
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOZORDER = &H4
Public Function AddOfficeBorder(ByVal hWnd As Long)
    Dim lngRetVal As Long
    lngRetVal = GetWindowLong(hWnd, GWL_EXSTYLE)
    lngRetVal = lngRetVal Or WS_EX_STATICEDGE And Not WS_EX_CLIENTEDGE
    SetWindowLong hWnd, GWL_EXSTYLE, lngRetVal
    SetWindowPos hWnd, 0, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE Or _
                 SWP_NOOWNERZORDER Or SWP_NOZORDER Or SWP_FRAMECHANGED
    
End Function
Public Sub changeForm(ByRef frmChng As Object)
    On Error GoTo EH
    Dim objCtrl As Control
    frmChng.Appearance = 0
    AddOfficeBorder (frmChng.hWnd)
    frmChng.BackColor = &H80000016
    For Each objCtrl In frmChng.Controls
        If Not TypeOf objCtrl Is Label Then
            objCtrl.Appearance = 0
            If TypeOf objCtrl Is TextBox Or _
                TypeOf objCtrl Is CommandButton Or _
                TypeOf objCtrl Is ComboBox Or _
                TypeOf objCtrl Is Frame Then
            '***************************************************************************************************************************************
            'se vc estiver usando MSFlex ou DTPIckers use esta linha ao invés da outra
            'If TypeOf objCtrl Is TextBox Or _
                TypeOf objCtrl Is CommandButton Or _
                TypeOf objCtrl Is ComboBox Or _
                TypeOf objCtrl Is Frame Or _
                TypeOf objCtrl Is MSHFlexGrid Or _
                TypeOf objCtrl Is DTPicker Then
            '***************************************************************************************************************************************
                
                AddOfficeBorder (objCtrl.hWnd)
            End If
            If TypeOf objCtrl Is TextBox Or _
                TypeOf objCtrl Is CommandButton Or _
                TypeOf objCtrl Is ComboBox Or _
                TypeOf objCtrl Is CheckBox Or _
                TypeOf objCtrl Is OptionButton Then
                
                objCtrl.BackColor = &H80000016
                objCtrl.BorderStyle = 0
            End If
            
            If TypeOf objCtrl Is CheckBox Or _
                TypeOf objCtrl Is OptionButton Then
                
                objCtrl.BackColor = &H8000000F
            End If
            If TypeOf objCtrl Is Frame Then
                objCtrl.BackColor = &H8000000F
            End If
        End If
    Next
    
EH:
    If Err.Number = 438 Then
        Resume Next
    End If
End Sub


Private Sub Form_Load()
'vc deve chamar isto...
Call changeForm(Me)
End Sub
 


CyberWEB Network Ltda.    © Copyright 2000-2024   -   Todos os direitos reservados.
Powered by HostingZone - A melhor hospedagem para seu site
Topo da página