private void RefreshColors()
        {
            ColorizedResources colRes = ColorizedResources.Instance;

            colRes.Refresh();
            colRes.FireColorizationChanged();
            _form.Invalidate(true);
            _form.Update();
        }
예제 #2
0
        private void RefreshColors()
        {
            ColorizedResources colRes = ColorizedResources.Instance;

            colRes.Refresh();
            colRes.FireColorizationChanged();
            User32.SendMessage(_form.Handle, WM.NCPAINT, new UIntPtr(1), IntPtr.Zero);
            _form.Invalidate(true);
            _form.Update();
        }
예제 #3
0
        public bool WndProc(ref Message m)
        {
            switch ((uint)m.Msg)
            {
            case 0x031E:                     // WM_DWMCOMPOSITIONCHANGED
            {
                // Aero was enabled or disabled. Force the UI to switch to
                // the glass or non-glass style.
                DisplayHelper.IsCompositionEnabled(true);
                ColorizedResources.FireColorChanged();
                break;
            }

            case WM.SIZE:
            {
                uint size = (uint)m.LParam.ToInt32();
                switch (m.WParam.ToInt32())
                {
                case SIZE_RESTORED:
                    _overrideSize = new Size((int)(size & 0xFFFF), (int)(size >> 16));
                    UpdateFrame();
                    break;

                case SIZE_MAXIMIZED:
                    UpdateFrame();
                    break;

                case SIZE_MAXHIDE:
                case SIZE_MINIMIZED:
                case SIZE_MAXSHOW:
                    break;
                }
                break;
            }

            case WM.NCHITTEST:
            {
                // Handling this message gives us an easy way to make
                // areas of the client region behave as elements of the
                // non-client region. For example, the edges of the form
                // can act as sizers.

                Point p = _form.PointToClient(new Point(m.LParam.ToInt32()));

                if (_form.ClientRectangle.Contains(p))
                {
                    // only override the behavior if the mouse is within the client area

                    if (Frameless)
                    {
                        int result = _sizeBorderHitTester.Test(_form.ClientSize, p);
                        if (result != -1)
                        {
                            m.Result = new IntPtr(result);
                            return(true);
                        }
                    }

                    if (!PointInSystemIcon(p))
                    {
                        // The rest of the visible areas of the form act like
                        // the caption (click and drag to move, double-click to
                        // maximize/restore).
                        m.Result = new IntPtr(HT.CAPTION);
                        return(true);
                    }
                }
                break;
            }

            case WM.ENTERMENULOOP:
                if (Control.MouseButtons == MouseButtons.None)
                {
                    _inMenuLoop = true;
                    ForceFrame  = true;
                }
                break;

            case WM.EXITMENULOOP:
                if (_inMenuLoop)
                {
                    _inMenuLoop = false;
                    if (!IsMouseInFrame())
                    {
                        ForceFrame = false;
                    }
                    else
                    {
                        _mouseFrameTimer.Start();
                    }
                }
                break;
            }
            return(false);
        }