zoukankan      html  css  js  c++  java
  • 鼠标拖动控件

      /// <summary>
        /// 用鼠标拖动Panel
        /// </summary>
        public class MovePanel : Panel
        {

            private bool whetherSelected = false;
            private Point p = new Point();
           
            public bool WhetherSelected
            {
                get { return whetherSelected; }
            }

            /// <summary>
            /// 重写,设置绘制
            /// </summary>
            protected override void OnCreateControl()
            {
                base.OnCreateControl();
                SetStyle(ControlStyles.SupportsTransparentBackColor, true);
                SetStyle(ControlStyles.AllPaintingInWmPaint, true);
                SetStyle(ControlStyles.UserPaint, true);
                SetStyle(ControlStyles.DoubleBuffer, true);
            }
           
            /// <summary>
            /// OnMouseDown
            /// </summary>
            /// <param name="e"></param>
            protected override void OnMouseDown(MouseEventArgs e)
            {
                base.OnMouseDown(e);
                whetherSelected = true;
                p.X = Cursor.Position.X;
                p.Y = Cursor.Position.Y;

            }

            /// <summary>
            /// OnMouseMove
            /// </summary>
            /// <param name="e"></param>
            protected override void OnMouseMove(MouseEventArgs e)
            {
                base.OnMouseMove(e);
                if (whetherSelected == true)
                {
                    if (this.IsParentMove)
                    {
                        this.Parent.Left = this.Parent.Left + (Cursor.Position.X - p.X);
                        this.Parent.Top = this.Parent.Top + (Cursor.Position.Y - p.Y);
                    }
                    else
                    {
                        this.Left = this.Left + (Cursor.Position.X - p.X);
                        this.Top = this.Top + (Cursor.Position.Y - p.Y);
                    }
                        p.X = Cursor.Position.X;
                    p.Y = Cursor.Position.Y;

                }

            }

            /// <summary>
            /// OnMouseUp
            /// </summary>
            /// <param name="e"></param>
            protected override void OnMouseUp(MouseEventArgs e)
            {
                base.OnMouseUp(e);
                whetherSelected = false;
                this.BringToFront();
            }

            private bool _IsParentMove = false;
            /// <summary>
            /// 是否移动父控件
            /// </summary>
            public bool IsParentMove
            {

                get { return _IsParentMove; }
                set { _IsParentMove = value; }

            }       
        }

    case when 示例 统计数量,经测试正常


    select
    (case
             when isn %2=0 then '自办营业厅'
             else
                'bb自办营业厅'
             end
    ) as b,
    COUNT(*)
       from jb_zjm
       group by 
            
             (case
             when isn %2=0 then '自办营业厅'
             else
                'bb自办营业厅'
             end

            

  • 相关阅读:
    Git中从远程的分支获取最新的版本到本地方式
    vector map迭代器失效解决方案
    git 远程库 创建私钥
    centos type.h 编译错误问题
    关于/usr/bin/ld: cannot find -lcrypto 的错误
    线程存储(Thread Specific Data)
    bgcolor RGB 和16进制之间的转换,16进制转RGB,源码
    html 网页代码大全,总结,使用
    使用iframe的好处与坏处详细比拼
    java向MySQL插入当前时间的四种方式和java时间日期格式化的几种方法(案例说明)
  • 原文地址:https://www.cnblogs.com/superstar/p/1746527.html
Copyright © 2011-2022 走看看