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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Disable DockingManager caption bar

Thread ID:

Created:

Updated:

Platform:

Replies:

71520 Feb 4,2008 05:24 PM UTC Feb 7,2008 05:51 PM UTC WinForms 3
loading
Tags: Tools
Shane Dibbern
Asked On February 4, 2008 05:24 PM UTC

I have an application with only one docked control - TreeViewAdv. I have removed all but the Menu and Pin buttons from the caption bar.

Due to the asynchronous nature of the application (sending requests to a server) there are times when I need to 'disable' the application (like when a modal dialog is up). When in this disabled state I am able to disable the docked control via DockingManager.Controls. I can disable the right click (on the caption bar) context menu via DockingManager.EnableContextMenu. However, I also need to disable the caption bar buttons. Thus when disabled, the user would not be able to click them nor would they draw 'highlighted' when the user mouses over them.

Is there any way to disable the caption bar as a whole or at least the individual buttons?

thanks,
shane



Shane Dibbern
Replied On February 4, 2008 08:11 PM UTC


I am using Visual Studio 2005 with Syncfusion 5.1.0.51.


Administrator [Syncfusion]
Replied On February 5, 2008 01:23 PM UTC

Hi Shane,

Thank you for your interest in Syncfusion products.

Disabling CaptionBar buttons.

You can disable the functionalities of CaptionBar buttons on the docking control by handling click event of CaptionBar button and setting e.Cancel to true. Here is a code snippet.

[C#]

this.dockingManager1.CaptionButtons[0].Click += new CancelEventHandler(button1_Click);
this.dockingManager1.CaptionButtons[1].Click += new CancelEventHandler(button1_Click);
this.dockingManager1.CaptionButtons[2].Click += new CancelEventHandler(button1_Click);
this.dockingManager1.CaptionButtons[3].Click += new CancelEventHandler(button1_Click);

void button1_Click(object sender, CancelEventArgs e)
{
e.Cancel = true;

}

Sample reference

Please refer the below sample that illustrates the same.

http://websamples.syncfusion.com/samples/Tools.Windows/F71520/main.htm

Disabling highlight when mouse hover on CaptionBar buttons.

For this , you need to derive the DockingManager->DockHost->CaptionPainter and override the CaptionHitTest method in the CaptionPainter class and change the CaptionButtonState to Normal when MouseAction is MouseMove.

Please refer to the following code snippet.

[C#]

public class CustomDockingManager : DockingManager
{
protected override DockHost CreateDockHost(Control ctrl){
return new CustomDockHost(this, ctrl); }

}

// To plugin CustomCaptionPainter
public class CustomDockHost : DockHost
{
public CustomDockHost(DockingManager manager, Control ctrl):base(manager, ctrl)
{ }
protected override CaptionPainter CreateCaptionPainter()
{
return new CustomCaptionPainter(this.dcInternal);
}
}

public class CustomCaptionPainter : CaptionPainter
{
public CustomCaptionPainter(DockHostController dcb):base(dcb)
{ }

// Overriding these let you customing painting caption.
// Refer to ..Tools\src\Docking Manager\FrameworkComponents\DockingWindows\CaptionPainter.cs for imp. details.


protected override void DrawHoverBorder(Graphics gph, Rectangle rcbtn)
{
// base.DrawHoverBorder(gph, rcbtn);
//Implement your own code here.
}
protected override void DrawPressedBorder(Graphics gph, Rectangle rcbtn)
{
//base.DrawPressedBorder(gph, rcbtn);
//Implement your own code here.
}
public override void PaintCaption(Graphics gph)
{
//base.PaintCaption(gph);
//Implement your own code here.
}

public override Syncfusion.Windows.Forms.Tools.CaptionPainter.CaptionHitTest HitTest(MouseAction action, Point pt)
{
if ( action == MouseAction.MouseMove )
{
stateAppearance = CaptionButtonState.Normal;
}
return base.HitTest (action, pt);

}
}

Please let me know if this helps you.

Regards,
Jaya


Shane Dibbern
Replied On February 7, 2008 05:51 PM UTC


I should be able to accomplish everything I need to with the code examples that you have provided.

thanks!
shane



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

;