I want to move and resize a window without border. I solved the problem of
moving thanks to internet search by using
ReleaseCapture();
SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
In the Mouse_Down event handler.
Is there a similar way to size the window? Just replacing HT_CAPTION with
HT_BORDER_LEFT or one of the other HT_BORDER_... commands doesn’t seem to
work.
Chris
Herfried K. Wagner [MVP] - 06 Jul 2006 23:17 GMT
"cnickl" <cnickl@discussions.microsoft.com> schrieb:
>I want to move and resize a window without border. I solved the problem of
> moving thanks to internet search by using
[quoted text clipped - 7 lines]
> HT_BORDER_LEFT or one of the other HT_BORDER_... commands doesn’t seem to
> work.
<URL:http://dotnetrix.co.uk/misc.html>
-> "An example of a moveable/resizable shaped form."

Signature
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
cnickl - 07 Jul 2006 02:35 GMT
Thank you very much. just what i needed. lots of cool stuff on this site
> "cnickl" <cnickl@discussions.microsoft.com> schrieb:
> >I want to move and resize a window without border. I solved the problem of
[quoted text clipped - 11 lines]
> <URL:http://dotnetrix.co.uk/misc.html>
> -> "An example of a moveable/resizable shaped form."
Stoitcho Goutsev (100) - 07 Jul 2006 14:57 GMT
Hi,
Do you want to let the user resize and move borderless form with the mouse
or you want to do it from code?
I'm asking because if you want to allow the user do it there is a better way
to accomplish this.
--
HTH
Stoitcho Goutsev (100)
>I want to move and resize a window without border. I solved the problem of
> moving thanks to internet search by using
[quoted text clipped - 9 lines]
>
> Chris
Claes Bergefall - 07 Jul 2006 15:13 GMT
Here's one way:
http://groups.google.com/group/microsoft.public.dotnet.framework.windowsforms/br
owse_frm/thread/348aeb12f7812196/1714a0fc1bab9e11?&hl=sv#1714a0fc1bab9e11
/claes
>I want to move and resize a window without border. I solved the problem of
> moving thanks to internet search by using
[quoted text clipped - 9 lines]
>
> Chris
JezzzMoore - 21 Jun 2008 13:48 GMT
> I want to move and resize a window without border. I solved the problem of
> moving thanks to internet search by using
[quoted text clipped - 9 lines]
>
> Chris
Could you give the exact code you used to make the window movable without a
window border?
Ive been trying for weeks to make my form movable without a window border
and i cant fin the code anywhere!
Thanks,
Peter Morris - 21 Jun 2008 14:17 GMT
If you send the form a windows message
WM_SYSCOMMAND, 0xF012, 0
then you can move it at runtime. Only ever done it in Delphi though...
Perform(WM_SYSCOMMAND, $F012, 0);
Not even looked at how to send a windows message to a WinForm control.

Signature
Pete
=========================================
I use Enterprise Core Objects (Domain driven design)
http://www.capableobjects.com/
=========================================
Claes Bergefall - 24 Jun 2008 10:53 GMT
>> I want to move and resize a window without border. I solved the problem
>> of
[quoted text clipped - 17 lines]
> Ive been trying for weeks to make my form movable without a window border
> and i cant fin the code anywhere!
Override WndProc in your Form and handle the WM_NCHITTEST notification.
Return HTCAPTION for any coordinate that should allow moving the window.
Something like this:
private const int HTCAPTION = 2;
private const int WM_NCHITTEST = 0x84;
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_NCHITTEST)
{
Point pt = new Point(m.LParam.ToInt32());
pt = this.PointToClient;
if (DoesThisCoordinateAllowTheWindowToBeMoved(pt))
m.Result = new IntPtr(HTCAPTION);
else
base.WndProc(m);
}
else
{
base.WndProc(m);
}
}