Moveing a window

  • Thread starter Thread starter Tomomichi Amano
  • Start date Start date
T

Tomomichi Amano

(addition to my last question)
I want to make it possible to move a window with out a titlebar USEING a
mouse.

Thanks in advcance
 
what about, use client area drag?
track the mouse and move the window yourself.

in vc6.0, Jeff Prosise had a clock app. (without a title bar) where he
'fooled' windows by rerouting the OnNcHitTest message, don't know how to do
that (yet) in c#, perhaps someone else?
hope it helps.
 
try this using API - don't know if there is a .Net way for this:

[DllImport("User32.dll", EntryPoint="SendMessageA")]
static extern Int32 SendMessage (IntPtr hWnd, Int32 wMsg, Int32 wParam, int
lParam);

[DllImport("User32.dll")]
static extern Int32 ReleaseCapture ();

private const int HTCAPTION = 2;
private const int WM_NCLBUTTONDOWN = 161;

private void Form1_MouseDown(object sender,
System.Windows.Forms.MouseEventArgs e)
{
ReleaseCapture();
SendMessage ( this.Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0 );
}
 
Hey,

Here wat i found on the google awhile back

// Import
using System.Runtime.InteropServices;

// place it Anywhere
public const int WM_NCLBUTTONDOWN = 0xA1;
public const int HTCAPTION = 0x2;
[DllImportAttribute ("user32.dll")]
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int
lParam);
[DllImportAttribute ("user32.dll")]
public static extern bool ReleaseCapture();


// create a OnMouseDown event [ex. a label etc.]
ReleaseCapture();
SendMessage(Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0);

hope that helps

Du
 
Back
Top