473,788 Members | 2,988 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Very Odd issue with Docking...

21 New Member
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(ob ject sender, EventArgs e)
{
// Determine the current location in parent form coordinates.
Point mouseAt = this.MdiParent. PointToClient(t his.Location);
this.Text = "X: "+Convert.ToStr ing(mouseAt.X)+ " - Y: "+Convert.ToStr ing(mouseAt.Y);

// Determine if the floated is close enough to dock.
if (mouseAt.X < 5 && mouseAt.X > -5)
{
if ((Control.Mouse Buttons & MouseButtons.Le ft) == MouseButtons.Le ft)
{
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(ob ject sender, System.EventArg s e)
{
if (dockTestAt.X == this.MdiParent. PointToClient(t his.Location).X
&& dockTestAt.Y == this.MdiParent. PointToClient(t his.Location).Y )
{
if (Control.MouseB uttons == MouseButtons.No ne)
{
// 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 1254
RobAMacAF
21 New Member
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
2966
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 Solution Explorer or Toolbox in Visual Studio.NET. For my last project, I used the SyncFusion component for docking windows, but my experience is that SyncFusion is buggy. I'd prefer to use a different vendor for this project. Any advice? Thanks,
0
3134
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, Left Side: ToolBox Middle: WorkPanel Right: Package Explorer + PropertyWindow WorkToolBox, Package Explore, PrepertyWindow : derived from Content
1
4003
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 maximize the MDI child window, when I do this the title bar (with max, min buttons, etc..) for the child appears above my docked Panel. The desired effect is for the MDI child window to maximize with its title bar under the the docked panel on the...
13
2511
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 maximize the form I want to resize my 3 text boxes according to the size of the form. Each text box should take 33% of the panel's width and full hight of the panel's height. Resizing of the panel is easy with docking... but these 3 textboxes are driving...
7
3119
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 to add a status bar to the main form. I add the status bar and docked it to the bottom, but the tabControl when docked as filled, fills *behind* the status bar.
25
5336
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 HOW! I even tried creating background panels and docking them with the controls on the panels but the docking order seems to be random! Another useless control from Microsoft I think! -- Dennis in Houston
0
933
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 that the mouse leaves the panel through the child controls. Since the mouse didn't leave through the panel directely, the panel is not hide. Here is my method onMouseMove for the inherited panel : Protected Overrides Sub OnMouseMove(ByVal e As...
4
5010
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 lot for your responses and i wish you a merry christmas :-)
1
2037
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 the user clicks and drags the docking window, it'll un-dock, and open in a tool window, and also allow the user to re-dock it elsewhere... Any ideas where I can go to look up how to accomplish this? Thanx! --
2
2634
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 and I was wondering if someone can help me figure out the calculations for right and bottom docking: note: lRelOffsetLeft and lRelOffsetTop are calculated on mousedown (location of mouse in relation to top and left of picturebox)
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10364
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10172
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9967
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.