Создание классов и справочной информации

Страницы работы

Содержание работы

Министерство образования и науки РФ

Новосибирский государственный технический университет

Лабораторные работы №7

Создание классов и справочной информации

Группа:       АМ-211

Студент:     Слуцкий А.А.                 Преподаватель:    Трошина Г.В.

Вариант:     2

Новосибирск

2005

Цель работы: изучить средства Visual FoxPro 6.0, которые могут быть использованы для создания пользовательских классов. Получить практические навыки работы с классами.

Игра заключается в том, что нужно убрать все галочки с экрана, которые выставляются произвольно при нажатии на кнопку «Сбросить время!»

Сложность заключается в том, что при нажатии на любой из флажков инвертируются все флажки в его столбце и строчке.

При выполнении задания выводится MESSAGEBOX поздравляющий с победой.

Описание класса:

Класс наследован от класса CONTAINER и содержит копии:

            25 Check;

            1 Text;

            1 Button;

            1 Label;

            1 Taimer.

Check1.Click:

if This.Parent.Check2.value=0

This.Parent.Check2.value=1

else

This.Parent.Check2.value=0

endif

if This.Parent.Check3.value=0

This.Parent.Check3.value=1

else

This.Parent.Check3.value=0

endif

if This.Parent.Check4.value=0

This.Parent.Check4.value=1

else

This.Parent.Check4.value=0

endif

if This.Parent.Check5.value=0

This.Parent.Check5.value=1

else

This.Parent.Check5.value=0

endif

if This.Parent.Check6.value=0

This.Parent.Check6.value=1

else

This.Parent.Check6.value=0

endif

if This.Parent.Check11.value=0

This.Parent.Check11.value=1

else

This.Parent.Check11.value=0

endif

if This.Parent.Check16.value=0

This.Parent.Check16.value=1

else

This.Parent.Check16.value=0

endif

if This.Parent.Check21.value=0

This.Parent.Check21.value=1

else

This.Parent.Check21.value=0

endif

if This.Parent.Check1.value=0 and ;

This.Parent.Check2.value=0 and ;

This.Parent.Check3.value=0 and ;

This.Parent.Check4.value=0 and ;

This.Parent.Check5.value=0 and ;

This.Parent.Check6.value=0 and ;

This.Parent.Check7.value=0 and ;

This.Parent.Check8.value=0 and ;

This.Parent.Check9.value=0 and ;

This.Parent.Check10.value=0 and ;

This.Parent.Check11.value=0 and ;

This.Parent.Check12.value=0 and ;

This.Parent.Check13.value=0 and ;

This.Parent.Check14.value=0 and ;

This.Parent.Check15.value=0 and ;

This.Parent.Check16.value=0 and ;

This.Parent.Check17.value=0 and ;

This.Parent.Check18.value=0 and ;

This.Parent.Check19.value=0 and ;

This.Parent.Check20.value=0 and ;

This.Parent.Check21.value=0 and ;

This.Parent.Check22.value=0 and ;

This.Parent.Check23.value=0 and ;

This.Parent.Check24.value=0 and ;

This.Parent.Check25.value=0

MESSAGEBOX('Вы выиграли!!!',0,'Победа!')

endif

Остальные переключатели имеют такую же структуру, меняются только имена инвертируемых переключателей.

Timer1.Timer:

if !( This.Parent.Check1.value=0 and ;

This.Parent.Check2.value=0 and ;

This.Parent.Check3.value=0 and ;

This.Parent.Check4.value=0 and ;

This.Parent.Check5.value=0 and ;

This.Parent.Check6.value=0 and ;

This.Parent.Check7.value=0 and ;

This.Parent.Check8.value=0 and ;

This.Parent.Check9.value=0 and ;

This.Parent.Check10.value=0 and ;

This.Parent.Check11.value=0 and ;

This.Parent.Check12.value=0 and ;

This.Parent.Check13.value=0 and ;

This.Parent.Check14.value=0 and ;

This.Parent.Check15.value=0 and ;

This.Parent.Check16.value=0 and ;

This.Parent.Check17.value=0 and ;

This.Parent.Check18.value=0 and ;

This.Parent.Check19.value=0 and ;

This.Parent.Check20.value=0 and ;

This.Parent.Check21.value=0 and ;

This.Parent.Check22.value=0 and ;

This.Parent.Check23.value=0 and ;

This.Parent.Check24.value=0 and ;

This.Parent.Check25.value=0 )

This.Parent.Text1.value=This.Parent.Text1.value+1

endif

Comand1.Click:

This.Parent.Text1.value=0

k=RAND( )

if k>0.5

This.Parent.Check1.value=1

else

This.Parent.Check1.value=0

endif

k=RAND( )

if k>0.5

This.Parent.Check2.value=1

else

This.Parent.Check2.value=0

endif

k=RAND( )

if k>0.5

This.Parent.Check3.value=1

else

This.Parent.Check3.value=0

endif

k=RAND( )

if k>0.5

This.Parent.Check4.value=1

else

This.Parent.Check4.value=0

endif

k=RAND( )

if k>0.5

This.Parent.Check5.value=1

else

This.Parent.Check5.value=0

endif

k=RAND( )

if k>0.5

This.Parent.Check6.value=1

else

This.Parent.Check6.value=0

endif

k=RAND( )

if k>0.5

This.Parent.Check7.value=1

else

This.Parent.Check7.value=0

endif

k=RAND( )

if k>0.5

This.Parent.Check8.value=1

else

This.Parent.Check8.value=0

endif

k=RAND( )

if k>0.5

This.Parent.Check9.value=1

else

This.Parent.Check9.value=0

endif

k=RAND( )

if k>0.5

This.Parent.Check10.value=1

else

This.Parent.Check10.value=0

endif

k=RAND( )

if k>0.5

This.Parent.Check11.value=1

else

This.Parent.Check11.value=0

endif

k=RAND( )

if k>0.5

This.Parent.Check12.value=1

else

This.Parent.Check12.value=0

endif

k=RAND( )

if k>0.5

This.Parent.Check13.value=1

else

This.Parent.Check13.value=0

endif

k=RAND( )

if k>0.5

This.Parent.Check14.value=1

else

This.Parent.Check14.value=0

endif

k=RAND( )

if k>0.5

This.Parent.Check15.value=1

else

This.Parent.Check15.value=0

endif

k=RAND( )

if k>0.5

This.Parent.Check16.value=1

else

This.Parent.Check16.value=0

endif

k=RAND( )

if k>0.5

This.Parent.Check17.value=1

else

This.Parent.Check17.value=0

endif

k=RAND( )

if k>0.5

This.Parent.Check18.value=1

else

This.Parent.Check18.value=0

endif

k=RAND( )

if k>0.5

This.Parent.Check19.value=1

else

This.Parent.Check19.value=0

endif

k=RAND( )

if k>0.5

This.Parent.Check20.value=1

else

This.Parent.Check20.value=0

endif

k=RAND( )

if k>0.5

This.Parent.Check21.value=1

else

This.Parent.Check21.value=0

endif

k=RAND( )

if k>0.5

This.Parent.Check22.value=1

else

This.Parent.Check22.value=0

endif

k=RAND( )

if k>0.5

This.Parent.Check23.value=1

else

This.Parent.Check23.value=0

endif

k=RAND( )

if k>0.5

This.Parent.Check24.value=1

else

This.Parent.Check24.value=0

endif

k=RAND( )

if k>0.5

This.Parent.Check25.value=1

else

This.Parent.Check25.value=0

endif


Справочная система:


Выводы:

Классы позволяют легко создавать пользовательские элементы управления. Благодаря возможностям наследования можно легко расширить функциональность или специализировать существующие классы элементов управления.

Похожие материалы

Информация о работе

Предмет:
Базы данных
Тип:
Отчеты по лабораторным работам
Размер файла:
92 Kb
Скачали:
0