RadMarkupEditor scrollbars

2 posts, 0 answers
  1. T
    T avatar
    7 posts
    Member since:
    Jan 2015

    Posted 12 Aug 2015 Link to this post

    Hi,

    By default the Design view of the RadMarkupEditor has no horizontal and vertical scrollbar. By using the following code, I was be able to show the scrollbars:

     

    oDesignView = mEditor.GetType().GetField("designView", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(mEditor) as WebBrowser;

    oDesignView.ScrollBarsEnabled = true;

     

    However, it has a side effect which I find rather annoying.​ See the screenshot in attachment to see the effect. The vertical scrollbar appears next to the "default" scrollbar. For the horizontal scrollbar there is no such problem. Is this a known issue and is there a way to avoid this behavior?

    Thanks,

    Tom

  2. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 13 Aug 2015 Link to this post

    Hi Tom,

    RadMarkupEditor uses the MSHTML renderer for its editor. From the renderer API I found this property: https://msdn.microsoft.com/en-us/library/aa768790(v=vs.85).aspx. Here is how you can set it:
    private void radButton1_Click(object sender, EventArgs e)
    {
        RadMarkupDialog markupDialog = new RadMarkupDialog();
        RadMarkupEditor markupEditor = markupDialog.Editor;
     
        var designView = markupEditor.GetType().GetField("designView", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(markupEditor);
        ((WebBrowser)designView).DocumentCompleted += Form1_DocumentCompleted;
        markupDialog.ShowDialog();
    }
     
    private void Form1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
    {
        var editableElement = sender.GetType().GetProperty("EditableElement", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(sender, null);
        ((mshtml.IHTMLElement)editableElement).style.overflow = "auto";
    }

    I have also tried the "scroll" value, but it didn’t seem to behave properly.

    I hope this helps.

    Regards,
    Stefan
    Telerik

  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top