Esempio n. 1
0
        private RECT GlowWindowHost_RequestClientRectangle(RECT clientRect)
        {
            //Get some metrics
            int cyCaption   = User32.GetSystemMetrics(4);
            int cxBorder    = User32.GetSystemMetrics(5);
            int cyBorder    = User32.GetSystemMetrics(6);
            int cxSizeFrame = User32.GetSystemMetrics(32);
            int cySizeFrame = User32.GetSystemMetrics(33);
            int cxEdge      = User32.GetSystemMetrics(45);
            int cyEdge      = User32.GetSystemMetrics(46);

            //Check
            if (wmSizeWParam == 2)
            {
                clientRect.Top    += cyBorder + cyEdge + cySizeFrame;
                clientRect.Bottom -= cyBorder + cyEdge + cySizeFrame;
                clientRect.Left   += cxBorder + cxEdge + cxSizeFrame;
                clientRect.Right  -= cxBorder + cxEdge + cxSizeFrame;
            }

            //Get System.Drawing.Rectangle from client rect
            Rectangle rect = Rectangle.FromLTRB(clientRect.Left, clientRect.Top, clientRect.Right, clientRect.Bottom);

            //Call virtual function
            ClientAreaEventArgs e = new ClientAreaEventArgs(rect, ClientAreaRectangleRequestedEvent, this);

            //Call OnClientAreaRectangleRequested(ClientAreaEventArgs)
            OnClientAreaRectangleRequested(e);

            //Get rect structure
            return(new RECT()
            {
                Top = e.ClientRectangle.Top,
                Left = e.ClientRectangle.Left,
                Right = e.ClientRectangle.Right,
                Bottom = e.ClientRectangle.Bottom
            });
        }
Esempio n. 2
0
 /// <summary>
 /// Raises the <see cref="ClientAreaRectangleRequested"/> event.
 /// </summary>
 /// <param name="e">The <see cref="ClientAreaEventArgs"/> that contains the event data.</param>
 protected virtual void OnClientAreaRectangleRequested(ClientAreaEventArgs e)
 {
     //Raise event
     RaiseEvent(e);
 }