예제 #1
0
 private void Form1_Load(object sender, EventArgs e)
 {
     foreach (Control ctrl in this.Controls)
     {
         WndProcHooker.HookWndProc(ctrl, new WndProcHooker.WndProcCallback(HandlePaint), WM_PAINT);
     }
 }
예제 #2
0
파일: TextBoxEx.cs 프로젝트: ntj/GravurGIS
        //private EditStyle _editStyle = EditStyle.ES_LEFT;

        public TextBoxEx()
        {
            InitializeComponent();

            WndProcHooker.HookWndProc(this,
                                      new WndProcHooker.WndProcCallback(this.WM_LButtonUp_Handler),
                                      Win32.WM_LBUTTONUP);

            AllowSpace = true;

            //_editStyle = (EditStyle) GetWindowLong(this.Handle, (int)GetWindowLongParam.GWL_STYLE);
        }
예제 #3
0
    protected override void OnParentChanged(EventArgs e)
    {
        if (prevParent != null)
        {
            WndProcHooker.UnhookWndProc(prevParent, WM_LBUTTONDOWN);
            WndProcHooker.UnhookWndProc(prevParent, WM_LBUTTONUP);
        }
        prevParent = Parent;

        if (Parent != null)
        {
            WndProcHooker.HookWndProc(Parent, WM_LBUTTONDOWN_Handler, WM_LBUTTONDOWN);
            WndProcHooker.HookWndProc(Parent, WM_LBUTTONUP_Handler, WM_LBUTTONUP);
        }
        base.OnParentChanged(e);
    }
예제 #4
0
        public ListBoxEx()
        {
            msgs = new List <string>();

            _items        = new ObjectCollection();
            _items.Parent = this;

            _border = new Border();

            _selectedBackColor = Color.FromArgb(49, 199, 214);
            _lineColor         = Color.Gray;
            _scrollBarColor    = Color.Gray;

            _scrollTop = 0;

            if (_offscreen == null)
            {
#if PocketPC
                _offscreen = new Bitmap(1024, 2048, System.Drawing.Imaging.PixelFormat.Format16bppRgb565);
#else
                _offscreen = new Bitmap(2048, 2048, System.Drawing.Imaging.PixelFormat.Format16bppRgb565);
#endif
                _graphics = Graphics.FromImage(_offscreen);
            }

            _selectedIndex  = -1;
            _selectionMode  = SelectionMode.One;
            _screenupdating = true;

            // タップ、左クリック
            WndProcHooker.HookWndProc(this, new WndProcHooker.WndProcCallback(this.WM_LButton_Down), Win32.WM_LBUTTONDOWN);

            // 右クリック
            WndProcHooker.HookWndProc(this, new WndProcHooker.WndProcCallback(this.WM_LButton_Down), Win32.WM_RBUTTONDOWN);

            // ジェスチャ
            WndProcHooker.HookWndProc(this, new WndProcHooker.WndProcCallback(this.WM_Gesture), Win32.WM_GESTURE);

            // マウスホイール
            WndProcHooker.HookWndProc(this, new WndProcHooker.WndProcCallback(this.WM_MouseWheel), Win32.WM_MOUSEWHEEL);

            // 慣性スクロールタイマー
            _timerScrolling          = new Timer();
            _timerScrolling.Interval = 100;
            _timerScrolling.Tick    += new EventHandler(TimerScrolling);
            _timerScrolling.Enabled  = true;
        }
        /// <summary>
        /// Called when the control's parent is changed. Here we hook into that
        /// parent's WndProc and spy on the WM_NOTIFY message. When the parent
        /// changes, we unhook the old parent's WndProc and hook into the new one.
        /// </summary>
        /// <param name="e">The arguments for this event</param>
        protected override void OnParentChanged(EventArgs e)
        {
            // unhook the old parent
            if (this.prevParent != null)
            {
                WndProcHooker.UnhookWndProc(prevParent, WinApi.WM_NOTIFY);
            }
            // update the previous parent
            prevParent = this.Parent;

            // hook up the new parent
            if (this.Parent != null)
            {
                WndProcHooker.HookWndProc(this.Parent,
                                          new WndProcHooker.WndProcCallback(this.WM_Notify_Handler),
                                          WinApi.WM_NOTIFY);
            }

            base.OnParentChanged(e);
        }