Categories > Coding > C# >

How to make borderless window draggable?

Posts: 3

Threads: 1

Joined: May, 2021

Reputation: 0

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.

  • 0

Posts: 27

Threads: 2

Joined: Apr, 2021

Reputation: -28

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();
            }
  • 0

Added

@65993Uhh never thought of that ;-;

 

If win forms

Just go to properties of that Panel and set the draggable property as true

  • 0

Creakyy Exploit

Custom DLL Soon

Cool UI

Posts: 3

Threads: 1

Joined: May, 2021

Reputation: 0

Replied

@67542What do you mean? I can't see a draggable property

  • 0

Added

nevermind I found how to do it, I appreciate the help though

  • 0

MINISHXP

[REDACTED]

Posts: 976

Threads: 3

Joined: Jan, 2021

Reputation: 9

Replied

@Creakyy thats not a thing....

  • 0

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.

  • 0

Posts: 27

Threads: 2

Joined: Apr, 2021

Reputation: -28

Replied

@MINISHXP Yikes!!

I did win forms a long time ago so forgot it lol

Now I do only wpf

  • 0

Creakyy Exploit

Custom DLL Soon

Cool UI

TERIHAX

i say im gay as a joke 🙀

Posts: 2243

Threads: 102

Joined: Jul, 2020

Reputation: 32

Replied

@MINISHXP just use bunifu or guna drag, if not then use a dllimport dragmove and use a point

  • 0

Posts: 21

Threads: 2

Joined: Feb, 2021

Reputation: 0

Replied

Use GunaDrag or BunifuDrag, and select the thing u want to be draggable in the properties

  • 0

yes :nod:

ImBadAtExploits

aka. enteristic

Posts: 42

Threads: 9

Joined: Apr, 2021

Reputation: 0

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.
  • 0

dont exploit that much now

Users viewing this thread:

( Members: 0, Guests: 1, Total: 1 )