window move

  • Thread starter Thread starter DaveL
  • Start date Start date
D

DaveL

is there a way to stop the user from moving the window
when the caption /title is visible

?

DaveL
 
A quick and easy way to do this would be to record what the top and
left values of the form is and this connect to the Move event and
reset the top and left values to the ones you saved.

There are probably better ways, but this is a quick and dirty way to
do it.

int MyTop = 0;
int MyLeft = 0;

private void Form1_Load(object sender, EventArgs e)
{
MyTop = this.Top;
MyLeft = this.Left;
}

private void Form1_Move(object sender, EventArgs e)
{
if (MyTop != 0 && MyLeft != 0)
{
this.Top = MyTop;
this.Left = MyLeft;
}
}

Hope this helps,

L. Lee Saunders
http://oldschooldotnet.blogspot.com
 
is there a way to stop the user from moving the window
when the caption /title is visible

When asking this question it should always be followed by "and is it a good
idea to do this?" Users expect to be able to move windows. You need a
spectacularly good reason to prevent them from doing so.
 
the window is assigned to a control (textbox)
and should not be moved
Normally i dont care what users do. they can open up as many windows of my
application that they wish

but this is a custom control ownd by a textbox
Hence Not movable

DaveL
 
Back
Top