【VB开源代码栏目提醒】:网学会员,鉴于大家对VB开源代码十分关注,论文会员在此为大家搜集整理了“TEXT.FRM”一文,供大家参考学习!
VERSION 5.00
Begin VB.Form frmText
Caption = "“文本框”属性"
ClientHeight = 4455
ClientLeft = 930
ClientTop = 1290
ClientWidth = 6870
LinkTopic = "Form1"
ScaleHeight = 4455
ScaleWidth = 6870
Begin VB.CommandButton cmdReset
Caption = "重新设置(&R)"
Height = 495
Left = 2400
TabIndex = 2
Top = 3720
Width = 1575
End
Begin VB.CommandButton cmdClose
Cancel = -1 'True
Caption = "关闭(&C)"
Height = 495
Left = 5040
TabIndex = 3
Top = 3720
Width = 1575
End
Begin VB.Frame fraInsert
Caption = "设置插入点"
Height = 2295
Left = 120
TabIndex = 5
Top = 1200
Width = 3855
Begin VB.OptionButton optText
Caption = "插入文本(&T)"
Height = 255
Left = 360
TabIndex = 9
Top = 1800
Width = 2055
End
Begin VB.OptionButton optSelect
Caption = "选中所有文本(&S)"
Height = 255
Left = 360
TabIndex = 8
Top = 1440
Width = 2055
End
Begin VB.OptionButton optInsert
Caption = "插入点在第5个字符之后(&I)"
Height = 255
Left = 360
TabIndex = 7
Top = 1080
Width = 2775
End
Begin
VB.OptionButton optEnd
Caption = "插入点在结尾处(&E)"
Height = 255
Left = 360
TabIndex = 6
Top = 720
Width = 2175
End
Begin VB.OptionButton optDefault
Caption = "缺省设置(&D)"
Height = 255
Left = 360
TabIndex = 1
Top = 360
Value = -1 'True
Width = 1815
End
End
Begin VB.TextBox txtDisplay
Height = 375
HideSelection = 0 'False
Left = 120
TabIndex = 0
Text = "在此例中,MultiLine 属性设置为 False。"
Top = 480
Width = 3840
End
Begin VB.TextBox txtMulti
Height = 615
Left = 4080
MultiLine = -1 'True
TabIndex = 4
TabStop = 0 'False
Text = "text.frx":0000
Top = 480
Width = 2655
End
Begin VB.Label lblHelp
Caption = "选择一个选项,并在第一个文本框中看一看效果。"
Height = 735
Left = 4200
TabIndex = 10
Top = 2160
Width = 2535
End
End
Attribute VB_Name = "frmText"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdClose_Click()
Unload Me ' 卸载窗体
End Sub
Private Sub cmdReset_Click()
' 恢复原始文本
txtDisplay.Text = "在此例中,MultiLine 属性设置为 False。"
' 重新设置选项按钮为缺省设置
optDefault.Value = True
End Sub
Private Sub optDefault_Click()
' 插入点在起始处
txtDisplay.SelStart = 0
' 将焦点设置到文本框,就可以看到我们设置的结果
txtDisplay.SetFocus
End Sub
Private Sub optEnd_Click()
' 获取字符串长度并将插入点放在结尾处
txtDisplay.SelStart = Len(txtDisplay.Text)
' 将焦点设置到文本框,就可以看到我们设置的结果
txtDisplay.SetFocus
End Sub
Private Sub optInsert_Click()
' 插入点在第5个字符之后
txtDisplay.SelStart = 5
' 将焦点设置到文本框,就可以看到我们设置的结果
txtDisplay.SetFocus
End Sub
Private Sub optSelect_Click()
' 插入点在起始处
txtDisplay.SelStart = 0
' 获取字符串长度并选中整个字符串
txtDisplay.SelLength = Len(txtDisplay.Text)
' 将焦点设置到文本框,就可以看到我们设置的结果
txtDisplay.SetFocus
End Sub
Private Sub optText_Click()
' 在插入点插入"新字符串"
' 如果文本被选中,其将被替换掉
txtDisplay.SelText = "新字符串"
' 将焦点设置到文本框,就可以看到我们设置的结果
txtDisplay.SetFocus
End Sub