Floating Window with no-border and RadTitleBar

2 posts, 0 answers
  1. John
    John avatar
    1 posts
    Member since:
    Dec 2012

    Posted 13 Dec 2012 Link to this post

    I'm adding a RadTitleBar to floating windows using the RadDock FloatingWindowCreatedEvent and then removing the floating window border through the FormBorderStyle property. However, everything I have tried so far results in a RadTitleBar that doesn't allow me to drag on it to move the window (although the buttons work correctly). Is it possible to get the RadTitleBar working with floating windows in this way, and if so, how?

  2. Julian Benkov
    Julian Benkov avatar
    1135 posts

    Posted 18 Dec 2012 Link to this post

    Hello Jonh,

    You can use the DragDropService to achieve this functionality. Here is a example with ToolWindows. The second ToolWindow supports drag & drop operations from the content area of window:
    using System;
    using System.Drawing;
    using System.Windows.Forms;
    using Telerik.WinControls.UI.Docking;
    namespace Lab.Dock
        public partial class DockNotFrameFloatingForm : Form
            private RadDock radDock = new RadDock();
            public DockNotFrameFloatingForm()
                radDock.Dock = DockStyle.Fill;
                radDock.Parent = this;
                radDock.FloatingWindowCreated += radDock_FloatingWindowCreated;
            void radDock_FloatingWindowCreated(object sender, FloatingWindowEventArgs e)
                e.Window.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            protected override void OnLoad(EventArgs e)
                ToolWindow tool = new ToolWindow("Tool1");
                radDock.DockWindow(tool, DockPosition.Left);
                tool = new ToolWindow("Tool2");
                tool.MouseMove += tool_MouseMove;
                tool.MouseDown += tool_MouseDown;
                tool.MouseUp += tool_MouseUp;
                radDock.DockWindow(tool, DockPosition.Left);
                tool = new ToolWindow("Tool3");
                radDock.DockWindow(tool, DockPosition.Left);
            void tool_MouseUp(object sender, MouseEventArgs e)
                beginDrag = false;
            private Point captionDragStart;
            private bool beginDrag = false;
            void tool_MouseDown(object sender, MouseEventArgs e)
                captionDragStart = Control.MousePosition;
                beginDrag = true;
            void tool_MouseMove(object sender, MouseEventArgs e)
                if (e.Button == System.Windows.Forms.MouseButtons.Left && ((DockWindow)sender).DockState == DockState.Floating && beginDrag && DockHelper.ShouldBeginDrag(Control.MousePosition, this.captionDragStart))
                    radDock.GetService<DragDropService>().Start(sender, Control.MousePosition);

    I hope this helps.

    All the best,
    Julian Benkov
    the Telerik team
    Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
  3. DevCraft R3 2016 release webinar banner
Back to Top