Page 1 of 1

CefSharp change scroll position and hide scroll

PostPosted: Tue Apr 26, 2016 9:46 am
by bogdanch
How can you change the scroll posițion and how can you hide the scroll bars?

In the default webbrowser in C# i used:
webBrowser1.ScrollBarsEnabled = false;
webBrowser1.Document.Window.ScrollTo(185, 400);

I can't find any equivalent in CefSharp for either of them!

Re: CefSharp change scroll position and hide scroll

PostPosted: Tue Apr 26, 2016 4:51 pm
by amaitland
There is no direct equivalent that I'm aware of, you'd have to execute some javascript to change the scroll position and set some css to disable the scroll bars.

Re: CefSharp change scroll position and hide scroll

PostPosted: Wed Apr 27, 2016 2:34 am
by bogdanch
amaitland wrote:There is no direct equivalent that I'm aware of, you'd have to execute some javascript to change the scroll position and set some css to disable the scroll bars.


How can I do that? I'm new to programming.
If it's any help, here's my code:

Code: Select all
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using CefSharp;
using CefSharp.WinForms;

namespace CefTest
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            Init_Chrome();
        }


        private void Init_Chrome()
        {
            Cef.Initialize();
            ChromiumWebBrowser myBrowser = new ChromiumWebBrowser("http://www.lipsum.com/");
            myBrowser.Dock = System.Windows.Forms.DockStyle.Fill;
            this.Controls.Add(myBrowser);
        }



    }
}


Thanks!

Re: CefSharp change scroll position and hide scroll

PostPosted: Wed Apr 27, 2016 6:47 am
by amaitland
If you installed `CefSharp` through `Nuget` it would have opened https://github.com/cefsharp/CefSharp/bl ... me.txt#L36

Try reading through the `FAQ`, browsing the source, it has examples projects.