This is a migrated thread and some comments may be shown as answers.

RadMarkupEditor scrollbars

1 Answer 54 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
T
Top achievements
Rank 1
T asked on 12 Aug 2015, 12:53 PM

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

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 13 Aug 2015, 09:28 AM
Hi Tom,

RadMarkupEditor uses the MSHTML renderer for its editor. From the renderer 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

Tags
General Discussions
Asked by
T
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or