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

📄 form1.frm

📁 Visual Basic 6 大学教程的代码
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmPigLatin 
   Caption         =   "Form1"
   ClientHeight    =   1710
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   1710
   ScaleWidth      =   4680
   StartUpPosition =   3  'Windows Default
   Begin VB.TextBox txtInput 
      Height          =   285
      Left            =   0
      TabIndex        =   3
      Top             =   360
      Width           =   4695
   End
   Begin VB.CommandButton cmdConvert 
      Caption         =   "Convert to Pig Latin"
      Height          =   375
      Left            =   0
      TabIndex        =   2
      Top             =   720
      Width           =   1815
   End
   Begin VB.TextBox txtOutput 
      Height          =   495
      Left            =   0
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   1
      Top             =   1200
      Width           =   4695
   End
   Begin VB.Label lblInput 
      Caption         =   "Enter phrase"
      Height          =   255
      Left            =   0
      TabIndex        =   0
      Top             =   120
      Width           =   2295
   End
End
Attribute VB_Name = "frmPigLatin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Fig. 8.5
' Demonstrating Left$, Right$ and InStr
Option Explicit

Private Sub cmdConvert_Click()
   Dim phrase As String, nextWord As String, _
      blankPosition As Integer
   
   txtOutput.Text = ""
   phrase = txtInput.Text
   blankPosition = InStr(1, phrase, " ")
      
   While blankPosition <> 0
      nextWord = Left$(phrase, blankPosition - 1)
      
      Call DisplayLatinWord(nextWord)
      phrase = Right$(phrase, Len(phrase) - blankPosition)
      blankPosition = InStr(1, phrase, " ")
   Wend
    
   nextWord = phrase
   Call DisplayLatinWord(nextWord)
End Sub

Private Sub DisplayLatinWord(word As String)
   txtOutput.Text = txtOutput.Text & _
      Right$(word, Len(word) - 1) & _
      Left$(word, 1) & "ay "
End Sub

⌨️ 快捷键说明

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