Why does my WPF application font look different on my PC? - c#

My WPF application's font suddenly looks different on my PC. I am not sure if this occur after a windows update. I am using Windows 10 Version 1803, .Net 4.5 in one application and .Net 4.6.1 in the other. This is happening on my 2 WPF applications.
Here is a picture of my WPF application on other PCs (Acceptable):
https://ibb.co/444D8X5
Here is a picture of same WPF application on my PC (Unacceptable):
https://ibb.co/mvVHT9s
Any clue why this is happening? Looks like the characters moved a couple pixels down. Thanks in advance.

So the reason your font doesn't appear at runtime is because it is not actually installed on your machine. Windows doesn't know where to find it so it goes to a default font. You should embed the font within the application.
See this post

Related

WinForms C# app in Linux with Mono: Ends of labels are cut off (Autosizing issue?)

Using a simple WinForms C# app as a test (just a form with some labels in it), compiled in Visual Studio on my Windows PC and then copied over to Linux to test out Mono. Using .NET 4.0
When I view the app on my RaspberryPi (Raspbian with Pixel desktop) with Mono, all functionality is fine (no errors or anything), but the ends of the labels are all cut off.
Example: For the label "This is a test," which looks fine on Windows, I only see "This is a" when run on the RasPi with Mono.
If I change the label's autosize property to false and manually make the label wider, then it works as expected - but that's a hassle for future development. I have tried changing the fonts to monospace font, but that didn't seem to have any effect.
Is this a known issue with Mono? Is there a way to make the autosizing work correctly without having to manually adjust all of the labels to fixed widths?
Thanks
Don't use a Windows font, use a Linux one, your app is probably confused by the Linux system substituting a different font to the one available on Windows.
Font substitution is widespread on Linux, and all substitutions do not use the same metrics.

Change Windows 8.1 lock screen image via WPF application

I'm trying to change Windows 8.1 (desktop) lock screen image from WPF application.
I've found solution with Windows SDK approach, but it uses runtime application as example (actually, all information I've found was regarding to WinRT apps). But I don't want to use WinRT - all I want is to use LockScreen class in plain old WPF.
After all I have managed to do this in the WPF app several times. This included:
1) manually adding <TargetPlatformVersion/>8.1</TargetPlatformVersion> into .csproj as suggested here;
2) adding references to Windows and System.Runtime.WindowsRuntime as suggested ibid;
3) following these steps to change lock screen background
Then I've faced the problem with platform - application does what it should only with x64 platform (not anyCPU). And not each time (I could not determine consistency yet).
Any way I think that I am over-complicating the solution. Does anyone have other suggestions? Is there any other simpler/cleaner way to change Windows 8.1 lock screen image via WPF application?

My program's GUI is messed up in Windows 8

I have created a wallpaper changing program in C# using Visual Studio and I have had a couple reports in this last few months of part of the program not displaying right. I have no clue what is causing it. Any help?
This is what it looks like on my computer, Windows 7
This is what it looks like on the victims computer, Windows 8
If this is a windows Forms application, it could have something to do with DPI/resolution scaling. This isn't unique to Windows 8.
Check the Display sizing options match on both displays (or simply change on your Windows 7 Machine) in Control Panel.
Control Panel\Appearance and Personalization\Display for Windows 8. (I think it is the same for Windows 7).
See C# WinForms disable DPI scaling
or
How to write WinForms code that auto-scales to system font and dpi settings?

Windows Embedded wpf application

I have build a WPF media player application in c# .Net 4.0. I would like to take this WPF application and put it on a Windows Embedded operating system. This would take out all the things I don't need and just make a simple power on and my application loads. I know there will be a lot of work in order to make this happen and I'm just wondering if someone can point me to a good starting location. I've looked around a lot but haven't found a good tutorial on how to go about doing this or what version of windows embedded I would need etc. Any help would be greatly appreciated.
Thanks!
if you are using Windows Embedded 8, it's basically full windows with lockdown features, thus any application that can run on normal windows will be able to run on it

C# - Layout problem on Windows XP professional

I am developing a C# application with .NET Framework 2.0.
The problem is, that on my client's PC, the controls get expanded, layout changes (positions of the controls gets changed), sometimes buttons get missed entirely. It happens even on Forms with 2-3 TextBoxes, 2-3 Buttons and some Labels. I tried a lot of investigations. I tried to show a message in the form's resize event. But it doesn't get called. After digging a bit more, it seemed that in Designer.cs file even though ResumeLayout (false) is being called for the form, but this causes the the expansion/disposition of the controls.
My Client is using Windows XP professional on his Dell laptop. He is able to reproduce the issue on other laptops with Windows XP professional. But not in other OSes (like Windows XP Home or Windows Vista). In my desktop with Windows XP professional, it is not reproducible.
How can this issue be resolved?
Are you sure it has anything to do with the OS? It sounds more like a dpi issue. 'Normal' is 96 dpi. If the form was designed at 96 dpi, it would probably look different at a different setting.
See this article for how to check/change the dpi settings in XP.
Edit: I forgot to mention that you can use the TableLayoutPanel Control to layout your form. Using the auto-sizing capabilities will help keep things looking 'normal' at any dpi setting.
It's probably due to the DPI setting in Windows XP.
If you're using the standard (96) DPI setting, but they're setup using a alternative one (ie: 120), it often will mess up layouts of controls.
The "right" way to handle this is to try to automatically build your layouts using layout elements that can resize as needed. This is difficult in Windows Forms (and one of the things WPF fixes).

Categories

Resources