unknowncheats uc-forum.com ucdownloads ucdownloads.com

Go Back   UC-Tutorials - Multiplayer Game Hacking and Cheat Tutorials > Programming > C and C++

- Sponsored Advertisement -
http://www.myfpscheats.com/


Reply
 
Thread Tools Display Modes
  #1  
Old 12-23-2006, 06:53 AM
zero_tolerance zero_tolerance is offline
Senior Member
 
Join Date: Dec 2006
Posts: 289
Default Moving a borderless form in C#

By SplIce

If you want to make a borderless form and be able to move it with the mouse, heres how:

Step 1:
Add this to the using list,
Code:
using Microsoft.Win32;
Step 2:
Add this to the public frmTTMain()
Under InitializeComponent();
Code:
this.MouseDown += new MouseEventHandler(this.frmTTMain_MouseDown);
Step 3:
Add this AFTER the private void frmTTMain_Load
Code:
//API functions to move the form
public const int WM_NCLBUTTONDOWN = 0xA1;
public const int HTCAPTION = 0x2;
[DllImportAttribute("user32.dll")]
public static extern bool ReleaseCapture();
[DllImportAttribute("user32.dll")]
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);

public void frmTTMain_MouseDown(object sender, MouseEventArgs e)
{
	//If the left mouse is pressed, release form for movement
	if (e.Button == MouseButtons.Left)
{
	ReleaseCapture();
	SendMessage(Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0);
}
I found this off of a site don't recall which.............
Reply With Quote
Reply

  • Submit Thread to Digg
  • Submit Thread to del.icio.us
  • Submit Thread to StumbleUpon
  • Submit Thread to Google
  • Submit Thread to Facebook
  • Submit Thread to My Yahoo!
  • Submit Thread to MySpace
  • Submit Thread to Twitter
  • Submit Thread to Reddit

Tags
borderless, form, moving

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 05:54 AM.