protected override void OnMouseDown(MouseEventArgs e)
 {
     base.OnMouseDown(e);
     if (e.Button == MouseButtons.Left)
     {
         Cursor cursorAtPoint = this.owner.GetCursorAtPoint(e.Location);
         LayoutControlResizingBehavior behaviorAtPoint = this.owner.GetBehaviorAtPoint(e.Location);
         if (cursorAtPoint != Cursors.Default)
         {
             Orientation resizeType = cursorAtPoint == Cursors.SizeNS ? Orientation.Vertical : Orientation.Horizontal;
             if (behaviorAtPoint.BeginResize(e.Location, resizeType))
             {
                 this.capturedBehavior          = behaviorAtPoint;
                 this.capturedBehavior.Resized += new EventHandler(this.ResizingBehavior_Resized);
                 this.Capture = true;
             }
             this.canStartDrag = false;
         }
         else
         {
             DraggableLayoutControlItem elementAtPoint = this.ElementTree.GetElementAtPoint(e.Location) as DraggableLayoutControlItem;
             if (elementAtPoint == null)
             {
                 return;
             }
             if (elementAtPoint.AssociatedItem is LayoutControlTabbedGroup)
             {
                 LayoutControlTabbedGroup associatedItem = elementAtPoint.AssociatedItem as LayoutControlTabbedGroup;
                 foreach (LayoutControlTabStripItem controlTabStripItem in (IEnumerable <RadPageViewItem>)associatedItem.TabStrip.Items)
                 {
                     if (controlTabStripItem.ControlBoundingRectangle.Contains(e.Location))
                     {
                         associatedItem.TabStrip.SelectedItem = (RadPageViewItem)controlTabStripItem;
                         this.canStartDrag    = true;
                         this.initialMousePos = e.Location;
                         this.UpdatePreview();
                         return;
                     }
                 }
             }
             this.SelectItem(elementAtPoint, Control.ModifierKeys == Keys.Control);
             this.canStartDrag    = true;
             this.initialMousePos = e.Location;
         }
     }
     else
     {
         if (e.Button != MouseButtons.Right || this.SelectedItems.Count > 1)
         {
             return;
         }
         this.SelectItem(this.ElementTree.GetElementAtPoint(e.Location) as DraggableLayoutControlItem, false);
     }
 }
Exemple #2
0
 protected override void CreateChildElements()
 {
     base.CreateChildElements();
     this.DrawBorder      = false;
     this.ThemeRole       = nameof(LayoutControlContainerElement);
     this.items           = new RadItemOwnerCollection();
     this.items.ItemTypes = new System.Type[2]
     {
         typeof(LayoutControlItem),
         typeof(LayoutControlGroupItem)
     };
     this.items.Owner         = (RadElement)this;
     this.items.ItemsChanged += new ItemChangedDelegate(this.items_ItemsChanged);
     this.tree             = new LayoutTree(this);
     this.resizingBehavior = new LayoutControlResizingBehavior(this);
 }
 protected override void OnMouseUp(MouseEventArgs e)
 {
     base.OnMouseUp(e);
     this.canStartDrag = false;
     this.Capture      = false;
     if (this.capturedBehavior != null)
     {
         this.capturedBehavior.Resized -= new EventHandler(this.ResizingBehavior_Resized);
         this.capturedBehavior.EndResize();
         this.capturedBehavior = (LayoutControlResizingBehavior)null;
     }
     if (e.Button != MouseButtons.Right || !this.owner.AllowHiddenItems)
     {
         return;
     }
     this.contextMenu.ThemeName = this.ThemeName;
     this.contextMenu.Show((Control)this, e.Location);
 }