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

📄 interaction.vb

📁 大名鼎鼎的mono是.NET平台的跨平台(支持linux
💻 VB
📖 第 1 页 / 共 2 页
字号:
                AddHandler bcancel.Click, AddressOf cancel_Click                bok.Location = New Point(ClientSize.Width - bok.ClientSize.Width - 8, 8)                bcancel.Location = New Point(bok.Location.X, 8 + bok.ClientSize.Height + 8)                entry.Location = New Point(8, 80)                entry.ClientSize = New Size(ClientSize.Width - 28, entry.ClientSize.Height)                Controls.Add(bok)                Controls.Add(bcancel)                Controls.Add(entry)                ResumeLayout(False)            End Sub            Public Function Run() As String	        If Me.ShowDialog = Windows.Forms.DialogResult.OK Then          	    Return result		Else		    Return String.Empty	        End If            End Function            Private Sub ok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)                result = entry.Text                Me.DialogResult = Windows.Forms.DialogResult.OK            End Sub            Private Sub cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)                Me.DialogResult = Windows.Forms.DialogResult.Cancel            End Sub        End Class#End If        Public Function InputBox(ByVal Prompt As String, Optional ByVal Title As String = "", Optional ByVal DefaultResponse As String = "", Optional ByVal XPos As Integer = -1, Optional ByVal YPos As Integer = -1) As String#If TARGET_JVM = False Then            Dim f As InputForm            f = New InputForm(Prompt, Title, DefaultResponse, XPos, YPos)            Return f.Run()#Else            Throw New NotImplementedException#End If        End Function        Public Function Partition(ByVal Number As Long, ByVal Start As Long, ByVal [Stop] As Long, ByVal Interval As Long) As String            Dim strEnd As String = ""            Dim strStart As String = ""            Dim strStop As String = ""            Dim lEnd, lStart As Long            Dim nSpaces As Integer            If Start < 0 Then Throw New System.ArgumentException("Argument 'Start' is not a valid value.")            If [Stop] <= Start Then Throw New System.ArgumentException("Argument 'Stop' is not a valid value.")            If Interval < 1 Then Throw New System.ArgumentException("Argument 'Start' is not a valid value.")            If Number > [Stop] Then                strEnd = "Out Of Range"                lStart = [Stop] - 1            ElseIf Number < Start Then                strStart = "Out Of Range"                lEnd = Start - 1            ElseIf (Number = Start) Then                lStart = Number                If (lEnd < (Number + Interval)) Then                    lEnd = Number + Interval - 1                Else                    lEnd = [Stop]                End If            ElseIf (Number = [Stop]) Then                lEnd = [Stop]                If (lStart > (Number - Interval)) Then                    lStart = Number                Else                    lStart = Number - Interval + 1                End If            ElseIf Interval = 1 Then                lStart = Number                lEnd = Number            Else                lStart = Start                While (lStart < Number)                    lStart += Interval                End While                lStart = lStart - Interval                lEnd = lStart + Interval - 1            End If            If strEnd = "Out Of Range" Then                strEnd = ""            Else                strEnd = CStr(lEnd)            End If            If strStart = "Out Of Range" Then                strStart = ""            Else                strStart = CStr(lStart)            End If                        strStop = Cstr([stop])                        If (strEnd.Length > strStop.Length) Then                nSpaces = strEnd.Length             Else                nSpaces = strStop.Length            End If	    	    If (nSpaces = 1) Then nSpaces = nSpaces + 1            Return strStart.PadLeft(nSpaces) + ":" + strEnd.PadLeft(nSpaces)        End Function        Public Sub SaveSetting(ByVal AppName As String, ByVal Section As String, ByVal Key As String, ByVal Setting As String)#If TARGET_JVM = False Then            Dim rkey As RegistryKey            rkey = Registry.CurrentUser            rkey = rkey.CreateSubKey("Software\VB and VBA Program Settings\" + AppName)            rkey = rkey.CreateSubKey(Section)            rkey.SetValue(Key, Setting)            'Closes the key and flushes it to disk if the contents have been modified.            rkey.Close()#Else            Throw New NotImplementedException#End If        End Sub        Public Function Shell(ByVal Pathname As String, Optional ByVal Style As Microsoft.VisualBasic.AppWinStyle = Microsoft.VisualBasic.AppWinStyle.MinimizedFocus, Optional ByVal Wait As Boolean = False, Optional ByVal Timeout As Integer = -1) As Integer            'TODO: OS Specific            Throw New NotImplementedException        End Function        Public Function Switch(ByVal ParamArray VarExpr() As Object) As Object            Dim i As Integer            If VarExpr Is Nothing Then                Return Nothing            End If            If Not (VarExpr.Length Mod 2 = 0) Then                Throw New System.ArgumentException("Argument 'VarExpr' is not a valid value.")            End If            For i = 0 To VarExpr.Length Step 2                If CBool(VarExpr(i)) Then Return VarExpr(i + 1)            Next            Return Nothing        End Function        Public Function MsgBox(ByVal Prompt As Object, Optional ByVal Button As MsgBoxStyle = MsgBoxStyle.OKOnly, _         Optional ByVal Title As Object = Nothing) As MsgBoxResult#If TARGET_JVM = False Then            Dim wf_buttons As MessageBoxButtons            Dim wf_icon As MessageBoxIcon            Dim wf_default As MessageBoxDefaultButton            Dim wf_options As MessageBoxOptions            If Title Is Nothing Then                Title = ""            End If            wf_icon = MessageBoxIcon.None            wf_options = 0            Select Case Button And 7                Case 0                    wf_buttons = MessageBoxButtons.OK                Case 1                    wf_buttons = MessageBoxButtons.OKCancel                Case 2                    wf_buttons = MessageBoxButtons.AbortRetryIgnore                Case 3                    wf_buttons = MessageBoxButtons.YesNoCancel                Case 4                    wf_buttons = MessageBoxButtons.YesNo                Case 5                    wf_buttons = MessageBoxButtons.RetryCancel            End Select            If (Button And 16) = 16 Then                wf_icon = MessageBoxIcon.Error            ElseIf (Button And 32) = 32 Then                wf_icon = MessageBoxIcon.Question            ElseIf (Button And 64) = 64 Then                wf_icon = MessageBoxIcon.Information            End If            If (Button And 256) = 256 Then                wf_default = MessageBoxDefaultButton.Button2            ElseIf (Button And 512) = 512 Then                wf_default = MessageBoxDefaultButton.Button3            Else                wf_default = MessageBoxDefaultButton.Button1            End If            If (Button And 4096) = 4096 Then                ' Ignore, we do not support SystemModal dialog boxes, or I cant find how to do this            End If            If (Button And 524288) = 524288 Then                wf_options = MessageBoxOptions.RightAlign            End If            If (Button And 1048576) = 1048576 Then                wf_options = wf_options Or MessageBoxOptions.RtlReading            End If            MessageBox.Show(Prompt.ToString, Title.ToString(), wf_buttons, wf_icon, wf_default, wf_options)#Else            Throw New NotImplementedException#End If        End Function    End ModuleEnd Namespace

⌨️ 快捷键说明

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