zoukankan      html  css  js  c++  java
  • 记事本 查找

    namespace FirstForm
    {
        public partial class Find : Form
        {
            public Find()
            {
                InitializeComponent();
            }
    
            private WindowsFormsApplication6.Form1 fuform;
            public Find(string ss, WindowsFormsApplication6.Form1 fuchuangti)
            {
                InitializeComponent();
                textBox1.Text = ss;
                fuform = fuchuangti;
            }
    
            private void Find_Load(object sender, EventArgs e)
            {//放界面的控件初始值,另外还有成员变量的初始值
               
            }
    
            private int Index = -1;
            private void button1_Click(object sender, EventArgs e)
            {
                string finds = textBox1.Text;
                if (Index == -1)
                {
                    fuform.textBox1.Select(fuform.textBox1.Text.IndexOf(finds), finds.Length);
                    Index = fuform.textBox1.Text.IndexOf(finds) + 1;
                }
                else
                {
                    if (Index + finds.Length < fuform.textBox1.Text.Length)
                    {
                        fuform.textBox1.Select(fuform.textBox1.Text.IndexOf(finds, Index), finds.Length);
                        Index = fuform.textBox1.Text.IndexOf(finds, Index) + 1;
                    }
                }
                this.fuform.Focus();
                this.fuform.textBox1.Focus();
            }
        }
    }
    

      

  • 相关阅读:
    saltstack笔记
    saltstack学习篇
    tomcat学习篇
    memcache笔记
    sed、awk学习篇
    javascript function call
    jvm性能调优工具
    spring boot 单元测试
    activemq 分布式事务
    sringboot 集成dobbo2.5.3
  • 原文地址:https://www.cnblogs.com/ROCKyou/p/4956757.html
Copyright © 2011-2022 走看看