CefSharp. When minimize windows form get grey content - c#

I read about CefSharp and it is really great but there is one problem. I want to use CefSharp with windows forms and it runs. When i minimize the windows and then open it again the content is missing. However, when I resized the embedded browser window, the page appeared. Just as it should.
Some pictures:
Before minimize
After minimize
I use CefSharp directly from GitHub, can you help me to solve this problem. I will be very thankful if you help me.

That's clearly a bug! (And I just reproduced it on Win7 when I don't maximize the window)
I just happened to see http://www.hjerpbakk.com/blog/2014/10/5/windows-forms-cefsharp-grey-content yesterday
Does adding Size = Size, to the BrowserForm constructor fix it for you?
Like this:
browser = new ChromiumWebBrowser(CefExample.DefaultUrl)
{
Dock = DockStyle.Fill,
Size = Size,
};
Update: Naah forget it that doesn't fix the issue it seems. Please report it as a bug to the CefSharp project so it can be fixed (After all StackOverflow isn't a bug tracker)
Update2: It might be related to problems with EGL. It looks like a workaround is to remove or rename the libEGL.dll in the bin folder. Note a rebuild of the CefSharp.Example.WinForms app will copy it there again!
Update3: With CefSharp v33.0.2 this should be fixed.

Related

Font rendering issue when running app from taskbar

I've researched this a bit and can't seem to find an answer. A few articles here on SO also go unanswered or provide answers that don't seem to work so I'm running out of luck and hoping someone can help.
I've got a WinForms project, coded in VB.Net, using .Net Framework 4.6.2.
I wanted to the app to load in the system tray, and when clicked the actual form comes up. I got this to work using feedback from another article which implies creating a separate Module, include a Sub Main() declaration, load the Notification item in there and when system tray icon is clicked then load the main form.
To do this, I had to go to my project settings, select the "Sub Main" as the startup object, and un-check the "Enable application framework" box.
Everything works as it's supposed to, the notification icon is loaded in the taskbar, and when clicked my form opens up.
Here's the issue, when my buttons are rendered they look way different than when I setup the project to run the form instead of the windowless module. Example:
Buttons should look like:
But look like:
A few articles pointed to enabling the following options in my main module:
Application.EnableVisualStyles()
Application.SetCompatibleTextRenderingDefault(True)
Application.DoEvents()
This fixed the way my ListViews were rendering, but not the text. As you can see in the images, the top one is much more smooth and well-spaced than the bottom which looks bolder and misaligned.
I've tried changing the form's AutoScaleMode settings, AutoSize, and nothing works.
Any idea on how to fix this?
Setting the default font of the form worked, as #Çöđěxěŕ recommended.

How can I make Visual Studio use my updated icon for my NotifyIcon?

I am totally stumped by this issue and I do not know what to do.
I have created a simple C# Windows Form application using Visual Studio 2012 Premium. I have a small program that starts up and creates a NotifyIcon in the system tray. On click of the tray icon, a context menu is displayed and it shows a few menu options (Options, About, etc.), where each option displays a form. I have added two icon files (.ico) via the Resources by right clicking on my Project item, Properties, Resources. I programmatically change the Icon of my NotifyIcon, alternating between the two different icons. My problem is that my old icons keep displaying, instead of my new ones that I've added to the project. To be clear, my issue is that OLD icons keep displaying--everything is working and there are no errors, it just doesn't show my latest icons.
The way I'm changing the icons in code is using:
notifyIcon.Icon = Resources.IconA03312014; //or the other one; the numbers are the date
I initially made my icons and used those and later decided to change them a little bit--I changed some colors, etc. So then I removed the old icons from my project by clicking the Exclude from Project option. Then I added my new icons, which had different names. Then I updated my two code references that load the icons to use the new names. No matter what I do, my new/updated icons are not displayed!
Whether I run the program in Visual Studio in Debug or Release mode, it does not matter. I can clean the solution, rebuild, and then run the executable directly by clicking on it in Windows, and no difference. Old icons are shown.
I have followed different sets of instructions online that explain how to clear the Windows 8 icon cache (three different methods). I have cleared the cached Notification tray icons as well, using two different methods.
Basically, I cleaned my solution and then closed Visual Studio. I kill all explorer processes, run ie4uinit.exe -ClearIconCache from the command line and delete the IconCache.db file. Then I delete the notification icon cache by editing the registry following instructions similar to these (http://www.sevenforums.com/tutorials/13102-notification-area-icons-reset.html). Then I shutdown the computer. Upon starting backup and rebuilding my solution and running, the old icons are still there somehow. The physical .ico files for the old icons were deleted long ago. Each time I've added new icons to my Resources, I've created new icon files from scratch (using icobundl.exe) and named them uniquely by including the date in the name. I am aware that Windows, and apparently Visual Studio also, like to cache icons and if you delete some icon file A.ico in Windows and then rename another icon file B.ico to A.ico, the B.ico file's actual icon will change to A's. Anyway, I don't the name of the icon file is the issue.
Now, in code, if I use the same strategy and set one of my form's icons, it works correctly and the form displays my latest icon, while my notify icon still shows the old (and now nonexistent, except in Visual Studio la la land) icon.
So, I have:
...
if(firstState){
notifyIcon.Icon = Resources.IconA03312014;
optionsForm.Icon = Resources.IconA03312014;
}
else{
notifyIcon.Icon = Resources.IconB03312014;
optionsForm.Icon = Resources.IconB03312014;
}
firstState = !firstState;
...
There are no errors and both the notifyIcon and optionsForm's changes, but the notify icon displays my OLD icon that no longer exists anywhere (except somewhere/somehow in VS). The form's icon changes to my updated/latest icon.
If I copy my app's .exe file to another computer and run it, it too displays the old icons for the notify icon, so the old icons are somehow still embedded in my exe generated by Visual Studio. If I just directly load the .ico file, instead of referencing my project resources, the new icons ARE shown. This have to be some sort of strange Resources caching issue in Visual Studio?
Can anyone please help me with this issue? I just don't understand how my old icons are still existing somewhere, and how Visual Studio somehow knows how to switch them! That's right, the above icon swapout works perfectly for the form. But for the notifyIcon, the icon does switch from "A" to "B", but it uses the old A icon and the old B icon--icons that do not exist anywhere anymore!
I hope I have explained my issue. I greatly appreciate any help that anyone can provide.
I had this same problem a few months ago and it drove me crazy for a couple of hours. I was so focused on clearing on the icon cache and thinking that it was just some sort of caching issue that it didn't immediately occur to me what the real problem was.
The answer, for me at least: Even though you have a 16x16 version of your image in your .ico file, Visual Studio will instead use the 32x32 image and scale it down to 16x16, causing it to look distorted. I say VS did it because when I ran the executable on other machines (different Windows OS's), I saw the same behavior so it wasn't a Windows 8 issue, for me. (It might very well be a Windows issue in general though, I don't know. I did not take the time to verify what was actually inside of the generated .exe--did it contain MY 16x16 version, or 16x16 version generated by scaling down my 32px version? That would have confirmed it, I guess...)
My "aha" moment came when I added a few rows of red pixels to each size of my icon image, in a different section of my icon. So I put the red rows in my 16x16 at the bottom. My 32x32 had the red rows in the center, etc. So then I added this .ico to my project and started the project up and BAM, there was a distorted version of my 32x32 icon being used in the system tray as my notify icon. There was no doubt about it.
If you notice that your notify icon (at 16x16) looks more distorted than you would expect, you might use a similar strategy to see if this same automatic scaling is happening. When I figured this out, my quick solution was to add a .ico to my project that contained ONLY the 16x16 version of my icon image. I then use that resource image only for my notify icon. Obviously, if you did this (have a 16x16 only image) for forms, for example, you would see a very distorted icon in your taskbar, Alt-Tab list, etc., because Windows has no choice in that situation but to create the different icon image sizes by scaling your 16x16 because that's all that you supplied. Anyway, in my particular case, as I believe is yours as well, there was no issue using the .ico for forms--they show the actual embedded 16x16 version of the image and there is no "automatic downsizing" of the 32px version.
That's all I know. I did not spend anymore time on this issue because I had to move on. I hope this helps someone avoid some icon frustration. Why, oh why, VS would you do this to us!?
i had the same problem with a splash screen.
some how it did not change after replacing the picture.
what i did is i remove the images then save the form.
run the app and there was no image.
then i replaced them and the problem was fixed for me.
so maybe you can try the same with you're icons.
hope it will fix you're problem .
Open the file Resources.resx of your project with the editor. There you have to change name="Icon1" into name="YourIconName".

WebBrowser Control not showing PDF anymore

Googled really much on this issue, but didnt find any related problems.
I wrote a Browser with WinForms and the webbrowser control and since a week ago the Browser is showing a little Icon on the top left corner with an "x" in it instead of PDF File on every Website.
Dont know why, cause it worked fine for a couple of months.
Also tried to change back to the IE9 Engine by setting the registry entries, cause i thought about some IE Updates. But didnt work.
Any suggestions?
Found the source of the problem. The trick is to build a x86 application. If you set any cpu or x64 platform in your build settings, this little box with the "x" will show up when you try to view PDFs.
But really dont know why this happens and why he can find addons from IE in the webbrowser control, cause i didnt use any one of them in my code and im also not using any dlls for this. And why IE is showing PDFs without Addons activated.
But its working again now.

How can I close, restore or minimize DXRibbonWindow when it is maximized?

I'm using the DevExpress libraries (version 12.1) in a WPF project. I need to create a DXRibbonWindow to obtain a RibbonBar alike to the Excel one, on the top with quick access tool bar.
So, the problem is that I can close, restore or minimize this window when it is maximized. These buttons work right when the window is not maximized.
The following code is my .xaml file:
<dxr:DXRibbonWindow IsAeroMode="True" WindowState="Maximized" ... />
I need to manipulate this window normally. How to solve this problem?
As far as I can see from DXSearch this issue have been already reported to DevExpress. Current issue status is Fixed in version 12.1.8. So, you are welcome to update your version to that one.

Incorrect icon size when imported to exe

EDIT: Solved, (at least for the explorer) the problem was it keeps the old thumbs.db.
I have a png icon and I've created a 128px, 96px, 64px, 32px, 16px icon using several tools. But the result is always the same.. when I compile the exe using that icon and resize to max icon size, it stays to something like 32-48px. Anyone got the same issue? Also when I put the executable on RocketDock, it also gets small icon. The executable has all icons, I checked it with Resource Hacker. It's a strange issue, I just wanted to make my app with big icon so it can be used in dock applications and on users that use bigger icon sizes.
Here's an example of what I'm talking about. The Visual Studio icon is there just for test.
And also a RocketDock screenshot containing a shortcut to the icon and to the executable:
I've used Axialis Icon Workshop successfully before, and it's even recommended in this MSDN article. Not free but the trial version should be enough for one-off shots. I'm not perfectly sure it will solve your problem but it should.

Categories

Resources