Рефераты. Электронный справочник по изучению Visual Basic

m_CmdCopyClip.Left = m_CmdTest.Left + m_CmdTest.Width

m_CmdCopyClip.Top = m_TBook.Height - 1000

m_CmdCopyClip.Height = 400

m_CmdCopyClip.Width = 1500

m_Back.Left = m_CmdCopyClip.Left + m_CmdCopyClip.Width

m_Back.Top = m_TBook.Height - 1000

m_Back.Height = 400

m_Back.Width = 1000

m_Home.Left = m_Back.Left + m_Back.Width

m_Home.Top = m_TBook.Height - 1000

m_Home.Height = 400

m_Home.Width = 1000

m_Forward.Left = m_Home.Left + m_Home.Width

m_Forward.Top = m_TBook.Height - 1000

m_Forward.Height = 400

m_Forward.Width = 1000

m_ThemeView.Left = iTheme + 100

m_ThemeView.Top = 0

m_ThemeView.Width = m_TBook.Width - (iTheme + 200)

m_ThemeView.Height = m_TBook.Height - 1000

m_BtnFullMode.Width = 100

m_BtnFullMode.Height = 1000

m_BtnFullMode.Left = iTheme

m_BtnFullMode.Top = m_TBook.Height / 2 - m_BtnFullMode.Height / 2

m_ExampleView.Left = iTheme + 100

m_ExampleView.Top = 0

m_ExampleView.Width = m_TBook.Width - (iTheme + 200)

m_ExampleView.Height = m_TBook.Height - 1000

m_ThemeList.Left = 0

m_ThemeList.Top = 0

m_ThemeList.Width = iTheme

m_ThemeList.Height = m_TBook.Height - 400

End Function

Private Sub Form_Resize()

If bFullMode Then

m_ThemeList.Visible = False

CtrlResize 0

Else

m_ThemeList.Visible = True

CtrlResize iThemeListWidth

End If

End Sub

Private Sub m_About_Click()

Load frmAbout

frmAbout.Show

End Sub

Private Sub m_NewBK_Click()

m_gBKPath = NavBKPath

Load m_FrmBookMark

m_FrmBookMark.Show 1

End Sub

Private Sub m_openBK_Click()

m_gBKPath = ""

Load m_FrmBookMark

m_FrmBookMark.Show 1

End Sub

Private Sub m_BtnFullMode_Click()

If bFullMode = True Then

bFullMode = False

Else

bFullMode = True

End If

Form_Resize

End Sub

Private Sub m_cmdCopyClip_Click()

Clipboard.SetText m_ExampleView.TextRTF

End Sub

Private Sub m_CmdSwitch_Click()

If m_CmdSwitch.Caption = "Тема" Then

m_CmdSwitch.Caption = "Пример"

m_ThemeView.Visible = True

m_ExampleView.Visible = False

m_CmdCopyClip.Visible = False

ElseIf m_CmdSwitch.Caption = "Пример" Then

m_CmdSwitch.Caption = "Тема"

m_ExampleView.Visible = True

m_ThemeView.Visible = False

m_CmdCopyClip.Visible = True

End If

End Sub

Private Sub m_CmdTest_Click()

If NavPath = "" Then Exit Sub

m_gTestPath = NavPath & "test.txt"

If Dir(m_gTestPath, vbNormal) <> "" Then

Load m_FrmTest

m_FrmTest.Show 1

End If

End Sub

Private Sub m_Back_Click()

On Error Resume Next

m_ThemeView.GoBack

End Sub

Private Sub m_Forward_Click()

On Error Resume Next

m_ThemeView.GoForward

End Sub

Private Sub m_Home_Click()

m_ThemeView.Navigate2 App.Path & "\StartPage.htm", navNoHistory

End Sub

Private Sub m_MenuPrint_Click()

On Error Resume Next

m_ThemeView.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DODEFAULT

End Sub

Private Sub m_MenuSave_Click()

m_ThemeView.ExecWB OLECMDID_SAVEAS, OLECMDEXECOPT_DODEFAULT

End Sub

Private Sub m_MenuFind_Click()

On Error Resume Next

' m_ThemeView.ExecWB OLECMDID_F, OLECMDEXECOPT_DODEFAULT

End Sub

Private Sub m_Quit_Click()

End

End Sub

Private Sub m_ThemeList_Expand(ByVal Node As MSComctlLib.Node)

Dim pNode As Node

Set pNode = Node.Child

If pNode.Text = SuperRootName Then

m_ThemeList.Nodes.Remove pNode.Index

Dim sFile As String

Dim i As Integer

sFile = Dir(App.Path & "\Themes\" & Node.Text & "\", vbDirectory)

Do Until sFile = ""

If sFile <> "." And sFile <> ".." Then

CreateSection sFile, Node.Key

End If

sFile = Dir

i = i + 1

Loop

End If

End Sub

Private Sub m_ThemeList_NodeClick(ByVal Node As MSComctlLib.Node)

If Node.Children Then Exit Sub

m_CmdSwitch.Enabled = True

NavPath = App.Path & "\Themes\" & Node.FullPath & "\"

NavBKPath = Node.FullPath

m_ThemeView.Navigate2 NavPath & SubjectFile, navNoHistory

If (Len(Dir(NavPath & ExampleFile))) <= 0 Then

m_ExampleView.Text = ""

Else

m_ExampleView.LoadFile NavPath & ExampleFile

End If

End Sub

II. mdl_Question.bas

Модуль для хранения глобальных переменных

Type Question

Question As String

Answer(2) As String

True As Integer

End Type

Public m_gTestPath As String

Public m_gBKPath As String

Public m_gBKNewName As String

III. m_FrmBookMark.frm

Форма управления закладками

Private Sub Form_Load()

On Error GoTo EndLoadForm

Dim pLine As String

m_bFindName = False

Open App.Path & "\bookmark.txt" For Input As #1

Do Until EOF(1)

Line Input #1, pLine

m_BKList.AddItem pLine

If m_bFindName = False Then

If pLine = m_gBKPath Then m_bFindName = True

End If

Loop

If m_bFindName = False And m_gBKPath <> "" Then

m_BKList.AddItem m_gBKPath

End If

Close #1

EndLoadForm:

End Sub

Private Sub Form_Unload(Cancel As Integer)

On Error GoTo EndUnLoadForm

If m_gBKPath = "" Then

GoTo EndUnLoadForm

End If

Open App.Path & "\bookmark.txt" For Output As #1

For i = 0 To m_BKList.ListCount - 1

m_BKList.ListIndex = 0

Print #1, m_BKList.Text

m_BKList.RemoveItem m_BKList.ListIndex

Next

Close #1

EndUnLoadForm:

End Sub

Private Sub m_DeleteBK_Click()

If m_BKList.ListIndex <> -1 Then m_BKList.RemoveItem m_BKList.ListIndex

End Sub

IV. m_FrmTest.frm

Форма управления тестом

Dim qcount As Integer ' общее количество вопросов

Dim r As Integer ' количество правильный

' ответов

Dim curq As Integer

Dim rate(1 To 4) As Integer ' критерии оценок

Dim comment(1 To 4) As String ' комментарии

Dim f As String ' буфер чтения

Dim qcycle() As Integer

Dim quest() As Question

Sub LoadQuestions()

Dim fquest As String

Dim ftrue As Integer

Dim fanswer() As String

Do While NextQuestion(fquest, ftrue, fanswer)

If qcount = 1 Then

ReDim quest(0)

Else

ReDim Preserve quest(qcount - 1)

End If

quest(qcount - 1).Question = fquest

quest(qcount - 1).True = ftrue

For i = 0 To 2

quest(qcount - 1).Answer(i) = fanswer(i)

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



2012 © Все права защищены
При использовании материалов активная ссылка на источник обязательна.