Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

My Christmas Form 5

Status
Not open for further replies.

monikai

Programmer
Aug 4, 2002
358
PL
Hej, Friends !
I wrote this at pause in Christmas celebrating:

PUBLIC oform1

oform1=NEWOBJECT("gwiazda")
oform1.Show

RETURN

DEFINE CLASS gwiazda AS form
Top = 0
Left = 0
Height = 454
Width = 633
DoCreate = .T.
Caption = "Merry Christmas !!!"
BackColor = RGB(0,0,64)
Name = "gwiazda"

Add object gwiazda1 as label with ;
AutoSize = .T., ;
FontBold = .T., ;
FontSize = 48, ;
Caption = "*", ;
Height = 79, ;
Left = 0, ;
Top = 0, ;
Width = 27, ;
Name = "gwiazda1", ;
ForeColor = RGB(192,192,192), ;
BackColor = RGB(0,0,64)

Add object timer1 as timer with ;
Top = 324, ;
Left = 492, ;
Height = 61, ;
Width = 73, ;
Interval = 100, ;
Name = "Timer1"
PROCEDURE timer1.Timer
FOR i=1 to 25
zm_g='thisform.gwiazda'+alltrim(str(i))
zm_gl=zm_g+'.left'
IF &zm_gl<572
&zm_gl=&zm_gl+10*rand()
ELSE
&zm_gl=1
ENDIF
zm_gl=zm_g+'.top'
IF &zm_gl<392
&zm_gl=&zm_gl+10*rand()
ELSE
&zm_gl=1
ENDIF
zm_gl=zm_g+'.forecolor'
IF &zm_gl=65535
&zm_gl=12632256
ELSE
&zm_gl=65535
ENDIF
ENDFOR
ENDPROC

Add object gwiazda2 as label with ;
AutoSize = .T., ;
FontBold = .T., ;
FontSize = 48, ;
Caption = &quot;*&quot;, ;
Height = 79, ;
Left = 20, ;
Top = 0, ;
Width = 27, ;
Name = &quot;gwiazda2&quot;, ;
ForeColor = RGB(192,192,192), ;
BackColor = RGB(0,0,64)

Add object gwiazda3 as label with ;
AutoSize = .T., ;
FontBold = .T., ;
FontSize = 48, ;
Caption = &quot;*&quot;, ;
Height = 79, ;
Left = 40, ;
Top = 0, ;
Width = 27, ;
Name = &quot;gwiazda3&quot;, ;
ForeColor = RGB(192,192,192), ;
BackColor = RGB(0,0,64)

Add object gwiazda4 as label with ;
AutoSize = .T., ;
FontBold = .T., ;
FontSize = 48, ;
Caption = &quot;*&quot;, ;
Height = 79, ;
Left = 60, ;
Top = 0, ;
Width = 27, ;
Name = &quot;gwiazda4&quot;, ;
ForeColor = RGB(192,192,192), ;
BackColor = RGB(0,0,64)

Add object gwiazda5 as label with ;
AutoSize = .T., ;
FontBold = .T., ;
FontSize = 48, ;
Caption = &quot;*&quot;, ;
Height = 79, ;
Left = 80, ;
Top = 0, ;
Width = 27, ;
Name = &quot;gwiazda5&quot;, ;
ForeColor = RGB(192,192,192), ;
BackColor = RGB(0,0,64)

Add object gwiazda6 as label with ;
AutoSize = .T., ;
FontBold = .T., ;
FontSize = 48, ;
Caption = &quot;*&quot;, ;
Height = 79, ;
Left = 100, ;
Top = 0, ;
Width = 27, ;
Name = &quot;gwiazda6&quot;, ;
ForeColor = RGB(192,192,192), ;
BackColor = RGB(0,0,64)

Add object gwiazda7 as label with ;
AutoSize = .T., ;
FontBold = .T., ;
FontSize = 48, ;
Caption = &quot;*&quot;, ;
Height = 79, ;
Left = 120, ;
Top = 0, ;
Width = 27, ;
Name = &quot;gwiazda7&quot;, ;
ForeColor = RGB(192,192,192), ;
BackColor = RGB(0,0,64)

Add object gwiazda8 as label with ;
AutoSize = .T., ;
FontBold = .T., ;
FontSize = 48, ;
Caption = &quot;*&quot;, ;
Height = 79, ;
Left = 140, ;
Top = 0, ;
Width = 27, ;
Name = &quot;gwiazda8&quot;, ;
ForeColor = RGB(192,192,192), ;
BackColor = RGB(0,0,64)

Add object gwiazda9 as label with ;
AutoSize = .T., ;
FontBold = .T., ;
FontSize = 48, ;
Caption = &quot;*&quot;, ;
Height = 79, ;
Left = 160, ;
Top = 0, ;
Width = 27, ;
Name = &quot;gwiazda9&quot;, ;
ForeColor = RGB(192,192,192), ;
BackColor = RGB(0,0,64)

Add object gwiazda10 as label with ;
AutoSize = .T., ;
FontBold = .T., ;
FontSize = 48, ;
Caption = &quot;*&quot;, ;
Height = 79, ;
Left = 180, ;
Top = 0, ;
Width = 27, ;
Name = &quot;gwiazda10&quot;, ;
ForeColor = RGB(192,192,192), ;
BackColor = RGB(0,0,64)

Add object gwiazda11 as label with ;
AutoSize = .T., ;
FontBold = .T., ;
FontSize = 48, ;
Caption = &quot;*&quot;, ;
Height = 79, ;
Left = 200, ;
Top = 0, ;
Width = 27, ;
Name = &quot;gwiazda11&quot;, ;
ForeColor = RGB(192,192,192), ;
BackColor = RGB(0,0,64)

Add object gwiazda12 as label with ;
AutoSize = .T., ;
FontBold = .T., ;
FontSize = 48, ;
Caption = &quot;*&quot;, ;
Height = 79, ;
Left = 220, ;
Top = 0, ;
Width = 27, ;
Name = &quot;gwiazda12&quot;, ;
ForeColor = RGB(192,192,192), ;
BackColor = RGB(0,0,64)

Add object gwiazda13 as label with ;
AutoSize = .T., ;
FontBold = .T., ;
FontSize = 48, ;
Caption = &quot;*&quot;, ;
Height = 79, ;
Left = 240, ;
Top = 0, ;
Width = 27, ;
Name = &quot;gwiazda13&quot;, ;
ForeColor = RGB(192,192,192), ;
BackColor = RGB(0,0,64)

Add object gwiazda14 as label with ;
AutoSize = .T., ;
FontBold = .T., ;
FontSize = 48, ;
Caption = &quot;*&quot;, ;
Height = 79, ;
Left = 260, ;
Top = 0, ;
Width = 27, ;
Name = &quot;gwiazda14&quot;, ;
ForeColor = RGB(192,192,192), ;
BackColor = RGB(0,0,64)

Add object gwiazda15 as label with ;
AutoSize = .T., ;
FontBold = .T., ;
FontSize = 48, ;
Caption = &quot;*&quot;, ;
Height = 79, ;
Left = 280, ;
Top = 0, ;
Width = 27, ;
Name = &quot;gwiazda15&quot;, ;
ForeColor = RGB(192,192,192), ;
BackColor = RGB(0,0,64)

Add object gwiazda16 as label with ;
AutoSize = .T., ;
FontBold = .T., ;
FontSize = 48, ;
Caption = &quot;*&quot;, ;
Height = 79, ;
Left = 300, ;
Top = 0, ;
Width = 27, ;
Name = &quot;gwiazda16&quot;, ;
ForeColor = RGB(192,192,192), ;
BackColor = RGB(0,0,64)

Add object gwiazda17 as label with ;
AutoSize = .T., ;
FontBold = .T., ;
FontSize = 48, ;
Caption = &quot;*&quot;, ;
Height = 79, ;
Left = 320, ;
Top = 0, ;
Width = 27, ;
Name = &quot;gwiazda17&quot;, ;
ForeColor = RGB(192,192,192), ;
BackColor = RGB(0,0,64)

Add object gwiazda18 as label with ;
AutoSize = .T., ;
FontBold = .T., ;
FontSize = 48, ;
Caption = &quot;*&quot;, ;
Height = 79, ;
Left = 340, ;
Top = 0, ;
Width = 27, ;
Name = &quot;gwiazda18&quot;, ;
ForeColor = RGB(192,192,192), ;
BackColor = RGB(0,0,64)

Add object gwiazda19 as label with ;
AutoSize = .T., ;
FontBold = .T., ;
FontSize = 48, ;
Caption = &quot;*&quot;, ;
Height = 79, ;
Left = 360, ;
Top = 0, ;
Width = 27, ;
Name = &quot;gwiazda19&quot;, ;
ForeColor = RGB(192,192,192), ;
BackColor = RGB(0,0,64)

Add object gwiazda20 as label with ;
AutoSize = .T., ;
FontBold = .T., ;
FontSize = 48, ;
Caption = &quot;*&quot;, ;
Height = 79, ;
Left = 380, ;
Top = 0, ;
Width = 27, ;
Name = &quot;gwiazda20&quot;, ;
ForeColor = RGB(192,192,192), ;
BackColor = RGB(0,0,64)

Add object gwiazda21 as label with ;
AutoSize = .T., ;
FontBold = .T., ;
FontSize = 48, ;
Caption = &quot;*&quot;, ;
Height = 79, ;
Left = 400, ;
Top = 0, ;
Width = 27, ;
Name = &quot;gwiazda21&quot;, ;
ForeColor = RGB(192,192,192), ;
BackColor = RGB(0,0,64)

Add object gwiazda22 as label with ;
AutoSize = .T., ;
FontBold = .T., ;
FontSize = 48, ;
Caption = &quot;*&quot;, ;
Height = 79, ;
Left = 420, ;
Top = 0, ;
Width = 27, ;
Name = &quot;gwiazda22&quot;, ;
ForeColor = RGB(192,192,192), ;
BackColor = RGB(0,0,64)

Add object gwiazda23 as label with ;
AutoSize = .T., ;
FontBold = .T., ;
FontSize = 48, ;
Caption = &quot;*&quot;, ;
Height = 79, ;
Left = 440, ;
Top = 0, ;
Width = 27, ;
Name = &quot;gwiazda23&quot;, ;
ForeColor = RGB(192,192,192), ;
BackColor = RGB(0,0,64)

Add object gwiazda24 as label with ;
AutoSize = .T., ;
FontBold = .T., ;
FontSize = 48, ;
Caption = &quot;*&quot;, ;
Height = 79, ;
Left = 460, ;
Top = 0, ;
Width = 27, ;
Name = &quot;gwiazda24&quot;, ;
ForeColor = RGB(192,192,192), ;
BackColor = RGB(0,0,64)

Add object gwiazda25 as label with ;
AutoSize = .T., ;
FontBold = .T., ;
FontSize = 48, ;
Caption = &quot;*&quot;, ;
Height = 79, ;
Left = 480, ;
Top = 0, ;
Width = 27, ;
Name = &quot;gwiazda25&quot;, ;
ForeColor = RGB(192,192,192), ;
BackColor = RGB(0,0,64)

Add object nap1 as label with ;
AutoSize = .T., ;
FontBold = .T., ;
FontItalic = .T., ;
FontName = &quot;Arial&quot;, ;
FontSize = 28, ;
Caption = &quot;MERRY CHRISTMAS&quot;, ;
Height = 45, ;
Left = 132, ;
Top = 156, ;
Width = 367, ;
Name = &quot;NAP1&quot;, ;
ForeColor = RGB(192,192,192), ;
BackColor = RGB(0,0,64)

Add object nap2 as label with ;
AutoSize = .T., ;
FontBold = .T., ;
FontItalic = .T., ;
FontName = &quot;Arial&quot;, ;
FontSize = 28, ;
Caption = &quot;HAPPY NEW YEAR 2003&quot;, ;
Height = 45, ;
Left = 96, ;
Top = 216, ;
Width = 436, ;
Name = &quot;NAP2&quot;, ;
ForeColor = RGB(192,192,192), ;
BackColor = RGB(0,0,64)

Add object TIMER2 as TIMER with ;
Top = 336, ;
Left = 528, ;
Height = 61, ;
Width = 73, ;
Interval = 100, ;
Name = &quot;TIMER2&quot;

PROCEDURE TIMER2.Timer
IF thisform.NAP1.forecolor=65535
thisform.NAP1.forecolor=12632256
ELSE
thisform.NAP1.forecolor=65535
ENDIF
IF thisform.NAP2.forecolor=65535
thisform.NAP2.forecolor=12632256
ELSE
thisform.NAP2.forecolor=65535
ENDIF
ENDPROC

Do you suggest some changes ?
Kind regards from Warsaw !!!!!
Monika (monikai@yahoo.com)
 
Fun!
(I would have subclassed the snowflakes and created them with a FOR loop :) )
Dave S.
 
monikai

Excellent!! As Dave suggested I would have created one series of flakes and changed the Top and Left in a loop. Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
One thing Monica:

you forgot to put ENDDEFINE at the end.

Schastlivogo Swjatu, Happy holidays!

Regards,

Ilya
 
Monika,
Very,very good indeed!
Suggestion, you make a similar thing for YearEnd and we all from over the world will adjust with a flashing happy new year whish in our native language.
Koen
 
Hi Monika, Your idea is bright :):):)

1. Just a little compressed code and with snow effects.
2. Copy a Xmas.bmp to the directory where this file is kept. You can copy any suitable file as xmas.bmp. If the file is not kept.. the bmp will not be displayed. If it is a jpg.. then suitably change in the init event of the form.
3. I am sending a XMAS.BMP to monikais email. Cant help posting it here.
4. Added.. ESC cancellation of the form.
**********************************************
PUBLIC oform1

oform1=NEWOBJECT(&quot;gwiazda&quot;)
oform1.Show
RETURN

DEFINE CLASS gwiazda AS form

Height = 454
Width = 633
DoCreate = .T.
Caption = &quot;Merry Christmas !!!&quot;
BackColor = RGB(0,0,64)
Name = &quot;gwiazda&quot;
nSnow = 0

Add object nap1 as label with ;
AutoSize = .T., ;
BackStyle = 0, ;
FontBold = .T., ;
FontItalic = .T., ;
FontName = &quot;Arial&quot;, ;
FontSize = 28, ;
Caption = &quot;MERRY CHRISTMAS&quot;, ;
Height = 45, ;
Left = 132, ;
Top = 156, ;
Width = 367, ;
Name = &quot;NAP1&quot;, ;
ForeColor = 16711680

Add object nap2 as label with ;
AutoSize = .T., ;
BackStyle = 0, ;
FontBold = .T., ;
FontItalic = .T., ;
FontName = &quot;Arial&quot;, ;
FontSize = 28, ;
Caption = &quot;HAPPY NEW YEAR 2003&quot;, ;
Height = 45, ;
Left = 96, ;
Top = 216, ;
Width = 436, ;
Name = &quot;NAP2&quot;, ;
ForeColor = 255

PROCEDURE init
WITH ThisForm
.ADDOBJECT(&quot;Image1&quot;,&quot;Image&quot;)
WITH .Image1
.Picture = &quot;xmas.bmp&quot;
.Stretch = 2
.Width = ThisForm.Width
.Height = ThisForm.Height
.Zorder(1)
IF ! FILE(.Picture)
.Visible = .f.
ELSE
.Visible = .t.
ENDIF
ENDWITH
**
.nSNow = 50 && Max of t*i
FOR t=0 TO 5
FOR I=1 TO 10
cI = ALLTRIM(STR((t*10)+I))
.ADDOBJECT(&quot;gwiazda&cI&quot;,&quot;LABEL&quot;)
.gwiazda&cI..AutoSize = .T.
.gwiazda&cI..BackStyle = 0
.gwiazda&cI..FontBold = .T.
.gwiazda&cI..FontSize = 10
.gwiazda&cI..Caption = &quot;'&quot;
.gwiazda&cI..Left = (i*50) + (10*rand())
.gwiazda&cI..Top = (t*90) + (10*rand())
.gwiazda&cI..Name = &quot;gwiazda&cI&quot;
.gwiazda&cI..ForeColor = RGB(192,192,192)
.gwiazda&cI..Visible = .t.
ENDFOR
ENDFOR
.ADDOBJECT(&quot;Timer1&quot;,&quot;Timer1&quot;)
ENDWITH
ENDPROC

PROCEDURE KeyPress
LPARAMETERS nKeyCode, nShiftAltCtrl
IF nKeyCode = 27
ThisForm.Release()
ENDIF
ENDPROC

ENDDEFINE
**********************************************
DEFINE CLASS timer1 AS Timer
Interval = 100
Name = &quot;Timer1&quot;

PROCEDURE Timer

IF thisform.NAP1.forecolor=16711680
thisform.NAP1.forecolor=255
ELSE
thisform.NAP1.forecolor=16711680
ENDIF
IF thisform.NAP2.forecolor=16711680
thisform.NAP2.forecolor=255
ELSE
thisform.NAP2.forecolor=16711680
ENDIF
**
FOR i=1 to ThisForm.nSnow
zm_g='thisform.gwiazda'+alltrim(str(i))
zm_gl=zm_g+'.left'
IF &zm_gl<572
&zm_gl=&zm_gl+10*rand()
ELSE
&zm_gl=1
ENDIF
zm_gl=zm_g+'.top'
IF &zm_gl<392
&zm_gl=&zm_gl+10*rand()
ELSE
&zm_gl=1
ENDIF
ENDFOR
ENDPROC
ENDDEFINE
**********************************************
** EOF
**********************************************
Credits to Monikai :)
:)
ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
Merry Christmas & Happy New Year [bigears] [party] [2thumbsup]

 
Dave, Mike, Ilya, Koen, Ramani !
Very thanks for your advices. I'll try to do it better.
Ramani, your picture is beatiful ! Kind regards from Warsaw !!!!!
Monika (monikai@yahoo.com)
 
Monika, Ramani,
Cute.

Best Regards,
Scott

&quot;Everything should be made as simple as possible, and no simpler.&quot;[hammer]
 
Hi
It is a little extra celebration that Monika started a new thread:):). However, it should be OKIE. .. now look into the following thread for the revised code and simple adaptability :)
Our New Year Form
thread184-435380
:) ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
Merry Christmas & Happy New Year [bigears] [party] [2thumbsup]

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top