Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
290
How to make toolbar always on top?
posted

Hello, I have some question.

I create a User Control with one RichTextBox and one ultraToolbarsManager.

I use ultraToolbarsManager to create floating toolbar. (always float, no dock with any)

1. How can I make this toolbar always on top?

2. I also want, when richtextbox have focused this toolbar will show, and when richtextbox lost focus this tollbar will hide.

Please help me!!

Thank you.

  • 290
    posted

    Another question:

    How can I set position for this tollbar if I want it display in top-right of richtextbox?

    Thank you.

  • 290
    Verified Answer
    posted

    I got it,

    Add this code after InitializeComponent

    if (this.richTextBox1.Focused == true)
                    {
                        this.ultraToolbarsManager1.Toolbars[0].Settings.AllowHiding = DefaultableBoolean.False;
                        this.ultraToolbarsManager1.Toolbars[0].DockedPosition = DockedPosition.Floating;
                        this.ultraToolbarsManager1.Toolbars[0].Visible = true;
                    }
                    else
                    {
                        this.ultraToolbarsManager1.Toolbars[0].Settings.AllowHiding = DefaultableBoolean.True;
                        this.ultraToolbarsManager1.Toolbars[0].Visible = false;
                    }

    And use Event: Enter and Leave

     

     private void richTextBox1_Leave(object sender, EventArgs e)
            {
                this.ultraToolbarsManager1.Toolbars[0].Settings.AllowHiding = DefaultableBoolean.True;
                this.ultraToolbarsManager1.Toolbars[0].Visible = false;   
            }

            private void richTextBox1_Enter(object sender, EventArgs e)
            {
                this.ultraToolbarsManager1.Toolbars[0].Settings.AllowHiding = DefaultableBoolean.False;
                this.ultraToolbarsManager1.Toolbars[0].DockedPosition = DockedPosition.Floating;
                this.ultraToolbarsManager1.Toolbars[0].Visible = true;
            }

     

  • 290
    Verified Answer
    posted

    I tried use this, but it dose not work

    private void exRichTextBox_MouseEnter(object sender, EventArgs e)
            {
                ultraToolbarsManager1.HideToolbars = false;        
               
            }

            private void exRichTextBox_MouseLeave(object sender, EventArgs e)
            {
                ultraToolbarsManager1.HideToolbars = true;
            }