Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum. Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !

ALLEZ, POUR S'AMUSER... UNE CLASSE FORMULAIRE D'ATTENTE STYLE MATRIX


Information sur la source

Description

Bah, rien d'important...
juste comment utiliser les anciennes fonctions du foxBase à des fins ludiques
 

Source

  • * Basé sur un code de Olaf Doschke
  • * et transformé en classe formulaire
  • * à reserver aux traitements
  • * qui ne souffriront pas d'un peu de CPU
  • * en moins ...
  • matrix = CREATEOBJECT("oMatrix", "INKEY(.01)=27")
  • matrix.show()
  • #DEFINE screenwidth 80
  • #DEFINE screenheight 30
  • DEFINE CLASS oMatrix as Form
  • backcolor=RGB(0,0,0)
  • fontname="Courier New"
  • Caption="Reloadding..."
  • FUNCTION init
  • PARAMETERS cBreakCondition
  • SET TALK off
  • this.Width=screenwidth * FONTMETRIC(7, this.FontName, this.FontSize)
  • this.Height=screenheight * FONTMETRIC(1, this.FontName, this.FontSize)+SYSMETRIC(9)
  • this.AddProperty("BreakCondition", cBreakCondition)
  • ENDFUNC
  • FUNCTION activate
  • DIMENSION protectedpositions[screenwidth,screenheight]
  • DIMENSION trails[screenwidth,2]
  • LOCAL cBreakCondition
  • cBreakCondition = this.BreakCondition
  • FOR x = 1 TO screenwidth
  • FOR Y = 1 TO screenheight
  • protectedpositions[x,y] = CHR(0)
  • ENDFOR Y
  • ENDFOR x
  • DO WHILE .T.
  • FOR ii = 1 TO 42
  • x=INT(RAND()*screenwidth)
  • Y=INT(RAND()*screenheight)
  • IF protectedpositions[x+1,y+1] = CHR(0)
  • this.FORECOLOR = RGB(0,RAND()*208,0)
  • @Y,x SAY CHR(RAND()*224+32)
  • ENDIF
  • ENDFOR ii
  • lntrail = RAND()*screenwidth+1
  • IF EMPTY(trails[lntrail,1])
  • trails[lntrail,1] = 1.0
  • trails[lntrail,2] = RAND()*2.0+0.5
  • ENDIF
  • FOR lntrail = 1 TO screenwidth
  • IF !EMPTY(trails[lntrail,1])
  • lngreen = 255
  • lcchar = CHR(RAND()*224+32)
  • this.FORECOLOR = RGB(0,lngreen,0)
  • Y = INT(trails[lntrail,1])
  • IF Y<screenheight
  • @ Y,lntrail-1 SAY lcchar
  • protectedpositions[lntrail,y+1] = lcchar
  • ENDIF
  • FOR Y = Y-1 TO 0 STEP -1
  • lngreen = MAX(lngreen - 7,0)
  • IF lngreen >0
  • this.FORECOLOR = RGB(0,lngreen,0)
  • IF Y<screenheight
  • @ Y,lntrail -1 SAY protectedpositions[lntrail,y+1]
  • ENDIF
  • ELSE
  • IF Y<screenheight
  • protectedpositions[lntrail,y+1] = CHR(0)
  • ENDIF
  • ENDIF
  • ENDFOR Y
  • trails[lntrail,1] = trails[lntrail,1] + trails[lntrail,2]
  • IF trails[lntrail,1] > 1.5 * screenheight
  • trails[lntrail,1] = 0
  • FOR Y = 1 TO screenheight
  • protectedpositions[lntrail,y] = CHR(0)
  • this.FORECOLOR = RGB(0,0,0)
  • @ Y,lntrail-1 SAY ' '
  • ENDFOR Y
  • ENDIF
  • ENDIF
  • ENDFOR lntrail
  • cBreakCondition = this.BreakCondition
  • DOEVENTS && FORCE
  • IF &cBreakCondition
  • EXIT
  • ENDIF
  • ENDDO
  • RELEASE protectedpositions
  • RELEASE trails
  • this.release()
  • ENDFUNC
  • ENDDEFINE
* Basé sur un code de Olaf Doschke
* et transformé en classe formulaire 
* à reserver aux traitements
* qui ne souffriront pas d'un peu de CPU
* en moins ...

matrix = CREATEOBJECT("oMatrix", "INKEY(.01)=27")
matrix.show()

#DEFINE screenwidth 80
#DEFINE screenheight 30

DEFINE CLASS oMatrix as Form
backcolor=RGB(0,0,0)
fontname="Courier New"
Caption="Reloadding..."

FUNCTION init
PARAMETERS cBreakCondition
	SET TALK off
	this.Width=screenwidth * FONTMETRIC(7, this.FontName, this.FontSize)
	this.Height=screenheight * FONTMETRIC(1, this.FontName, this.FontSize)+SYSMETRIC(9)
	this.AddProperty("BreakCondition", cBreakCondition)
ENDFUNC

FUNCTION activate
DIMENSION protectedpositions[screenwidth,screenheight]
DIMENSION trails[screenwidth,2]
LOCAL cBreakCondition 
cBreakCondition = this.BreakCondition

FOR x = 1 TO screenwidth
   FOR Y = 1 TO screenheight
      protectedpositions[x,y] = CHR(0)
   ENDFOR Y
ENDFOR x

DO WHILE .T.
   FOR ii = 1 TO 42
      x=INT(RAND()*screenwidth)
      Y=INT(RAND()*screenheight)
      IF protectedpositions[x+1,y+1] = CHR(0)
         this.FORECOLOR = RGB(0,RAND()*208,0)
         @Y,x SAY CHR(RAND()*224+32) 
      ENDIF
   ENDFOR ii

   lntrail = RAND()*screenwidth+1
   IF EMPTY(trails[lntrail,1])
      trails[lntrail,1] = 1.0
      trails[lntrail,2] = RAND()*2.0+0.5
   ENDIF

   FOR lntrail = 1 TO screenwidth
      IF !EMPTY(trails[lntrail,1])
         lngreen = 255
         lcchar = CHR(RAND()*224+32)
         this.FORECOLOR = RGB(0,lngreen,0)
         Y = INT(trails[lntrail,1])
         IF Y<screenheight
            @ Y,lntrail-1 SAY lcchar
            protectedpositions[lntrail,y+1] = lcchar
         ENDIF

         FOR Y = Y-1 TO 0 STEP -1
            lngreen = MAX(lngreen - 7,0)
            IF lngreen >0
               this.FORECOLOR = RGB(0,lngreen,0)
               IF Y<screenheight
                  @ Y,lntrail -1 SAY protectedpositions[lntrail,y+1]
               ENDIF
            ELSE
               IF Y<screenheight
                  protectedpositions[lntrail,y+1] = CHR(0)
               ENDIF
            ENDIF
         ENDFOR Y

         trails[lntrail,1] = trails[lntrail,1] + trails[lntrail,2]
         IF trails[lntrail,1] > 1.5 * screenheight
            trails[lntrail,1] = 0
            FOR Y = 1 TO screenheight
               protectedpositions[lntrail,y] = CHR(0)
               this.FORECOLOR = RGB(0,0,0)
               @ Y,lntrail-1 SAY ' '
            ENDFOR Y
         ENDIF
      ENDIF
   ENDFOR lntrail
   
	cBreakCondition = this.BreakCondition
	
    DOEVENTS && FORCE
	IF &cBreakCondition
		EXIT
	ENDIF
 
ENDDO
RELEASE protectedpositions
RELEASE trails
this.release()
ENDFUNC

ENDDEFINE


Conclusion

merci à Olaf Doschke pour la base de fonctionnement.
 

Commentaires et avis

signaler à un administrateur
Commentaire de FrancisFaure le 06/10/2004 15:40:23

C'est Sympa !

signaler à un administrateur
Commentaire de FredArmoni le 06/10/2004 16:21:44 administrateur CS

c'est gentil
;-)

signaler à un administrateur
Commentaire de HENOK le 06/08/2005 14:37:18

C'est bien et mérite encouragement.
Amicalement H.D.

signaler à un administrateur
Commentaire de psyb le 08/12/2006 16:08:09

C'est vraiment bien!
Il faut plus de codes comme ça dans Fox ;-)

Ajouter un commentaire

Discussions en rapport avec ce code source dans le forum

combobox dans un formulaire [ par brunaux ] Bonjour à tous !utilisant VFP 6.0 occasionnellement pour faire des écrans de saisie,je voudrais savoir comment l'on fait dans un combobox(donc avec un re-combobox dans formulaire [ par brunaux ] Bonjour !merci thierry et mike pour votre aide si précieuse,je vais pouvoir me débrouiller maintenant et arriver à faire quelque chose qui marche ! me formulaire ajustable [ par brunaux ] Bonjour !merci thierry pour la reponse pour ajuster automatiquement un formulaire suivant la taille de l'ecran de l'utilisateur !encore merci problème du serveur ole [ par h_adil ] j'ai inser&#233; un objet excel dabs une formulaire mais lorsque je passe du mode cr&#233;ation au moode formulaire j'ai un message qui apparait "&nbs Gestion d'objet [ par spoutnic_37 ] Salutation, &nbsp;&nbsp;&nbsp; Mon probleme est le suivant : comment faire un ensemble de formulaire grace &#224; visual foxpro 6, et g&#233;rer les Formulaire premier niveau et enfant . [ par spoutnic_37 ] aloha !!!&nbsp;&nbsp;&nbsp;Je voudrais faire apparaitre des formulaires enfants dans un formulaire parent. Je parametre donc avec showWindow et mdifor formulaire-->Excel [ par Domatreal ] Salut J'ai creer un formulaire et j'aimerais savoir si on pouvait exporter le resultat (tel qu'il&nbsp;apparait) dans un fichier excel.&nbsp;Merci bie a faire et ne pas faire en VFP [ par brunaux ] Je suis utilisateur occasionnel et en lisant une contribution dans ATOUTFOX il y a un article qui s'intitule ' a faire et ne pas faire en VFP' j'aimer pb d'exe ! [ par spoutnic_37 ] aloha ,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;j'ai un probleme avec mon executable. En fait j'ai un formulaire qui possede les bonnes tables dans l Formulaire [ par Domatreal ] Salut J'aimerais savoir comment on peut creer&nbsp;(a l'aide d'un programme) un formulaire en fonction de la structure d'une table quelconque.En d'aut


Nos sponsors

Sondage...

CalendriCode

Novembre 2008
LMMJVSD
     12
3456789
10111213141516
17181920212223
24252627282930

Consulter la suite du CalendriCode

Téléchargements

Logiciels à télécharger sur le même thème :



Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel BAÏSE, Merci à Vincent pour ses précieux conseils
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés
Temps d'éxécution de la page : 0,312 sec

Google Coop CodeS-SourceS Google Coop CodeS-SourceS


Certaines images présentes sur le site (notament certains avatars) sont issues des collections IconShock, donc si vous souhaitez utiliser ces icons vous devez les acheter, ne les copiez pas et ne utilisez pas dans vos sites et applications sans les avoir commandé.