We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Prevent Splitter from closing

Thread ID:

Created:

Updated:

Platform:

Replies:

33701 Aug 24,2005 02:41 PM UTC Aug 24,2005 07:45 PM UTC WinForms 3
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On August 24, 2005 02:41 PM UTC

I am using vs 3.201.1.515 of the grid control inside a TabBarSplitterControl. What is the easiest way to prevent closing of a pane? There is no way to cancel the PaneClosing event. I would like to prevent the PaneClosing event from destroying the grid control. Thanks, Per

Administrator [Syncfusion]
Replied On August 24, 2005 04:01 PM UTC

The only way I know to do this is to derive the control and ignore the MouseUp if it is outside the grid. Here is a try at this. You will want to tweak the values to get the behavior you want.
public class MySplitterControl : SplitterControl
{
	private Point downPT;
	protected override void OnMouseDown(MouseEventArgs e)
	{
		downPT = new Point(e.X, e.Y);
		base.OnMouseDown (e);
	}

	protected override void OnMouseUp(MouseEventArgs e)
	{
		Point pt = new Point(e.X, e.Y);
		if(pt.Y < 40 || pt.Y > this.Height - 40
			|| pt.X < 40 || pt.X > this.Width - 4)
		{
			MouseEventArgs e1 = new MouseEventArgs(e.Button, e.Clicks, downPT.X, downPT.Y, e.Delta);
			base.OnMouseUp(e1);
			return;
		}
		base.OnMouseUp (e);
	}
}

Administrator [Syncfusion]
Replied On August 24, 2005 07:01 PM UTC

Thanks Clay, The OnMouseDown event only seems to fire when I "create" the pane by dragging the splitter from the lower right corner. If I release the splitter and then click on it again (this time in the middle of the screen) the OnMouseDown event does not fire. I hope this makes sense. Any other ideas? Thanks Per >The only way I know to do this is to derive the control and ignore the MouseUp if it is outside the grid. Here is a try at this. You will want to tweak the values to get the behavior you want. >
>public class MySplitterControl : SplitterControl
>{
>	private Point downPT;
>	protected override void OnMouseDown(MouseEventArgs e)
>	{
>		downPT = new Point(e.X, e.Y);
>		base.OnMouseDown (e);
>	}
>
>	protected override void OnMouseUp(MouseEventArgs e)
>	{
>		Point pt = new Point(e.X, e.Y);
>		if(pt.Y < 40 || pt.Y > this.Height - 40
>			|| pt.X < 40 || pt.X > this.Width - 4)
>		{
>			MouseEventArgs e1 = new MouseEventArgs(e.Button, e.Clicks, downPT.X, downPT.Y, e.Delta);
>			base.OnMouseUp(e1);
>			return;
>		}
>		base.OnMouseUp (e);
>	}
>}
>

Administrator [Syncfusion]
Replied On August 24, 2005 07:45 PM UTC

If I put a Console.WriteLine("OnMouseDown"); in the override, I see it hit when I click on a existing splitter in the middle. Am I missing your point? http://www.syncfusion.com/Support/user/uploads/CS_259b50aa.zip

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;