24/04/2024
Windev et les Api WindowsNb de visiteurs en ligne : 1
>> Introduction << >> Codes et Forum << >> Download <<


Rubrique : 3 - Champs       Sujet : Static
Auteur Message
 °¨¨ JL ¨¨° Posté le : 23/06/2000 12:00:00


// Création d'un champ static
//Dans l'exemple suivant, le libellé est affiché à l'extérieur de la fenêtre  
//en mode topmost avec un cadre.

ss_left est un entier = 0
ss_center est un entier = 1
ss_right est un entier = 2
ws_visible est un entier long = 0x10000000
ws_child est un entier long = 0x40000000
ws_border est un entier long = 0x800000
ws_popup est un entier long = 0x80000000
ws_thickframe est un entier long = 0x40000
ws_ex_topmost est un entier long = 0x8

style est un entier long = ws_child + ws_visible + ws_border + ws_popup + ws_thickframe

hwndw=AppelDLL32("user32","CreateWindowExA", ws_ex_topmost , "STATIC" , "" , style , {fenencours()}..colonne , {fenencours()}..ligne-50 , {fenencours()}..largeur , 40 , handle() , null , instance() , NULL )
multitache()

appeldll32("user32","SetWindowTextA",hwndw,"Texte à gauche"+rc+tab+"Ligne 2")
multitache(-200)

appeldll32("user32","SetWindowLongA",hwndw,-16,style+ss_center)
appeldll32("user32","SetWindowTextA",hwndw,"Texte centrer")
multitache(-200)

appeldll32("user32","SetWindowLongA",hwndw,-16,style+ss_right)
appeldll32("user32","SetWindowTextA",hwndw,"Texte à droite")
multitache(-300)

appeldll32("user32","DestroyWindow",hwndw)




// ********************************
// Modifier la couleur de fond des champs static
// Ouverture de la fenêtre F_Static

global
erasebkgnd est un entier long = evenement("colorstatic",".*",0x14)
F_Static..etat=invisible
F_Static..etat=actif

// Fermeture de la fenêtre F_Static
finevenement(erasebkgnd)


Procédure colorstatic()

classname est une chaine asciiz de 128
appeldll32("user32","GetClassNameA",_EVE.hWnd , &classname,128)
si classname = "Static" alors

    // vous pouvez tester içi si _eve.nom = au(x) libellé(s) que vous voulez
    // car tous les champs 'static' sont concernés...

    rect est compose de
        l est un entier long
        t est un entier long
        r est un entier long
        b est un entier long
    fin

    rect.l = 0
    rect.t = 0
    rect.r = {_EVE.Nom}..largeur
    rect.b = {_EVE.Nom}..hauteur

    fondstatic est un entier long = appeldll32("gdi32","CreateSolidBrush", ijauneclair )
    appeldll32("user32","FillRect", _eve.wparam , &rect , fondstatic )
    appeldll32("gdi32","DeleteObject", fondstatic )
    _eve.retour = 1

fin