Skip to main content

Controlling Resizing Operations

  • 3 minutes to read

This topic describes how resizing operations performed by end-users can be restricted.

Responding to Resizing Operations Performed by end-users

When an end-user starts a resizing operation the DockManager.StartSizing event of the appropriate dock manager is fired. This happens immediately after an end-user has pressed the mouse button. The event’s Cancel parameter can be set to true to cancel the resizing operation before it is started.

If the operation wasn’t canceled, then the end-user can drag the panel’s edge to resize the panel. On each mouse move the DockManager.Sizing event is fired. The event’s PtClient parameter specifies the current coordinates of the mouse cursor relative to the top left corner of the panel being resized and this can be used to determine the potential size of the dock panel. If you need to cancel the resizing operation when the panel’s potential size is, for instance, less than a specific value, you need to set the event’s Cancel parameter to true.

When the mouse button is released, the dragged edge is moved to the new position and the DockManager.EndSizing event is raised.


The sample code below shows how to prevent child panels from being vertically resized when they belong to split containers. Horizontal resizing operations are still allowed. The StartSizing event is handled to enable and disable the sizing operations.

Child panels within a vertical split container can be resized by dragging their bottom edges. So the event’s Cancel parameter should be set to true if the panel’s bottom edge is being dragged.

The maximize buttons (Maximize_button) allow end-users to maximize and minimize a specific panel within a split container. In this example these buttons are hidden by setting the dock manager’s BaseDockOptions.ShowMaximizeButton property to false.

using DevExpress.XtraBars.Docking;
// ...
private void Form1_Load(object sender, System.EventArgs e) {
   dockManager1.DockingOptions.ShowMaximizeButton = false;

private void dockManager1_StartSizing(object sender, StartSizingEventArgs e) {
   // Get the container panel that owns the panel being dragged.
   DockPanel parentPanel = e.Panel.ParentPanel;
   if(parentPanel != null) {
      // Disable the sizing operation when the panel's bottom edge is being dragged.
      e.Cancel = e.SizingSide == SizingSide.Bottom;            
See Also