Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to change back color
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Versions des environnements
Visual FoxPro:
VFP 8
Divers
Thread ID:
01035877
Message ID:
01035880
Vues:
13
For some activex, you can only do it with API calls, here is an example to change the backcolor of items in a Treeview.
DECLARE INTEGER SendMessage IN user32; 
        INTEGER hWnd, INTEGER Msg,; 
        INTEGER wParam, INTEGER lParam

    DECLARE INTEGER SetWindowLong IN user32.DLL ;
        INTEGER hWnd, INTEGER nIndex, INTEGER dwNewLong

    DECLARE INTEGER GetWindowLong IN user32.DLL ;
        INTEGER hWnd, INTEGER nIndex

GWL_STYLE = -16
TVM_SETBKCOLOR = 4381
TVM_SETTEXTCOLOR = 4382
TVM_GETBKCOLOR = 4383
TVM_GETTEXTCOLOR = 4384 
TVM_SETINSERTMARKCOLOR=4389 
TVM_GETINSERTMARKCOLOR=4390 
TVS_HASLINES = 2

colors=RGB(255,251,240)

FOR EACH node IN thisform.oletreeview.Nodes 
*    thisform.oletreeview.Nodes(x).BackColor  =colors
    node.backcolor = colors
NEXT
  DECLARE INTEGER SendMessage IN user32; 
        INTEGER hWnd, INTEGER Msg,; 
        INTEGER wParam, INTEGER lParam

    DECLARE INTEGER SetWindowLong IN user32.DLL ;
        INTEGER hWnd, INTEGER nIndex, INTEGER dwNewLong

    DECLARE INTEGER GetWindowLong IN user32.DLL ;
        INTEGER hWnd, INTEGER nIndex

GWL_STYLE = -16
TVM_SETBKCOLOR = 4381
TVM_SETTEXTCOLOR = 4382
TVM_GETBKCOLOR = 4383
TVM_GETTEXTCOLOR = 4384 
TVM_SETINSERTMARKCOLOR=4389 
TVM_GETINSERTMARKCOLOR=4390 
TVS_HASLINES = 2

colore=RGB(255,251,240)

FOR EACH node IN thisform.oletreeview.Nodes 
*    thisform.oletreeview.Nodes(x).BackColor  =colore
    node.backcolor = colore
NEXT 




=SendMessage(thisform.oletreeview.hWnd, TVM_SETBKCOLOR, ;
    0,colore) 
=SendMessage(thisform.oletreeview.hWnd, TVM_GETTEXTCOLOR , ;
 0,RGB(0,255,0)) 

lngStyle = GetWindowLong(thisform.oletreeview.hWnd, GWL_STYLE)
=SetWindowLong(thisform.oletreeview.hWnd, GWL_STYLE, ;
    lngStyle - TVS_HASLINES)
=SetWindowLong(thisform.oletreeview.hWnd, GWL_STYLE, lngStyle)
thisform.oletreeview.Refresh()
thisform.Refresh()
>Hi
>How can i change the back color of activex like treeview or WebBrowser?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform