RSS    

   Реферат: Программирование логической игры на visual basic

If field(i, j) = 11 Then Label56.Caption = "B"

If field(i, j) = 11 Then Label56.BackColor = &H80FFFF

If field(i, j) = 11 Then Label56.ForeColor = &H80000008

If field(i, j) = 12 Then Label56.Caption = "Z"

If field(i, j) = 12 Then Label56.BackColor = &H40&

If field(i, j) = 12 Then Label56.ForeColor = &HFFFFFF

If field(i, j) = 13 Then Label56.Caption = "Z"

If field(i, j) = 13 Then Label56.BackColor = &H40&

If field(i, j) = 13 Then Label56.ForeColor = &HFFFFFF

If field(i, j) = 14 Then Label56.Caption = "End"

If field(i, j) = 14 Then Label56.BackColor = &HFF&

If field(i, j) = 14 Then Label56.ForeColor = &HFFFFFF

If field(i, j) = 15 Then Label56.Caption = "-10"

If field(i, j) = 15 Then Label56.BackColor = &HBBECF4

If field(i, j) = 15 Then Label56.ForeColor = &H80000008

If field(i, j) = 16 Then Label56.Caption = "-5"

If field(i, j) = 16 Then Label56.BackColor = &HBBECF4

If field(i, j) = 16 Then Label56.ForeColor = &H80000008

If field(i, j) = 17 Then Label56.Caption = "-1"

If field(i, j) = 17 Then Label56.BackColor = &HBBECF4

If field(i, j) = 17 Then Label56.ForeColor = &H80000008

If field(i, j) = 18 Then Label56.Caption = "+1"

If field(i, j) = 18 Then Label56.BackColor = &HBBECF4

If field(i, j) = 18 Then Label56.ForeColor = &H80000008

If field(i, j) = 19 Then Label56.Caption = "+5"

If field(i, j) = 19 Then Label56.BackColor = &HBBECF4

If field(i, j) = 19 Then Label56.ForeColor = &H80000008

End Sub

Теперь добавим копирование значения и атрибутов ячейки Label56 в ячейку игрового поля и используем несколько циклов для обработки всего массива field(8, 6):

- пример копирования

Label7.Caption = Label56.Caption

Label7.BackColor = Label56.BackColor

Label7.ForeColor = Label56.ForeColor

В итоге появится процедура Sub Field_Fill() копирования номиналов из «дежурной» ячейки Label56, а процедура Color_Chars() изменится следующим образом:

Private Sub Color_Chars()

If field(i, j) = 0 Then Label56.Caption = "+1"

If field(i, j) = 0 Then Label56.BackColor = &HBBECF4

If field(i, j) = 0 Then Label56.ForeColor = &H80000008

If field(i, j) = 1 Then Label56.Caption = "-1"

If field(i, j) = 1 Then Label56.BackColor = &HBBECF4

If field(i, j) = 1 Then Label56.ForeColor = &H80000008

If field(i, j) = 2 Then Label56.Caption = "+5"

If field(i, j) = 2 Then Label56.BackColor = &HBBECF4

If field(i, j) = 2 Then Label56.ForeColor = &H80000008

If field(i, j) = 3 Then Label56.Caption = "-5"

If field(i, j) = 3 Then Label56.BackColor = &HBBECF4

If field(i, j) = 3 Then Label56.ForeColor = &H80000008

If field(i, j) = 4 Then Label56.Caption = "+10"

If field(i, j) = 4 Then Label56.BackColor = &HBBECF4

If field(i, j) = 4 Then Label56.ForeColor = &H80000008

If field(i, j) = 5 Then Label56.Caption = "-10"

If field(i, j) = 5 Then Label56.BackColor = &HBBECF4

If field(i, j) = 5 Then Label56.ForeColor = &H80000008

If field(i, j) = 6 Then Label56.Caption = "+15"

If field(i, j) = 6 Then Label56.BackColor = &HBBECF4

If field(i, j) = 6 Then Label56.ForeColor = &H80000008

If field(i, j) = 7 Then Label56.Caption = "-15"

If field(i, j) = 7 Then Label56.BackColor = &HBBECF4

If field(i, j) = 7 Then Label56.ForeColor = &H80000008

If field(i, j) = 8 Then Label56.Caption = "+25"

If field(i, j) = 8 Then Label56.BackColor = &HBBECF4

If field(i, j) = 8 Then Label56.ForeColor = &H80000008

If field(i, j) = 9 Then Label56.Caption = "T"

If field(i, j) = 9 Then Label56.BackColor = &HABCFBB

If field(i, j) = 9 Then Label56.ForeColor = &H80000008

If field(i, j) = 10 Then Label56.Caption = "P"

If field(i, j) = 10 Then Label56.BackColor = &HFFC0C0

If field(i, j) = 10 Then Label56.ForeColor = &H80000008

If field(i, j) = 11 Then Label56.Caption = "B"

If field(i, j) = 11 Then Label56.BackColor = &H80FFFF

If field(i, j) = 11 Then Label56.ForeColor = &H80000008

If field(i, j) = 12 Then Label56.Caption = "Z"

If field(i, j) = 12 Then Label56.BackColor = &H40&

If field(i, j) = 12 Then Label56.ForeColor = &HFFFFFF

If field(i, j) = 13 Then Label56.Caption = "Z"

If field(i, j) = 13 Then Label56.BackColor = &H40&

If field(i, j) = 13 Then Label56.ForeColor = &HFFFFFF

If field(i, j) = 14 Then Label56.Caption = "End"

If field(i, j) = 14 Then Label56.BackColor = &HFF&

If field(i, j) = 14 Then Label56.ForeColor = &HFFFFFF

If field(i, j) = 15 Then Label56.Caption = "-10"

If field(i, j) = 15 Then Label56.BackColor = &HBBECF4

If field(i, j) = 15 Then Label56.ForeColor = &H80000008

If field(i, j) = 16 Then Label56.Caption = "-5"

If field(i, j) = 16 Then Label56.BackColor = &HBBECF4

If field(i, j) = 16 Then Label56.ForeColor = &H80000008

If field(i, j) = 17 Then Label56.Caption = "-1"

If field(i, j) = 17 Then Label56.BackColor = &HBBECF4

If field(i, j) = 17 Then Label56.ForeColor = &H80000008

If field(i, j) = 18 Then Label56.Caption = "+1"

If field(i, j) = 18 Then Label56.BackColor = &HBBECF4

If field(i, j) = 18 Then Label56.ForeColor = &H80000008

If field(i, j) = 19 Then Label56.Caption = "+5"

If field(i, j) = 19 Then Label56.BackColor = &HBBECF4

If field(i, j) = 19 Then Label56.ForeColor = &H80000008

'Label7.Caption = Label56.Caption

'Label7.BackColor = Label56.BackColor

'Label7.ForeColor = Label56.ForeColor

'Form1.Caption = field(0, 0)

End Sub

Private Sub Field_Fill()

'Копирование номиналов и атрибутов из «дежурной» ячейки  Label56

k = 0 ‘Счетчик ячеек

For j = 0 To 4

  For i = 0 To 7

  Color_Chars 'Поместить следующее значение из массива field(i, j) в Label56

                       ‘и вычислить цветовые атрибуты символа и фона по ее номиналу

  If k = 0 Then Label7.Caption = Label56.Caption

  If k = 0 Then Label7.BackColor = Label56.BackColor

  If k = 0 Then Label7.ForeColor = Label56.ForeColor

 

  If k = 1 Then Label8.Caption = Label56.Caption

  If k = 1 Then Label8.BackColor = Label56.BackColor

  If k = 1 Then Label8.ForeColor = Label56.ForeColor

 

  If k = 2 Then Label9.Caption = Label56.Caption

  If k = 2 Then Label9.BackColor = Label56.BackColor

  If k = 2 Then Label9.ForeColor = Label56.ForeColor

 

  If k = 3 Then Label10.Caption = Label56.Caption

  If k = 3 Then Label10.BackColor = Label56.BackColor

  If k = 3 Then Label10.ForeColor = Label56.ForeColor

 

  If k = 4 Then Label11.Caption = Label56.Caption

  If k = 4 Then Label11.BackColor = Label56.BackColor

  If k = 4 Then Label11.ForeColor = Label56.ForeColor

 

  If k = 5 Then Label12.Caption = Label56.Caption

  If k = 5 Then Label12.BackColor = Label56.BackColor

  If k = 5 Then Label12.ForeColor = Label56.ForeColor

 

  If k = 6 Then Label13.Caption = Label56.Caption

  If k = 6 Then Label13.BackColor = Label56.BackColor

  If k = 6 Then Label13.ForeColor = Label56.ForeColor

 

  If k = 7 Then Label14.Caption = Label56.Caption

  If k = 7 Then Label14.BackColor = Label56.BackColor

  If k = 7 Then Label14.ForeColor = Label56.ForeColor

 

  If k = 8 Then Label15.Caption = Label56.Caption

  If k = 8 Then Label15.BackColor = Label56.BackColor

  If k = 8 Then Label15.ForeColor = Label56.ForeColor

 

  If k = 9 Then Label16.Caption = Label56.Caption

  If k = 9 Then Label16.BackColor = Label56.BackColor

  If k = 9 Then Label16.ForeColor = Label56.ForeColor

 

  If k = 10 Then Label17.Caption = Label56.Caption

  If k = 10 Then Label17.BackColor = Label56.BackColor

  If k = 10 Then Label17.ForeColor = Label56.ForeColor

 

  If k = 11 Then Label18.Caption = Label56.Caption

  If k = 11 Then Label18.BackColor = Label56.BackColor

  If k = 11 Then Label18.ForeColor = Label56.ForeColor

 

  If k = 12 Then Label19.Caption = Label56.Caption

  If k = 12 Then Label19.BackColor = Label56.BackColor

  If k = 12 Then Label19.ForeColor = Label56.ForeColor

 

  If k = 13 Then Label20.Caption = Label56.Caption

  If k = 13 Then Label20.BackColor = Label56.BackColor

  If k = 13 Then Label20.ForeColor = Label56.ForeColor

 

  If k = 14 Then Label21.Caption = Label56.Caption

  If k = 14 Then Label21.BackColor = Label56.BackColor

  If k = 14 Then Label21.ForeColor = Label56.ForeColor

 

  If k = 15 Then Label22.Caption = Label56.Caption

  If k = 15 Then Label22.BackColor = Label56.BackColor

  If k = 15 Then Label22.ForeColor = Label56.ForeColor

 

  If k = 16 Then Label23.Caption = Label56.Caption

  If k = 16 Then Label23.BackColor = Label56.BackColor

Страницы: 1, 2, 3, 4, 5


Новости


Быстрый поиск

Группа вКонтакте: новости

Пока нет

Новости в Twitter и Facebook

                   

Новости

© 2010.