Win Form (C#)

guest31ro

Newcomer
Joined
May 17, 2003
Messages
21
Win Form

I have a win form, without the title bar, and I want to move the form.:(
Can someone help me?:(
If it's posible please give me the code...
Thanks. :)
 
Put this code at the top of your form:

C#:
using System.Runtime.InteropServices;

Then use the following code to make the form draggable by clicking on it anywhere:

C#:
[DllImportAttribute("user32.dll", CharSet=CharSet.Auto)]
public static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, int lParam);
[DllImportAttribute("user32.dll", ExactSpelling=true, CharSet=CharSet.Auto)]
public static extern int ReleaseCapture();
const int WM_NCLBUTTONDOWN = 0xA1;
const int HTCAPTION = 2;

private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
	ReleaseCapture();
	SendMessage(Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0);
}
 
just on the windows taskbar right click on the application and choose move and then you can move this form
 
But now I have a new problem, I have a video object in that form, and when I move the form it changes to black, and only when is in the new place it starting to work fine.
I want to say that while I drag the form I don't see the content of the video.
I am using DirectX 9.0 SDK and the AudioVideoPayback namespace.
Can you help me with that?
Thanks.
 
I'm afraid DX9 video is beyond the scope of my knowledge, but if you can catch the form's LocationChanged event and force a refresh of the video location somehow that ought to do the trick.
 
Back
Top