Categories > Coding > C# >
How to make borderless window draggable?
Posted
How to make borderless window draggable? I am a new C# programmer so I don't know much. I have a panel that it is supposed to drag when held click, but it doesn't work.
Replied
To do this all you have to do is
1)Create a mouse down event for the border
2)Add this code in the mouse down event
bool drag = Mouse.LeftButton == MouseButtonState.Pressed;
if (drag)
{
this.DragMove();
}
Cancel
Post
Added
@65993Uhh never thought of that ;-;
If win forms
Just go to properties of that Panel and set the draggable property as true
Cancel
Post
Creakyy Exploit
Custom DLL Soon
Cool UI
Replied
@67542What do you mean? I can't see a draggable property
Cancel
Post
Added
nevermind I found how to do it, I appreciate the help though
Cancel
Post
Added
protected override void WndProc(ref Message m)
{
switch (m.Msg)
{
case 0x84:
base.WndProc(ref m);
if((int)m.Result == 0x1)
m.Result = (IntPtr)0x2;
return;
}
base.WndProc(ref m);
}
Although this is really WM_NCHITTEST but hidden, still works nice.
Cancel
Post
Replied
Cancel
Post
Creakyy Exploit
Custom DLL Soon
Cool UI
Replied
@MINISHXP just use bunifu or guna drag, if not then use a dllimport dragmove and use a point
Cancel
Post
Replied
Use GunaDrag or BunifuDrag, and select the thing u want to be draggable in the properties
Cancel
Post
yes :nod:
Replied
If you're using Winforms.
Get a panel then go to its properties. Double click MouseMove and MouseDown.
Enter in Mouse move :
if (e.Button == MouseButtons.Left)
{
this.Left += e.X - lastPoint.X;
this.Top += e.Y - lastPoint.Y;
}
Enter in MouseDown
lastPoint = new Point(e.X, e.Y);
Now under MouseMove
Point lastPoint; // This will fix all the errors.
Cancel
Post
dont exploit that much now
Users viewing this thread:
( Members: 0, Guests: 1, Total: 1 )
Cancel
Post