Official Everybody Edits Forums

Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?

You are not logged in.

#1 Before February 2015

Koya
Fabulous Member
From: The island with those Brits
Joined: 2015-02-18
Posts: 6,310

[Guide] Making a panel the drag-able part of the form.

While making my snake bot I had my first opportunity to make a panel as a head bar, and if you want to make your bot look nice this could be implemented

using System.Runtime.InteropServices;
public const int WM_NCLBUTTONDOWN = 0xA1; public const int HT_CAPTION = 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();
private void panel1_MouseMove(object sender, MouseEventArgs e) {     if (e.Button == MouseButtons.Left)     {         ReleaseCapture();         SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);     } }

Also direct label_MouseMove to there ^

Last edited by Metatron (Aug 9 2014 2:35:45 pm)


Po9cnQh.png

PLNQVL8.png
Thank you eleizibeth ^

1SYOldu.png

I stack my signatures rather than delete them so I don't lose them
giphy.gif

WfSi4mm.png

Offline

#2 Before February 2015

Tako
Member
From: Memphis, Tennessee, USA
Joined: 2015-08-10
Posts: 6,663
Website

Re: [Guide] Making a panel the drag-able part of the form.

What is "Handle"?
[Edit] Nevermind, it's a class of some type. Very strange but I guess it works.

It's interesting to know how this works. It tricks Windows into thinking that the entire form is the title bar, and therefore draggable. I've used it once before.

Also, here's the credit for this code. Wouldn't want to be accused of plagiarizing.


Yeah, well, you know that's just like, uh, your opinion, man.

Offline

#3 Before February 2015

Koya
Fabulous Member
From: The island with those Brits
Joined: 2015-02-18
Posts: 6,310

Re: [Guide] Making a panel the drag-able part of the form.

Tako wrote:

Also, here's the credit for this code. Wouldn't want to be accused of plagiarizing.

This code has been posted quite a few times and so I don't know who originally posted it.


Po9cnQh.png

PLNQVL8.png
Thank you eleizibeth ^

1SYOldu.png

I stack my signatures rather than delete them so I don't lose them
giphy.gif

WfSi4mm.png

Offline

Koya1423758188203244

Board footer

Powered by FluxBB

[ Started around 1713891366.4603 - Generated in 0.032 seconds, 10 queries executed - Memory usage: 1.41 MiB (Peak: 1.52 MiB) ]