Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WinForms Invisible / Not showing #437

Closed
Flaflo opened this issue Sep 14, 2020 · 12 comments
Closed

WinForms Invisible / Not showing #437

Flaflo opened this issue Sep 14, 2020 · 12 comments
Labels
bug Something isn't working

Comments

@Flaflo
Copy link

Flaflo commented Sep 14, 2020

Description
When showing a Windows form with WebView2 as component on it, the form stays invisible and wont show up. It worked last week and without touching the code its now broken. The only thing that was updated is the Edge Chromium version.

Version
SDK: 0.9.579-prerelease / 0.9.628-prerelease
Runtime: Beta 86.0.622.11 / Dev 87.0.634.0
Framework: WinForms
OS: Win10

Repro Steps
Put the WebView component from the toolbox into the form and let the magic happen

It's expected to function as usual and show me the form with the WebView component inside displaying a website.

Screenshots
N / A

Additional context
The WebView is part of a wrapper for a web-app written in Vue. It worked as intended on thursday or friday and since today it stopped working, the only thing that makes sense to me is that Edge's update has broken something WebView was using to render into the form or something like that.

Something interesting: The WebView instance is in fact still running as backgroundprocess behind the main process, so it is clearly started but for some reason stops the form from beeing rendered.

I dont know where else I should put this, thanks in advance for your help.

@Flaflo Flaflo added the bug Something isn't working label Sep 14, 2020
@pagoe-msft
Copy link

pagoe-msft commented Sep 14, 2020

@Flaflo - is this problem both in the 0.9.579 pre-release and the 0.9.628 pre-release packages?

@Flaflo
Copy link
Author

Flaflo commented Sep 14, 2020

@Flaflo - is this problem both in the 0.9.579 pre-release and the 0.9.628 pre-release packages?

Yes

@ukandrewc
Copy link

Did you update WebView2Loader.dll from the package?

@champnic
Copy link
Member

My hunch is that this is caused by this issue: #431. Can you try the fixes mentioned in that thread and see if that works for you?

@Flaflo
Copy link
Author

Flaflo commented Sep 15, 2020

My hunch is that this is caused by this issue: #431. Can you try the fixes mentioned in that thread and see if that works for you?

Yes I tried that first, because when I wanted to compile with the newer preview version I got that exact error. The workaround mentioned in there helped me to fix the compile Issue but I still get the same results after that: The form stays invisible. I am clueless right now.

@cgeier
Copy link

cgeier commented Sep 15, 2020

@Flaflo I've have a few projects that successfully load a WebView2 control using version 0.9.628.

Here's a basic demo project:
WebView2Test_v628.zip

Nothing special, just a WebBrowser2 control on a form with a debugging statement and Source property being set in the "Load" event handler. I recently updated Visual Studio and noticed some weird behavior with the Toolbox for a moment, but that seemed to be resolved by rebooting my computer.

@Flaflo
Copy link
Author

Flaflo commented Sep 15, 2020

Okay, after further investigation it seems like the custom form wrapper we built is the issue's origin. Basically what the wrapper does is to get invisible and create a dummy form for a dropshadow and provide a custom invisible pane for drag and drop.

Maybe you guys here have a better solution to display a webapp with the help of winforms?

@champnic
Copy link
Member

I'm not sure I understand how the wrapper is interacting with the WebView. Can you share some code? Or describe the ownership/tree structure, as well as what may be layered?

@Flaflo
Copy link
Author

Flaflo commented Sep 16, 2020

I'm not sure I understand how the wrapper is interacting with the WebView. Can you share some code? Or describe the ownership/tree structure, as well as what may be layered?

Well the thing is, the "WrapperForm" is a very hacky thing to let the webapp displayed inside it behave like a native window. Maybe there is a better solution than hacking things together via window messages and native calls.

@ukandrewc
Copy link

If you need a borderless form with shadow, just use a form with FormBordeStyle = None and add this:

Protected Overrides ReadOnly Property CreateParams As CreateParams
	Get
		CreateParams = MyBase.CreateParams
		CreateParams.ClassStyle += &H20000
	End Get
End Property

@Flaflo
Copy link
Author

Flaflo commented Sep 16, 2020

Yea thats what ive been up to, but its more than just borderless window with dropshadow.

At the end it turned out that the window state when the form is initialized was "minimized" and for some reason the icon also disappeared from the taskbar. That was the whole issue.

Thank you all guys this case is closed. I did not mean to steal your time :)

@Flaflo Flaflo closed this as completed Sep 16, 2020
@champnic
Copy link
Member

Glad you got it figured out! Thanks @ukandrewc for the follow-up as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants