473,401 Members | 2,146 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

Very Odd issue with Docking...

I have code that when you drag a child form within 5 of the parent one it docks. Then when you drag it out of the 5 it returns the size of the child form to what it started as....That works GREAT! But when you release the mouse the child form then goes back to the size it was when it was docked. You drag it again and it goes back to the creation size like I wanted until I release the mouse again! GGGAAAH!

I found a way to make it resize itself after I let go of the mouse but it grows likes it is docked then shrinks to the right size. Which is annoying because the screen flashes...

These are the two functions in the child form that control everything..

void FrmChildMove(object sender, EventArgs e)
{
// Determine the current location in parent form coordinates.
Point mouseAt = this.MdiParent.PointToClient(this.Location);
this.Text = "X: "+Convert.ToString(mouseAt.X)+ " - Y: "+Convert.ToString(mouseAt.Y);

// Determine if the floated is close enough to dock.
if (mouseAt.X < 5 && mouseAt.X > -5)
{
if ((Control.MouseButtons & MouseButtons.Left) == MouseButtons.Left)
{
dockTestAt = mouseAt;
// Reset the timer to poll for the MouseUp event.
tmrDock.Enabled = false;
tmrDock.Enabled = true;
}
}
else
{
//this controls shrinking the window back if you drag outside the 5
this.Dock = DockStyle.None;
this.Width = xx;
//this is the width, its saved when the form first loads, yy is the height
this.Height = yy;
}

}


// This is the tick function that keeps track of the mouse up
private void tmrDock_Tick(object sender, System.EventArgs e)
{
if (dockTestAt.X == this.MdiParent.PointToClient(this.Location).X
&& dockTestAt.Y == this.MdiParent.PointToClient(this.Location).Y)
{
if (Control.MouseButtons == MouseButtons.None)
{
// Dock in place.
tmrDock.Enabled = false;
this.Dock = DockStyle.Left;
}
}
else
{
// Mouse has moved. Disable this dock attempt.
tmrDock.Enabled = false;
this.Dock = DockStyle.None;
}
}


I am basing the code off of http://www.java2s.com/Code/CSharp/GUI-Windows-Form/MDIandDock.htm

It's annoying because I can't figure out why the child form goes back to the size of when it was docked when I release the mouse.
Aug 29 '07 #1
1 1241
Sorry about bumping this. I have just looked everywhere I could imagine yesterday and usually you all are my last resort. I am not quite sure what to do if you don't know the answer.
Rob
Aug 30 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Lecture Snoddddgrass | last post by:
Greetings, Can anyone recommend a good 3rd party docking windows component for WinForms? I'm looking for something that allows windows to not only be docked but to "popout", much like the...
0
by: ka | last post by:
I'm using Corwnwood.Magic library for docking in my application. My application to let the users to create their screen look to show some particular data. I treid to dock my things in the way,...
1
by: JDeats | last post by:
I have a WinForm that is set as an MDIContainer, I have an Panel on this form that has it's docking property set to "Top". When a spawn an MDI childform inside my parent all is well untill I...
13
by: Martin Ho | last post by:
I know this must be trivial for many of you. But I am playing with this and can't figure it out. I have a form, on that form is one panel which has 3 textboxes, when I run my program and...
7
by: Chris Dunaway | last post by:
Where/How does VS determing docking order? I created a form with a panel docked to the top and a tab control with fill docking. I had added some tabs and place some controls, etc., and decided...
25
by: Dennis | last post by:
Has anyone really gotten the Docking and Splitter Bars to work for anyting but the simplest application for two controls and one splitter bar filling the whole form? If so, can you enlighten my on...
0
by: Sam | last post by:
Hi, I have developped a docking panel that shows when the mouse is over a button and then hides when the mouse leaves the panel. It works fine except when there are child controls in the panel and...
4
by: Enrique | last post by:
hi all, i'd like to know how i could do a docking menu and docking toolbar. i know it's not so easy y VS .NET 2002 and 2003. anything will help me: links, code, articles..... thanks a...
1
by: Joe | last post by:
I'm creating a C# application, and want to use docking windows. However, I want the docking windows to look like the docking windows withing VS2005, with a title bar, close button, etc... When...
2
by: Matt Brown - identify | last post by:
Hello, I've spent the better part of the day going over code and thinking and have come up with the following docking method that works perfectly. At this point, my brain is about to explode...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.