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. Image for the cookie policy date

Disable DockingManager caption bar

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



3 Replies

SD Shane Dibbern February 4, 2008 08:11 PM UTC


I am using Visual Studio 2005 with Syncfusion 5.1.0.51.



AD Administrator Syncfusion Team 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



SD Shane Dibbern 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



Loader.
Live Chat Icon For mobile
Up arrow icon