Creating a Frameless (No Title Bar) Window

Having problems with building or using the CefSharp .NET binding? Ask your CEF-related questions here. Please ask general usage questions on StackOverflow.

Moderator: amaitland

Creating a Frameless (No Title Bar) Window

Postby ingrown » Sun Oct 18, 2020 5:31 pm

Hello,

I'm having trouble making a frameless/ window with no title bar. Digging around the forums I tried returning false in cef_window_delegate.h's IsFrameless and I tried launching the demo program with: cefclient.exe --use-views --hide-frame --hide-controls, both to no avail.

Any help would be greatly appreciated. :)
ingrown
Newbie
 
Posts: 2
Joined: Sun Oct 18, 2020 5:23 pm

Re: Creating a Frameless (No Title Bar) Window

Postby magreenblatt » Mon Oct 19, 2020 10:39 am

What OS and CEF version?
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Creating a Frameless (No Title Bar) Window

Postby ingrown » Mon Oct 19, 2020 7:47 pm

Thank you for your response!
I'm using CEF 86.0.17 from Spotify's automated build. I've only tried on Windows so far but digging through the forums shows CEF's Views can accomplish Windows and Linux with the same code.
ingrown
Newbie
 
Posts: 2
Joined: Sun Oct 18, 2020 5:23 pm

Re: Creating a Frameless (No Title Bar) Window

Postby tech5678 » Mon Nov 02, 2020 4:16 pm

I just did a quick test in VB.NET, Visual Studio 2017 and it worked perfect, if I'm understanding your intention. Should work identical in C# targeting .NET Framework, but I dunno about Core, WPF or anything else. All I did was:

1. In my original browser app, add a new form ("Form2")
2. Change the form's FormBorderStyle to None
3. Put a panel in it ("panBrowser")
4. Set panel Dock to Fill.
5. Make a tiny code tweak in my original code, calling Form2 instead of the original Form1:

Code: Select all
Imports CefSharp.WinForms
Imports CefSharp
Imports System.IO

Module CEFbrowser

    Public WithEvents browser As ChromiumWebBrowser
    Public CEFPath As String = ""
    Dim settings As New CefSettings()

    Sub LoadCEFBrowser()
        CEFPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\MyBrowserTemp"

        If Not Directory.Exists(CEFPath) Then
            Try
                Directory.CreateDirectory(CEFPath)
            Catch ex As Exception
                MsgBox("Error creating cache directory" + vbCrLf + CEFPath,, "Error")
            End Try
        End If

        settings.CachePath = CEFPath

        'CefSharpSettings.Proxy = new ProxyOptions(ip: "myipaddress", port: "myport", username: "myusername", password: "mypassword")

        browser = New ChromiumWebBrowser("")

        Dim requestContextSettings As New RequestContextSettings()
        requestContextSettings.CachePath = CEFPath
        requestContextSettings.PersistSessionCookies = True

        browser.RequestContext = New RequestContext(requestContextSettings)

        browser.Dock = DockStyle.Fill
        If CefSharp.Cef.IsInitialized = False Then
            CefSharp.Cef.Initialize(settings)
        End If

        Form2.panBrowser.Controls.Add(browser)
        Form2.Show()

    End Sub


Note that due to eliminating the title bar, you'll have to add extra mechanisms to allow the window to be moved etc.
tech5678
Techie
 
Posts: 10
Joined: Fri Aug 14, 2020 11:01 am


Return to CefSharp Forum

Who is online

Users browsing this forum: No registered users and 16 guests