What’s The Difference Between String and string in C#?

String stands for System.String and it is a .NET Framework type. string is an alias in the C# language for System.String. Both of them are compiled to System.String in IL (Intermediate Language), so there is no difference. Choose what you like and use that. If you code in C#, I’d prefer string as it’s a C# type alias and well-known by C# programmers.

See more:

2016-01-05_12-41-21.jpg

How to drag your form when “formBorderStyle” was set “none”?

just use 3-M …

Add 3 events MouseDown – MouseUp & MouseMove.

declare :

Boolean flag;
int x, y;

MouseDown function:

flag = true;
x = e.X;
y = e.Y;

MouseUp function:

flag = false;

MouseMove function:

if (flag)
{
this.SetDesktopLocation(Cursor.Position.X – x, Cursor.Position.Y – y);
}

or another solution:


using System.Runtime.InteropServices;

public const int WM_NCLBUTTONDOWN = 0xA1;
public const int HT_CAPTION = 0x2;

[DllImportAttribute("user32.dll")]
private static extern int SendMessage(IntPtr hWnd,
int Msg, int wParam, int lParam);
[DllImportAttribute("user32.dll")]
private static extern bool ReleaseCapture();

public Form1()
{
InitializeComponent();
}

private void menuStrip1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
ReleaseCapture();
SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
}
}

[C-Sharp] – MouseDown for moving the Form: Drag and drop menustrip

using System.Runtime.InteropServices;
public const int WM_NCLBUTTONDOWN = 0xA1;
public const int HT_CAPTION = 0x2;
[DllImportAttribute("user32.dll")]
private static extern int SendMessage(IntPtr hWnd,
 int Msg, int wParam, int lParam);
[DllImportAttribute("user32.dll")]
private static extern bool ReleaseCapture();

public Form1()
{
InitializeComponent();
}

For menustrip or some other object:

private void menuStrip1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
ReleaseCapture();
SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
}
}