I'm working on a simple WPF-based screensaver and can't get the thumbnail preview to work.
When you open the display control panel and go to configure the screensaver, the selected screensaver is supposed to display a thumbnail preview within the dialog:
I've found several good examples online of how to do this, including:
Writing a screen saver in WPF
WPF Screensaver (Codeplex)
CC Hearts Screen Saver
Following these examples, I couldn't get anything to work - the preview thumbnail turns black, but nothing else appears. Downloading each of these (and a few others) and running them had the same result - a blank preview thumbnail. I've done this before on Windows 7 and it wasn't hard, so I was a bit frustrated.
Copying the binaries across to a Windows XP machine, I found that each of them showed a preview thumbnail successfully.
So, there's something that's changed between Windows 7 and Windows 8.
What do I need to do differently to enable my WPF screensaver to properly display a thumbnail preview on Windows 8?
I've found the most common problems with moving code from Win 8 to Xp is permission and dependencies. Check that the files are not needing some weird permissions (not sure what permission the preview runs with) and that all dependencies are honoured (also their permissions).
If I remember right, all windows screen savers are just renamed exe files with command line arguments. Maybe try rename it and run it directly?
Check what version of the framework you are using and try to use the client profile if possible
Also Try this small workaround if helps:
In Windows Explorer Go to > Options > Change folder and search
options then click on the View tab and uncheck the box that
says Always show icons, never thumbnails.
I hope it should work.
Related
We have a Windows Forms application used for testing our products that has had pretty much the same forms and dialogs for nearly 10 years now. AutoScaleMode in the designer is set to Font for both forms, and that hasn't changed since the original design. AutoSize is set to false and just for good measure (I guess) AutoSizeMode is set to GrowOnly. The following source lines are in Program.cs:
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Remember, this has been working flawlessly for years...
One of the recent updates to VS2017 included AutoScale support for monitors with different DPI. I have a relatively high DPI monitor, so when I made some changes to a Settings dialog (adding controls, etc) I started getting bright yellow banners cross the top of the designer surface telling me that AutoScaling was set to 125%, and would I like to change that? I tried going back and forth, and when in 100% mode (Autoscaling off) I was warned that XAML forms might not display correctly. Fine, I am working with Forms so I went back to "normal" scaling and the form looked fine.
Until I tried running the program. Now when I start the program the main form looks like this (details deleted to protect the guilty):
...but when I open the settings dialog it looks like this:
Yikes! It looks worse in practice, the relative images here don't do justice to the difference in size and scale.
I have no idea what got changed or how / why this is happening, but there's no way I can put this into production. I've tried changing the AutoScale settings, to no avail. Can somebody point me in the right direction here?
Thanks in advance!
EDIT: It seems the rescaling only happens on my machine when I run the app in Debug. Whatever is messing up the display of the forms on my machine doesn't do that on my associates' machines and isn't replicated to the executable produced by the build server.
On another note, I tried every DPI-related setting I could find, added those that weren't there due to the program's age, all to no avail. Nothing I have tried has had any effect on the program's display weirdness on my machine. Ugh.
I tried all the tricks I could find, short of disabling AutoScale completely, and nothing worked. I finally merged our develop branch in to my feature branch and inspected all 270 edits, choosing the oldest settings I could find for all size parameters, all controls. Ugh.
Along the way I stumbled across the following line in the Designer.cs file for the form:
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
This setting is NOT accessible from Visual Studio's designer, as far as I can tell, nor can I find anything about how or why it gets set. What I did find was that in the earlier version that did work as expected, the values were (8F, 17F) -- so I manually edited the line to match the older, working version. Success!
I also checked my Windows display settings, and the Custom Scaling value was at 100%, so I used the registry hack mentioned in one of the articles I found following the first link from the comment above (thanks, #Jimi) to disable auto-scaling in Visual Studio, then turned off the notification. Now I'm (finally) back in business.
Registry hack is here:
https://learn.microsoft.com/en-us/dotnet/framework/winforms/disable-dpi-awareness-visual-studio
If one uses the registry hack mentioned in the answer from DaveN59, and there is already entry for your ...\devenv.exe (mine was previously set to run as admin) then add the DPIUNAWARE string to the end of the "Data". Make sure to use a space as a separator.
Example: ^ RUNASADMIN DPIUNAWARE
I'm not sure what the ^ is for, but it was there and I just added DPIUNAWARE string. Also, if you just add this string, it will come up unscaled, but you will still see the yellow banner. To turn that off you'll need to select that option from with in Visual Studio. The instructions are in the link for the registry hack, also provided above. For conveinece here's the menu navigation path.
To disable notifications, choose Tools > Options to open the Options
dialog. Then, choose Windows Forms Designer > General, and set DPI
Scaling Notifications to False.
I'm building a simple Winforms application that deploys via msi (Visual Studio setip project). The msi creates a shortcut on the users desktop and the start menu.
Everywhere (desktop, start menu, taskbar when program is running, .exe file) the program icon is displayed correctly.
But not when I type the program name in the start menu search (see screenshot below). There some generic icon is displayed.
I quadruple-checked the icon set in Visual Studio > Winforms Project > Properties > Application and the icon for the shortcut set via the Visual Studio setup project. The .ico file has many different resolutions embedded, up to 512x512px. Since it's working fine everywhere else (except in the search) I can't think of anything als I could try.
Hans' comment was the solution for me. It seems that Windows caches the old/wrong icon. When I tried it on a clean Windows 10, it worked immediately.
Of course, I tried to clear the icon caches according to Application icon is blank when started from Process.Start or the script at http://www.winhelponline.com/blog/how-to-rebuild-the-icon-cache-in-windows but this did not work on my machine (even with a lot of restarts and killing of explorer.exe).
OK, so I have built a Windows Form application. I now want an icon for it. So I use the Icon Editor built into Visual Studio 2012. Draw it all out to look nice and purdy. Once I am done, I have a .ico file and I make it the default icon for the project, and also the icon for the one WinForm in the application.
Unfortunately, it does not show up as I have created it! It is displayed as the default icon file as it existed before I modified it in the icon editor. It's a 32x32 4 bit icon. If I change the extension to .bmp it shows up as the default.
It looks like the VS icon editor is editing something else, not the appearance of the icon. Can someone tell me what I am doing wrong?
I used to have a progam called IconArt that would create icons that looked like icons when I used them in VS. IconArt is now abandonware and won't run on my 64bit Windows workstation.
Since I didn't get any answers within the time I was hoping, I posted this question also in the MSDN Visual Studio forum, and got a good answer that I thought I should post here. Credit to Reed Copsey, Jr, for the answer!
This is it:
You'll need to put your design in all of the different versions. ICO
files contain multiple versions of the same image, for different
screen resolutions.
My personal preference is to not use VS - there's an ICO plugin for
Paint.Net (all free) which allows you to make a single image
(typically 256x256), and save multiple versions within an ICO file in
one shot. It's very useful for building icons.
See
http://forums.getpaint.net/index.php?/topic/927-icon-cursor-and-animated-cursor-format-v37-may-2010/
for the plugin.
Since I am a Paint.Net user, the plugin sounded like a great idea, and I tried it. Bingo! This works very nicely.
I have a WPF application which runs fine on Windows 7 OS. But the same app crashes on a particular few Windows XP machines.
It runs fine on few windows XP machine. but on a few XP machine it fails to start.
ERROR - Image format is unrecognized.
I know this question has been asked few times. but my problem is i am still not able to figure out as to how to resolve this.
Should I change the .ico used for the application ..
Unfortunately, simply removing the 256x256 application isn't the greatest solution when you want to support the large icon size for Windows Vista, 7, 8 and forward.
Another way to solve this problem ... is to not compress the 256x256 image in the icon. See this forum thread for more info.
How does one do that? Well, most icon utilities will have an option for this (as this is a common problem). I use IcoFX and below you can see the option (highlighted in red) I needed to clear.
I've had a bit of fun with this problem this morning. It turned out that the error was occurring only on XP machines where the colour settings were set to 16 bit, and when I changed it to 32-bit the problem magically disappeared.
This goes for XP (including Embedded) SP3.
In your WPF application you will have at least two places to set icons:
The application icon. This is used for displaying the application in Explorer, desktop, etc. You set this in the project properties.
The window icon. This is used as icon in the upper-left corner of the window, and perhaps for alt-tabbing and on the taskbar. You set this as the Icon property on the window.
Often, you may use the same icon file in both cases. However, if you have a compressed 256x256 icon as window icon, then this can crash in Windows XP. This is what you are experiencing. On the other hand, this not the case when the application icon has a compressed 256x256 icon.
So another solution (which I implemented in all my projects) is to have two icons: The application icon (which contains all sizes) and a special "window icon" version, which only contains the sizes 16x16 and 32x32 (since those are the only sizes which are used).
If I remember correctly Windows XP does not support icons larger than 48x48 pixels and this could be the reason for the crash. .ico files should definitely run on both systems.
You can create an icon that support multiple sizes, so if you add 48x48 and for example 256x256 in the same file you should be good. Also be sure to use select a good software to produce the icon when making icons that support multiple sized. I've used Greenfish Icon Editor which I think works fine. But there are multitudes of other products for this.
Be sure to read The ICON handbook, section Windows, it contains good info about what icon sizes and bit depths to use.
Other threads on SO supports my belief:
problems with icon image
Which icon sizes should my Windows application's icon include?
Another workaround to (16/32bit resolution problem) is not to define icon in XAML, but load it in code:
this.Icon = new BitmapImage(new Uri("pack://application:,,,/UserInterface;component/Resources/Icons/ReportViewer.ico"));
This has happened repeatedly on various machines in VS2008 and Visual C# 2008.
I create an XBAP appliation.
I click the green arrow and it works.
I click Build/Publish and publish it to either a website or folder, it works.
I make some changes, publish again, and I just get a white screen. Both browsers, can restart, always blank.
It seems to be some kind of caching, etc. Has anyone had this happen to them and found a workaround?
Is the version number incrementing? Right click on the xbap project, go to properties/publish tab, increase the version number and republish.
You can clear the application store using mage -cc command from VS command prompt. Check out this post for more info.