Move able solution ...
 
Notifications
Clear all

Move able solution with no border

Page 1 / 2

Rage
Posts: 164
 Rage
Topic starter
(@Rage)
Estimable Member
Joined: 9 years ago

So I wrote this tutorial and was almost done but then clicked "delete" on my computer and instead of deleting anything it went back to a previous screen and deleted everything so I am redoing this all over again !!

This tut is meant to help those who want to create there own border, don't want a border, or just want there whole form to be able to be clicked and moved !!

Lets get started !

Step 1.) You need to add the following under the start of your form
ex. Gyazo - feadd0eacf0a630790ceda31fc8aeb04.png

public static string Status;
	        public static string MemStatus;
	        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();

Step 2.) Select your move ables and find its properties
ex. I will be using pictureBox4 (I set it to the background so my title and icons still show)

Step 3.) Under your pictureBox (or other items) "Properties" you need to click the Lightning Bolt icon

Step 4.) Now you need to scroll down and find "MouseDown" and double click it

Step 5.) Now you will be taken to the code for your program

There you will add the following code...

{
	                if (e.Button == MouseButtons.Left)
	                {
	                    ReleaseCapture();
	                    SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
	                }
	            }

Now you are done !!

If you wish to also add the move able feature to your title and icons you can simply by going to the items properties and finding "MouseDown" and clicking the arrow and click the item that appears there
(should look like "pictureBox_MouseDown")

Enjoy and hope to see some unique tools get released !!

Reply
6 Replies
Jet
Posts: 158
 Jet
(@jet)
Estimable Member
Joined: 9 years ago

Good stuff mate!

Reply
Cyb3r
Posts: 1598
(@cyb3r)
Noble Member
Joined: 10 years ago

Actually I was looking for this once, it might be useful later, thanks mate and keep it up! 😀

Reply
Rage
Posts: 164
 Rage
Topic starter
(@Rage)
Estimable Member
Joined: 9 years ago

Good stuff mate!

Actually I was looking for this once, it might be useful later, thanks mate and keep it up! 😀

No problem, this was actually something that I have had for some time now which I knew was out there but it was not easy to find so I decided to share it here, just hoping to see some unique styled programs get released other than the same looking tools that do the same functions lol

Reply
Cain532
Posts: 1280
(@cain532)
Noble Member
Joined: 10 years ago

Very cool 😀 Thanks for posting this!

Reply
Page 1 / 2