Оценить:
 Рейтинг: 0

Справочник Жаркова по проектированию и программированию искусственного интеллекта. Том 6: Программирование на Visual Basic искусственного интеллекта. Продолжение 2

Год написания книги
2023
Теги
<< 1 ... 13 14 15 16 17 18 19 20 21 ... 57 >>
На страницу:
17 из 57
Настройки чтения
Размер шрифта
Высота строк
Поля

''' Set up the entries for new scores.

''' </summary>

''' <remarks></remarks>

Shared Sub SetUpHighScores()

Dim scoreKey As RegistryKey = Registry.CurrentUser. _

CreateSubKey("Software\VBSamples\Collapse\HighScores")

If scoreKey.GetValue("Place1") Is Nothing Then

scoreKey.SetValue("Place0", " :0")

scoreKey.SetValue("Place1", " :0")

scoreKey.SetValue("Place2", " :0")

End If

scoreKey.Close()

End Sub

''' <summary>

''' Reset scores.

''' </summary>

''' <remarks></remarks>

Shared Sub ResetScores()

Dim scoreKey As RegistryKey = Registry.CurrentUser. _

CreateSubKey("Software\VBSamples\Collapse\HighScores")

scoreKey.SetValue("Place0", " :0")

scoreKey.SetValue("Place1", " :0")

scoreKey.SetValue("Place2", " :0")

scoreKey.Close()

End Sub

End Class

По второму варианту, в панели Solution Explorer выполняем правый щелчок по имени проекта и в контекстном меню выбираем Add, New Item, в панели Add New Item выделяем шаблон Code File, в окне Name записываем имя PointTranslator.vb и щёлкаем кнопку Add. В проект (и в панель Solution Explorer) добавляется этот файл, открывается пустое окно редактирования кода, в которое записываем код со следующего листинга.

Листинг 20.20. Новый файл.

''' <summary>

''' Form coordinates have the top, left as (0,0). For the game grid,

''' it is easier to have the bottom left of the grid as (0,0). This

''' translates the points.

''' </summary>

''' <remarks></remarks>

Public Class PointTranslator

Private Shared graphicsValue As Graphics

Private Shared height As Integer

Public Shared Property Graphics() As Graphics

Get

Return graphicsValue

End Get

Set(ByVal Value As Graphics)

graphicsValue = Value

height = CInt(graphicsValue.VisibleClipBounds.Height())

End Set

End Property

' Translates an (X,Y) point from the top left to

' an (X, Y) point from the bottom left.

Public Shared Function TranslateToBL(ByVal topleft As Point) _

As Point
<< 1 ... 13 14 15 16 17 18 19 20 21 ... 57 >>
На страницу:
17 из 57

Другие электронные книги автора Валерий Алексеевич Жарков