⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 samplewizard.vb

📁 Magic Library 1.7,有说明文档
💻 VB
📖 第 1 页 / 共 2 页
字号:
            'label4
            '
            Me.label4.Location = New System.Drawing.Point(32, 8)
            Me.label4.Name = "label4"
            Me.label4.TabIndex = 1
            Me.label4.Text = "Must Agree Terms"
            '
            'textBox1
            '
            Me.textBox1.Location = New System.Drawing.Point(32, 32)
            Me.textBox1.Multiline = True
            Me.textBox1.Name = "textBox1"
            Me.textBox1.Size = New System.Drawing.Size(352, 120)
            Me.textBox1.TabIndex = 0
            Me.textBox1.Text = "You must select 'I Agree' before the 'Next' button will enable itself. Me custom " & _
            "action is not part of the WizardControl, see the sample code which is trivial."
            '
            'wizardWarn
            '
            Me.wizardWarn.Controls.AddRange(New System.Windows.Forms.Control() {Me.label6, Me.label5})
            Me.wizardWarn.FullPage = False
            Me.wizardWarn.Name = "wizardWarn"
            Me.wizardWarn.Selected = False
            Me.wizardWarn.Size = New System.Drawing.Size(410, 222)
            Me.wizardWarn.SubTitle = "Me warns user that installation is about to begin"
            Me.wizardWarn.TabIndex = 6
            Me.wizardWarn.Title = "Warn"
            '
            'label6
            '
            Me.label6.Location = New System.Drawing.Point(40, 56)
            Me.label6.Name = "label6"
            Me.label6.Size = New System.Drawing.Size(360, 64)
            Me.label6.TabIndex = 1
            Me.label6.Text = "Warn user that pressing 'Next' will begin installation process."
            '
            'label5
            '
            Me.label5.Location = New System.Drawing.Point(40, 16)
            Me.label5.Name = "label5"
            Me.label5.Size = New System.Drawing.Size(280, 24)
            Me.label5.TabIndex = 0
            Me.label5.Text = "Last page before installation."
            '
            'wizardInstall
            '
            Me.wizardInstall.Controls.AddRange(New System.Windows.Forms.Control() {Me.label7, Me.progressBar1})
            Me.wizardInstall.FullPage = False
            Me.wizardInstall.Name = "wizardInstall"
            Me.wizardInstall.Selected = False
            Me.wizardInstall.Size = New System.Drawing.Size(410, 222)
            Me.wizardInstall.SubTitle = "Perform some fake installation process"
            Me.wizardInstall.TabIndex = 7
            Me.wizardInstall.Title = "Install"
            '
            'label7
            '
            Me.label7.Location = New System.Drawing.Point(40, 16)
            Me.label7.Name = "label7"
            Me.label7.TabIndex = 1
            Me.label7.Text = "Fake Installation"
            '
            'progressBar1
            '
            Me.progressBar1.Location = New System.Drawing.Point(40, 48)
            Me.progressBar1.Name = "progressBar1"
            Me.progressBar1.Size = New System.Drawing.Size(328, 24)
            Me.progressBar1.TabIndex = 0
            '
            'wizardFinish
            '
            Me.wizardFinish.Controls.AddRange(New System.Windows.Forms.Control() {Me.label10})
            Me.wizardFinish.FullPage = False
            Me.wizardFinish.Name = "wizardFinish"
            Me.wizardFinish.Selected = False
            Me.wizardFinish.Size = New System.Drawing.Size(410, 222)
            Me.wizardFinish.SubTitle = "Me page gives the success or failure of attempting the previous install process"
            Me.wizardFinish.TabIndex = 8
            Me.wizardFinish.Title = "Finished"
            '
            'label10
            '
            Me.label10.Location = New System.Drawing.Point(32, 16)
            Me.label10.Name = "label10"
            Me.label10.Size = New System.Drawing.Size(304, 104)
            Me.label10.TabIndex = 0
            Me.label10.Text = "Installation has completed with success."
            '
            'wizardInfo2
            '
            Me.wizardInfo2.Controls.AddRange(New System.Windows.Forms.Control() {Me.label9, Me.textBox3, Me.label8, Me.textBox2})
            Me.wizardInfo2.FullPage = False
            Me.wizardInfo2.Name = "wizardInfo2"
            Me.wizardInfo2.Selected = False
            Me.wizardInfo2.Size = New System.Drawing.Size(410, 222)
            Me.wizardInfo2.SubTitle = "Me is the second of two pages for gathering input"
            Me.wizardInfo2.TabIndex = 9
            Me.wizardInfo2.Title = "Info2"
            '
            'label9
            '
            Me.label9.Location = New System.Drawing.Point(48, 80)
            Me.label9.Name = "label9"
            Me.label9.Size = New System.Drawing.Size(136, 23)
            Me.label9.TabIndex = 3
            Me.label9.Text = "Enter Company Name"
            '
            'textBox3
            '
            Me.textBox3.Location = New System.Drawing.Point(48, 104)
            Me.textBox3.Name = "textBox3"
            Me.textBox3.Size = New System.Drawing.Size(160, 21)
            Me.textBox3.TabIndex = 2
            Me.textBox3.Text = "ACNE Corp."
            '
            'label8
            '
            Me.label8.Location = New System.Drawing.Point(48, 16)
            Me.label8.Name = "label8"
            Me.label8.TabIndex = 1
            Me.label8.Text = "Enter Username"
            '
            'textBox2
            '
            Me.textBox2.Location = New System.Drawing.Point(48, 40)
            Me.textBox2.Name = "textBox2"
            Me.textBox2.Size = New System.Drawing.Size(160, 21)
            Me.textBox2.TabIndex = 0
            Me.textBox2.Text = "Anon"
            '
            'SampleWizard
            '
            Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
            Me.ClientSize = New System.Drawing.Size(410, 351)
            Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.wizardControl})
            Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
            Me.Name = "SampleWizard"
            Me.wizardStartPage.ResumeLayout(False)
            Me.wizardInfo1.ResumeLayout(False)
            Me.groupBox1.ResumeLayout(False)
            Me.wizardLegal.ResumeLayout(False)
            Me.wizardWarn.ResumeLayout(False)
            Me.wizardInstall.ResumeLayout(False)
            Me.wizardFinish.ResumeLayout(False)
            Me.wizardInfo2.ResumeLayout(False)
            Me.ResumeLayout(False)

        End Sub#End Region

        Private Sub radioButton4_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs)
            If (Me.radioButton4.Checked) Then
                Me.wizardControl.EnableNextButton = WizardControl.Status.Default
                radioButton5.Checked = False
            Else
                Me.wizardControl.EnableNextButton = WizardControl.Status.No
                radioButton5.Checked = True
            End If
        End Sub

        Private Sub radioButton5_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs)
            If (Me.radioButton5.Checked) Then
                Me.wizardControl.EnableNextButton = WizardControl.Status.No
                radioButton4.Checked = False
            Else
                Me.wizardControl.EnableNextButton = WizardControl.Status.Default
                radioButton4.Checked = True
            End If
        End Sub
        Protected Overrides Sub OnWizardPageEnter(ByVal wp As Crownwood.Magic.Controls.WizardPage, _
                                                  ByVal wc As Crownwood.Magic.Controls.WizardControl)
            ' Asking for licence terms by entering page?
            If (wp.Name = "wizardLegal") Then
                If (Me.radioButton4.Checked) Then
                    wc.EnableNextButton = WizardControl.Status.Default
                Else
                    wc.EnableNextButton = WizardControl.Status.No
                End If
            End If

            ' Started the installation process by entering page 5?
            If (wp.Name = "wizardInstall") Then
                ' Kick off a timer to represent progress
                installCount = 0
                installTimer = New Timer()
                installTimer.Interval = 250
                AddHandler installTimer.Tick, AddressOf OnProgressTick
                installTimer.Start()
            End If
        End Sub

        Protected Overrides Sub OnWizardPageLeave(ByVal wp As Crownwood.Magic.Controls.WizardPage, _
                                                  ByVal wc As Crownwood.Magic.Controls.WizardControl)
            ' Leaving page means we have to restore default status of next button
            If (wp.Name = "wizardLegal") Then
                ' Default the next button to disable
                wc.EnableNextButton = WizardControl.Status.Default
            End If
        End Sub

        Protected Overrides Sub OnCancelClick(ByVal sender As Object, ByVal e As System.EventArgs)
            ' Suspend any installation process if happening
            If Not (installTimer Is Nothing) Then installTimer.Stop()

            If (MessageBox.Show(Me, "Sure you want to exit?", "Cancel Pressed", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) = DialogResult.Yes) Then
                ' Let base class close the form
                MyBase.OnCancelClick(sender, e)
            Else
                ' Resume any installation process if happening
                If Not (installTimer Is Nothing) Then installTimer.Start()
            End If
        End Sub

        Private Sub OnProgressTick(ByVal sender As Object, ByVal e As System.EventArgs)
            installCount += 1

            ' Finished yet?
            If (installCount = 20) Then
                ' No longer need to simulate actions
                installTimer.Stop()

                ' Move to last page
                MyBase.wizardControl.SelectedIndex = MyBase.wizardControl.WizardPages.Count - 1
            Else
                ' Update percentage completed
                progressBar1.Value = 100 / 20 * installCount
            End If
        End Sub
    End ClassEnd Namespace

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -