Click here to Skip to main content
15,917,059 members

Comments by Member 14884389 (Top 6 by date)

Member 14884389 15-Aug-20 16:17pm View    
I have a programm that uses a webbrowser (which fills the entire window) to create an explorer like interface. https://tablacus.github.io/explorer_en.html
I'm trying to replace the old looking console grey background with an extendaero background like in windows 7 explorer https://i.computer-bild.de/imgs/5/9/9/1/7/8/5/Windows-7-und-8-Das-hilft-wenn-sich-Fenster-langsam-oeffnen-Manchmal-startet-1024x576-b8e06cd96cb52467.jpg
and my problem is that i'm unabled to make the mentioned part of the browser background invisable to make room for the extend aero part that lies underneath the browser.
Member 14884389 14-Aug-20 5:31am View    
it has nothing to do with vb this can also be done in c++ forms
Member 14884389 12-Aug-20 14:18pm View    
https://www.bilder-upload.eu/bild-e3d635-1597256412.png.html
https://www.bilder-upload.eu/bild-51bd12-1597256437.png.html
code:
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Runtime.InteropServices

Public Class Form1



Private mExtendedFrameMargins As MARGINS

Protected Overrides Sub _
OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias
'use either one
e.Graphics.SmoothingMode = SmoothingMode.HighQuality
End Sub

Private Sub Form1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
If IsGlassEnabled() Then
'You should paint the extended frame black for proper composition, but I'm painting it white as you need it
e.Graphics.FillRectangle(Brushes.Black, 0, 0, Me.ClientRectangle.Width, mExtendedFrameMargins.cyTopHeight)
End If
End Sub

Private Function IsGlassEnabled() As Boolean
If Environment.OSVersion.Version.Major < 6 Then
Return False
End If

Dim isGlassSupported As Boolean = False
DwmIsCompositionEnabled(isGlassSupported)
Return isGlassSupported
End Function

<dllimport("dwmapi.dll")>
Private Shared Function DwmIsCompositionEnabled(<marshalas(unmanagedtype.bool)> ByRef pfEnabled As Boolean) As Integer
End Function

<dllimport("dwmapi.dll")>
Private Shared Function DwmExtendFrameIntoClientArea(ByVal hwnd As IntPtr, ByRef pMarInset As MARGINS) As Integer
End Function


<structlayout(layoutkind.sequential)>
Private Structure MARGINS
Public cxLeftWidth As Integer
Public cxRightWidth As Integer
Public cyTopHeight As Integer
Public cyBottomHeight As Integer
End Structure



Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
WebBrowser1.DocumentText = ""

If IsGlassEnabled() Then
mExtendedFrameMargins = New MARGINS
mExtendedFrameMargins.cyTopHeight = Me.Height 'type height here, this is going to be a number (integer)
DwmExtendFrameIntoClientArea(Me.Handle, mExtendedFrameMargins)
End If
End Sub

Private Sub Form1_SizeChanged(sender As Object, e As EventArgs) Handles Me.SizeChanged
If IsGlassEnabled() Then
mExtendedFrameMargins = New MARGINS
mExtendedFrameMargins.cyTopHeight = Me.Height 'type height here, this is going to be a number (integer)
DwmExtendFrameIntoClientArea(Me.Handle, mExtendedFrameMargins)
End If
End Sub
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted

WebBrowser1.Document.BackColor = Color.FromArgb(1, 255, 0, 0)

If IsGlassEnabled() Then
mExtendedFrameMargins = New MARGINS
mExtendedFrameMargins.cyTopHeight = Me.Height 'type height here, this is going to be a number (integer)
DwmExtendFrameIntoClientArea(Me.Handle, mExtendedFrameMargins)
End If
End Sub



' Private Sub WebBrowser1_DocumentCompleted(sender As Object, e As WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
' WebBrowser1.Document.BackColor = Color.Black

' End Sub
End Class
What you can see inside the red box is a Webbrowser with document color red and the transparency key of th form is set to red so it will trigger the extendaero api in this webbrowser where no alpha value is given. I'm trying to achive the same result in a c++ non form application but i couldn't find anything like the Transparency key in c++. The goal is to make th webbrowser control invisible
Member 14884389 10-Aug-20 15:33pm View    
I'm trying to get parts of the webbrowser compleatly see-through so i can use the extend title feature to make it look like the title bar is part of the webbrowser
Member 14884389 10-Aug-20 10:28am View    
I think you don't quite get what I'm trying to do. That way only the html document gets transparent and not the browser itself (it's still white background even with alpha 0). Im searching for some type of C++ alternative to the Transparencykey from C++ Forms. The question isn't how to make the html document transparent it's how to make a browser transparent (which to my knowledge is impossible) or find a way around the webbrowser to show the window background which is an extended title bar like the code above shows. I already tested (in C++ Forms) that rgba(255, 0, 0, 1) html parts are showing the window background when the Transparencykey is rgba(255, 0, 0, 1).
Here is what i'm trying to do done in Forms https://stackoverflow.com/questions/20141220/how-can-i-set-a-transparent-background-colour-for-a-webbrowser-in-vb-net