本文介绍了VB6使用RichTextBox。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我有一个程序打开加密的INI文件(在我的其他程序中用作设置)。 在我的Decrypt Exe中(读取INI文件,解密它并能够编辑文件和另存为加密文本)。其他功能是查找。 完成单击按钮时,我的问题有时是所选文本查找文本被 frmFind 隐藏。我想在发生这种情况时设置位置(顶部,左侧)。许多已知应用程序都有此功能。 请帮助...谢谢 这是我的代码找到文字,我不知道是否有更好的解决方案 ' 按钮中的代码查找下一步也在frmFind Dim startText 正如 字符串 Dim endText 正如 字符串 Dim findInt 正如 整数 Dim searchText 正如 字符串 searchText = LCase(txtFind.Text) 如果 Option1.Value 然后 s tartText = LCase(左(frmDecrypt.RichTextBox1.Text,frmDecrypt.RichTextBox1.SelStart)) endText = LCase(Mid(frmDecrypt.RichTextBox1.Text,Len(startText))) findInt = InStr(startText ,searchText) 如果 findInt> 0 然后 frmDecrypt.RichTextBox1.SelStart = findInt - 1 frmDecrypt.RichTextBox1.SelLength = Len(searchText) 其他 frmFind.Visible = False MsgBox 指定的区域已到达。 ,vbCritical frmFind.Visible = True 结束 如果 其他 startText = LCase(左(frmDecrypt.RichTextBox1.Text,frmDecrypt) .RichTextBox1.SelStart + frmDecrypt.RichTextBox1.SelLength)) endText = LCase(Mid(frmDecrypt.RichTextBox1.Text,Len(startText)+ 1 )) findInt = InStr(endText,searchText) 如果 findInt> 0 然后 frmDecrypt.RichTextBox1.SelStart = findInt + Len(startText) - 1 frmDecrypt.RichTextBox1.SelLength = Len(searchText) 否则 frmFind .Visible = False MsgBox 指定的区域已到达。,vbCritical frmFind.Visible = True End 如果 结束 如果 frmDecrypt.SetFocus 解决方案 屏幕左上角 frmFind.Left = 0 frmFind.Top = 0 ' 或当前的左上角表格 frmFind.Left = ME .Left frmFind.Top = ME .Top I have a program that open encrypted INI files (used in my other program as a settings).In my Decrypt Exe (reading the INI file, decrypt it and able to edit the file and save as encrypted text). Other functionalities is Find.My problem is sometimes the selected text when finish clicking the button Find Text is hidden by the frmFind. I want to set the position(top, left) when that happens. Many known application has this function.Please Help... ThanksThis is my code in finding text, I don't know if there's a better solution on this'CODE IN BUTTON "FIND NEXT" ALSO IN frmFindDim startText As StringDim endText As StringDim findInt As IntegerDim searchText As StringsearchText = LCase(txtFind.Text)If Option1.Value Then startText = LCase(Left(frmDecrypt.RichTextBox1.Text, frmDecrypt.RichTextBox1.SelStart)) endText = LCase(Mid(frmDecrypt.RichTextBox1.Text, Len(startText))) findInt = InStr(startText, searchText) If findInt > 0 Then frmDecrypt.RichTextBox1.SelStart = findInt - 1 frmDecrypt.RichTextBox1.SelLength = Len(searchText) Else frmFind.Visible = False MsgBox "The specified region has been reach.", vbCritical frmFind.Visible = True End IfElse startText = LCase(Left(frmDecrypt.RichTextBox1.Text, frmDecrypt.RichTextBox1.SelStart + frmDecrypt.RichTextBox1.SelLength)) endText = LCase(Mid(frmDecrypt.RichTextBox1.Text, Len(startText) + 1)) findInt = InStr(endText, searchText) If findInt > 0 Then frmDecrypt.RichTextBox1.SelStart = findInt + Len(startText) - 1 frmDecrypt.RichTextBox1.SelLength = Len(searchText) Else frmFind.Visible = False MsgBox "The specified region has been reach.", vbCritical frmFind.Visible = True End IfEnd IffrmDecrypt.SetFocus 解决方案 ' top left of screenfrmFind.Left = 0frmFind.Top = 0' or top left of current formfrmFind.Left = ME.LeftfrmFind.Top = ME.Top 这篇关于VB6使用RichTextBox。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 07-10 08:34