Code Snippet
[DllImport("user32.dll")]
static extern bool SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int X,
int Y, int cx, int cy, uint uFlags);
const uint SWP_NOMOVE = 0x0002;
const uint SWP_NOZORDER = 0x0004;
private void button1_Click(object sender, EventArgs e)
{
int width = int.Parse(this.textBox1.Text);
int height = int.Parse(this.textBox2.Text);
SetWindowPos(this.Handle, 0, 0, 0, width, height, SWP_NOMOVE | SWP_NOZORDER);
}