ITPub博客

首页 > Linux操作系统 > Linux操作系统 > c# winform鼠标相关onmouseup,onmousedown,onmousemove,onmousewhell

c# winform鼠标相关onmouseup,onmousedown,onmousemove,onmousewhell

原创 Linux操作系统 作者:wisdomone1 时间:2012-07-14 20:46:42 0 删除 编辑
protected override void OnMouseUp(MouseEventArgs e)
         {
             string x = "this is\n"+
                        "a good man\n"+
                        "we must use a mouse wheel";

           //分析:三段式,在while中引用的变量要在while外面定义
             //nindex与nlines用于while之中
             int nindex = 0;
             int nlines = 0;

             //indexof(要查找到字符,开始查找的位置)
             while((nindex=x.IndexOf('\n',nindex))!=-1)
             {
                 nindex++;//累加,在字符串中当前换行符的位置,经分析,这是查找到当前换行符的下个位置,当前换行符的位置是nindex,而此处是nindex++,这样就可以在字符串中一直推进查多少到多少行了
                 nlines++;//累加,计算字符串到底有多少行

             }
         }
         //滚动鼠标滑轮时
         protected override void OnMouseWheel(MouseEventArgs e)
         {
             base.OnMouseWheel(e);
         }

         //移动鼠标
         protected override void OnMouseMove(MouseEventArgs e) //mouseeventargs提示鼠标相关的信息,如x,y分别表示鼠标的水平及垂直位置
         {
             base.OnMouseMove(e);
         }

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/9240380/viewspace-735481/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
提供针对oracle初学者及进阶的数据库培训,欢迎大家咨询: 微信: wisdomone 微信公众号: lovedb 工作经历: 中国普天 北京科蓝 北京云和恩墨 北京神州新桥

注册时间:2008-04-04

  • 博文量
    2189
  • 访问量
    12690144