ATOUTFOX
COMMUNAUTÉ FRANCOPHONE DES PROFESSIONNELS FOXPRO
Visual FoxPro : le développement durable

Form et Transparence   



L'auteur

Francis Faure
France France
Membre Actif (personne physique)
# 0000000001
enregistré le 11/10/2004

http://www.wanagain.net
56 ans
Faure Francis
de la société Design Or Decline
Fiche personnelle


Note des membres
pas de note

Contributions > 02 - SCX : Formulaires

Form et Transparence
# 0000000342
ajouté le 13/07/2006 18:01:09 et modifié le 13/07/2006
consulté 8524 fois
Niveau initié

Version(s) Foxpro :
VFP 9.0

Zoomer sur l'image

Télécharger le ZIP (4.99 Ko)
Description

J'ai cherché à rendre une couleur transparente dans un form (à l'exécution) ...
au moyen des exemples vfp et du coup de main de Fred pour les API (merci Fred)
je vous propose la solution suivante.

Dans cet exemple la couleur Fushia rgb(255,0,255), deviendra transparente... à l'exécution
en ajoutant le code VFP suivant à l'init du formulaire

Exemple ci joint aussi

Cordialement

Francis Faure

 PS : le formulaire doit obligatoirement avoir la propriété ShowWindow = 2

Code source :
DODEFAULT()
IF VAL(OS(3))>=5

  * Windows 2000 minimum
  DECLARE INTEGER GetWindowLong IN user32.DLL INTEGER hWndINTEGER nIndex
  DECLARE INTEGER SetWindowLong IN user32.DLL INTEGER hWndINTEGER nIndex, INTEGER dwNewLong
  DECLARE INTEGER SetLayeredWindowAttributes IN WIN32API INTEGER HWND,  INTEGER crKey, INTEGER bAlpha, INTEGER dwFlags

  *Constants for SetWindowLong and GetWindowLong
  #DEFINE GWL_EXSTYLE    -20
  #DEFINE WS_EX_LAYERED  0x00080000

  *Constants for SetLayeredWindowAttributs
  #DEFINE LWA_COLORKEY  1
  #DEFINE LWA_ALPHA    2

  LOCAL lnFlags
  lnFlags = GetWindowLong(thisform.HWnd, GWL_EXSTYLE)
  if bitand(lnFlags, WS_EX_LAYERED)<>0
  else
    lnFlags = BITOR(lnFlags, WS_EX_LAYERED)
    SetWindowLong(thisform.HWnd, GWL_EXSTYLE, lnFlags)
    SetLayeredWindowAttributes(thisform.HWndRGB(255,0,255), 0, LWA_COLORKEY)
  endif

  CLEAR DLLS GetWindowLong, SetWindowLong, SetLayeredWindowAttributes

endif



Commentaires
le 13/07/2006, FredA a écrit :
ouaip, on en déduit aisemment que plus il y a de trous, moins on a la form :)

j'adore personellement le clic dans une zone transparente

le 09/08/2006, Jissé a écrit :
Trop fort
Merci Francis
Jc


Publicité

Les pubs en cours :


www.atoutfox.org - Site de la Communauté Francophone des Professionnels FoxPro - v3.4.0 - © 2004-2024.
Cette page est générée par un composant COM+ développé en Visual FoxPro 9.0-SP2-HF3