TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
thiago costa
NA
319
0
How to make you able to "Click Anywhere On Form To Move It" in c# ?
Sep 28 2011 9:30 PM
Hey, My program will look better with out the form boarder, how do I make it so I can move it on the screen by clicking on ANYWHERE on the form, and dragging it ? thanks
************** EDIT**************
I got it !!! This is how I did it:
using
System
.
Runtime
.
InteropServices
;
const
int
HT_CAPTION =
0x2
;
const
int
WM_NCLBUTTONDOWN =
0xA1
;
[
DllImportAttribute
(
"user32.dll"
)]
public
static
extern
int
SendMessage
(
IntPtr
hWnd,
int
Msg
,
int
wParam,
int
lParam);
[
DllImportAttribute
(
"user32.dll"
)]
public
static
extern
bool
ReleaseCapture
();
private
void
Form1_MouseDown
(
object
sender,
MouseEventArgs
e)
{
if
(e.
Button
==
MouseButtons
.
Left
)
{
ReleaseCapture
();
SendMessage
(
Handle
, WM_NCLBUTTONDOWN, HT_CAPTION,
0
);
}
}
Reply
Answers (
1
)
Automating programs using C#
Ebooks for Beginners