Click here to Skip to main content
15,907,392 members
Home / Discussions / C#
   

C#

 
GeneralBeta 2.0 limitations Pin
Yaakov Davis10-Dec-04 17:46
Yaakov Davis10-Dec-04 17:46 
GeneralRe: Beta 2.0 limitations Pin
Heath Stewart10-Dec-04 20:46
protectorHeath Stewart10-Dec-04 20:46 
GeneralRe: Beta 2.0 limitations Pin
Yaakov Davis10-Dec-04 22:22
Yaakov Davis10-Dec-04 22:22 
QuestionHow to Create static Enum like ConnectionState Pin
trevor_ledet10-Dec-04 15:21
trevor_ledet10-Dec-04 15:21 
AnswerRe: How to Create static Enum like ConnectionState Pin
Heath Stewart10-Dec-04 20:51
protectorHeath Stewart10-Dec-04 20:51 
GeneralRe: How to Create static Enum like ConnectionState Pin
trevor_ledet11-Dec-04 5:52
trevor_ledet11-Dec-04 5:52 
GeneralMOVING CHILD WINDOWS IN MDI Pin
Tyrus18210-Dec-04 15:19
Tyrus18210-Dec-04 15:19 
GeneralRe: MOVING CHILD WINDOWS IN MDI Pin
Skynyrd10-Dec-04 16:28
Skynyrd10-Dec-04 16:28 
No need to fumble with Screen or Client coordinates. Its all a question of relative distances so your absolute zero really doesnt matter.

See if this works any better. Haven't tested it, but logic says it should work :p (Contrary to what I said above the code includes some Screen / Client coordinates but its not strictly necessary. The sole purpose is to make everything a little fancier detecting when ur trying to move the child form out of it's parent window)

Point mouseDownPos;

protected override void OnMouseDown(MouseEventArgs e)
{
mouseDownPos=Cursor.Position;
Cursor.Clip=new Rectangle(this.MdiParent.PointToScreen(this.MdiParent.ClientRectangle.Location),this.MdiParent.ClientRectangle.Size);
this.Capture=true;
}

protected override void OnMouseMove(MouseEventArgs e)
{
if (this.Capture)
{
Point mousePos=Cursor.Position;
Rectangle rec=this.MdiParent.ClientRectangle;
int cx=mousePos.X-mouseDownPos.X;
int cy=mousePos.Y-mouseDownPos.Y;
this.Location=new Point(this.Left+cx,this.Top+cy);
mouseDownPos=Cursor.Position;
}
}

protected override void OnMouseUp(MouseEventArgs e)
{
Cursor.Clip=new Rectangle(0,0,0,0);
base.OnMouseUp (e);
}

Hope it helps
GeneralRe: MOVING CHILD WINDOWS IN MDI Pin
Tyrus18210-Dec-04 17:03
Tyrus18210-Dec-04 17:03 
GeneralRe: MOVING CHILD WINDOWS IN MDI Pin
Skynyrd10-Dec-04 17:07
Skynyrd10-Dec-04 17:07 
GeneralRe: MOVING CHILD WINDOWS IN MDI Pin
Tyrus18210-Dec-04 17:15
Tyrus18210-Dec-04 17:15 
GeneralRe: MOVING CHILD WINDOWS IN MDI Pin
Tyrus18210-Dec-04 17:14
Tyrus18210-Dec-04 17:14 
GeneralRe: MOVING CHILD WINDOWS IN MDI Pin
Skynyrd10-Dec-04 17:17
Skynyrd10-Dec-04 17:17 
GeneralRe: MOVING CHILD WINDOWS IN MDI Pin
Tyrus18210-Dec-04 17:29
Tyrus18210-Dec-04 17:29 
GeneralRe: MOVING CHILD WINDOWS IN MDI Pin
Tyrus18210-Dec-04 17:44
Tyrus18210-Dec-04 17:44 
GeneralRe: MOVING CHILD WINDOWS IN MDI Pin
Skynyrd10-Dec-04 19:10
Skynyrd10-Dec-04 19:10 
GeneralRe: MOVING CHILD WINDOWS IN MDI Pin
Tyrus18210-Dec-04 19:54
Tyrus18210-Dec-04 19:54 
GeneralRe: MOVING CHILD WINDOWS IN MDI Pin
Skynyrd11-Dec-04 2:08
Skynyrd11-Dec-04 2:08 
GeneralsqlCommand in C# Pin
John L. DeVito10-Dec-04 12:48
professionalJohn L. DeVito10-Dec-04 12:48 
GeneralRe: sqlCommand in C# Pin
Heath Stewart10-Dec-04 13:03
protectorHeath Stewart10-Dec-04 13:03 
GeneralCallContext SerializationException Pin
Skynyrd10-Dec-04 12:48
Skynyrd10-Dec-04 12:48 
GeneralRe: CallContext SerializationException Pin
Heath Stewart10-Dec-04 12:54
protectorHeath Stewart10-Dec-04 12:54 
GeneralRe: CallContext SerializationException Pin
Skynyrd10-Dec-04 13:12
Skynyrd10-Dec-04 13:12 
GeneralRe: CallContext SerializationException Pin
Heath Stewart10-Dec-04 14:28
protectorHeath Stewart10-Dec-04 14:28 
GeneralRe: CallContext SerializationException Pin
Skynyrd10-Dec-04 14:49
Skynyrd10-Dec-04 14:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.