Moving data window not using title bar

J

Jeff Williams

I need to be able to drag a window around by clicking on the background
of the window.

This windows does not contain a title bar. This would be like some on
screen post-it note applications use.

Would appreciate help with the code or a link to an app which would show
how to do this.

Thanks in advance.
Jeff
 
M

Mugunth

I need to be able to drag a window around by clicking on the background
of the window.

This windows does not contain a title bar. This would be like some on
screen post-it note applications use.

Would appreciate help with the code or a link to an app which would show
how to do this.

Thanks in advance.
Jeff

Jeff,
Copy paste this code into your form on which you need to drag clicking
the background.

protected override void WndProc(ref Message m)
{
const int WmNcHitTest = 0x84;
const int HtCaption = 2;


if (m.Msg == WmNcHitTest)
m.Result = new IntPtr(HtCaption);
else
base.WndProc(ref m);
}

hope that helps :)

Mugunth
 
J

Jeff Williams

Hi Mugunth

Thanks this does what I need but I now have a problem I cannot resize
the borders.

I am guessing I need extra code to allow a resize but again have no ide
how to restore this functionality.

Regards
Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top