I have created a container that will position 4 panels that has 15
different layouts to choose from.
I have based it similar to a System.Windows. Forms.SplitCont ainer but
that has 4 panels instead of 2.
It douse not have the ability on fixing the splitter like the
SplitContainer class has, each splitter is based on a parentage of the
container. For what I wanted it for it did not need that capability so
I wasn’t too bothered.
I have also created the Designer class for the control Container and
the Containers panel class making it user friendly at design time.
I am very please with what I have achieved so far but I have become a
little stuck when I came to moving the splitters at run time with the
mouse.
What I aim to acheave is something like this
<code>
protected override void OnMouseDown(Mou seEventArgs e)
{
base.OnMouseDow n(e);
if (e.X this.VerticalSp litter1Position -
(this.splitterT hicknes / 2) &&
e.X < this.VerticalSp litter1Position +
(this.splitterT hicknes / 2))
{
while (true)
{
// TO-DO
// Re-capture the state of the mouse.
e = new MouseEventArgs( ); // TO-DO - Dont no how to re
capture the state of the mouse.
// If the left button is no longer pressed exit loop.
if (e.Button != MouseButtons.Le ft)
{
break;
}
this.VerticalSp litter1Position = e.X;
Application.DoE vents();
}
}
}
</code>
When the mouse is pressed while over one of the splitters it call the
OnMouseDown event.
Then it needs to wait until the user releases the mouse button before
re locating the splitter to the new position.
The problem I have is that I don’t know how to obtain the mouse
coordinates when the mouse leaves the area of the splitter when the
mouse moves over one of the containers panels within the container the
mouse events are no longer called.
Am I thinking completely wrong by thinking about a loop within the
OnMouseDown event and if so could anybody point me in the write
direction.
This is a link to my container control source code including a simple
form displaying the views that the container offers.
http://www.jdnd.co.uk/temp/QuodContainer.rar
Thank you all for any help and I hope this cold be useful to someone.