Moving a window that has no title bar

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Right now I have a bit of code that will let me move a window around that has no title bar :

        const int WM_NCHITTEST = 0x0084;
        const int HTCAPTION = 2;
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == WM_NCHITTEST)
            {
                Point pt = this.PointToClient(new Point(m.LParam.ToInt32()));
                if (ClientRectangle.Contains(pt))
                {
                    m.Result = new IntPtr(HTCAPTION);
                    return;
                }
            }

            base.WndProc(ref m);
        }

The problem is, the window is completely filled with a label control.  So I cant drag the window until I resize the window larger than the label (to give me somewhere to click and drag).  Is there any way I can pass a click through the label to the underlying window.  I dont want to make the window larger than the label control - its a floating scrolling marquis type window.



View the full article
 
Back
Top