ListView displays incorrect title - c#

I am doing some tests with different characters in the title of a listview.
for some reason the exact same app displays fine on win8 but it doesnt show a check mark in winxp.. how do I fix this on .Net Framework v4?

It is a font problem, you get the rectangle when the machine doesn't have a substitute font with the check-mark glyph, U+2713.
XP did ship with very limited fonts, so this is not entirely unexpected. Run Charmap.exe on that machine so see the glyphs that are available. Ask as superuser.com for the best way to get the machine updated.

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.

Font Selection for Form Application

I am bit confused about chosing font for my winform application.
I want to chose a font which will go smoothly on Win7/XP/Vista. My application has been designed with windows Office2007 like bluish theme, and also has future requirement about provision for selecting other standard themes.
Currently all my user controls/forms and all other controls have arial fond. But it doesn;t look cool.
Can anybody know any good tricks/tips to chose a smart font for winapp?
Or are there any guidelines to check for cool fonts for your apps?
Please suggest.
Thanks in advance,
Kapil
There's a bug in Winforms [2008] where the default system font is not used. See this question and this post for more info, but the trick is to set the default app font to SystemFonts.MessageBoxFont which will give the correct system font. Make all your forms and controls inherit this, and the app will use the system font.
Use the system default. In Windows Vista and 7 that would be Segoe UI. It makes your app look consistent in the rest of the OS; otherwise, it will just stand out, and not always in a good way.

WPF Windows program displays in large fonts but only on one PC

I have a WPF application rendering fonts to a larger size than I expect.
The catch is that only WPF applications I write seem to have this effect, and the problem happens only on one computer. The effect also happens with all WPF programs I write (not just one), and all windows exhit the effect.
I am using Visual Studio 2008 with .NET 3.5 SP1; all programs written in WPF.
The operating system is Windows XP with the latest service packs.
The screen resolution is 1680x1050.
Windows and buttons using Windows XP style.
Font size is Normal.
DPI setting is normal size (96 dpi).
I tested my applications on a two other computers with same OS and settings and it looks fine. My programs run on dozens of other computers and I do not see this problem.
Here is a window that looks good:
Here is a window that shows the problem (notice the button on the lower left, and the font size):
I know I can increase the width and add margin to compensate, but I need to understand why this happening.
I am close to a release and I want to make sure my users do not see this effect.
All ideas appreciated.
I'm not running XP right now, but I thought you could customize the size of the text that appears in window captions (and buttons) via the Display Properties (right-click desktop, select Properties, and it's the 3rd or 4th tab, I think). It lets you select colors for selected items, background colors of windows, etc.
That would be separate from setting the DPI settings.
This looks like an unholy XP feature. It had the option to change the size of the system font independently from the video adapter DPI setting. Very convenient to XP users living in Easy Asia where glyphs that make up the letters are very intricate and need all the pixels they can get to make their script legible.
It is covered by Windows Forms with the Form.AutoScaleMode property, which defaults to Font instead of Dpi. WPF is however strongly biased to Dpi, the normal way of scaling.
I don't think the twain shalt ever meet. Tell your user to reset the XP setting. It is buried somewhere in the Control Panel + Display setting, I don't have it anymore to tell you exactly where to look. Or the logical alternative, changing the video DPI setting to match the font size. That's was in the Adapter tab, IIRC. Changing it from 96 to 120 DPI would be a good guess.

.Net controls changing size between computers

I have a wierd problem that i need to work out how to resolve,
I have spent the last couple of weeks working on a project for work on my laptop, but when I open the program on one of the work pcs alot of the controls are the wrong size and over lap etc,
the differences between the machines is this:
Laptop:
Windows 7 Pro;
Display - 1920*1040;
Visiual Studio 2008;
.net framework 3.5
Work Desktop:
windows xp pro;
display: 1024*768;
visual studio 2008;
.net framework 3.5;
to discribe the problem better, i have a panel which i have set to be 300px wide, which has a label inside with the day and the day in the mm-DD-yyyy format, using arial and size 8 font.
On the laptop it all fits perfectly but on the desktop the panel seems smaller and the label only displays half the text.
That is just one of many problems, another is with colour system.control seems to be a completly different colour between systems (althoug I figure that to be a win7 vs xp problem)
What can I do to fix this?
is it a windows version problem? (I have xp on a vmware machine on my laptop so i could code and design in that)
is it a display problem? - this is a big problem for me as i only have 1 laptop and I think this problem could have caused me mark loss on my recent assignment for Uni (I coded on laptop and never opened on a desktop untill today - so had no idea of this problem)
EDIT: I have found a solution of sorts for my particular problem, I discovered that my laptop was working on 125% on the dpi settings for visually impaired (no idea how..) so I have reset it back to 100% or 96Dpi Which has fixed my problems, and after chatting to a couple of other developers I know, they say that they tend to design for 96 dpi while leaving a little bit of white space around text to be safe. but then they don't tend to use c# much and mainly code all in c++ using QT framework.
The video adapter in your workstation has a different dots-per-inch setting. The form automatically rescales itself to accommodate that.
This is going to happen as well when you ship your product and it will run on the client's machine. Changing the form's AutoScaleMode property is not a fix, that will just produce clipped text in the controls. Make sure you form design is resilient to layout changes. Dock, Anchor, TableLayoutPanel, FlowLayoutPanel, the Resize event for tough cases. And make sure the controls inherit their container's Font property (not bold in the Properties window)
Ensure you can resize your panel in Visual Studio with all of the controls inside it being repositioned and resized properly. You can use anchors to achieve this, or perhaps you should use a TableLayoutPanel control instead of a regular Panel.
Change your setting for AutoScaleMode.

Font linking in the registry

A few years back, I created a WinForms application that has been successfully deployed. The next version of the application must support Chinese and Korean characters. For aesthetic reasons, my client wanted all the text in the application displayed with the Arial font family.
However, Arial doesn't support Chinese and Korean characters. On most platforms, the Windows Uniscribe Font Fallback mechanism adequately chooses a font to display the East Asian characters. But on English Windows XP, the font it picks is terrible.
I've been looking at resolving this problem with Font Linking. This would allow me to specify which font should be used when Arial can't display a character. This seems like a very elegant solution.
The problem is that the article I linked to says that adding font links through the registry is not officially supported. Also, changing the font links in the registry would impact the whole computer and not just my application.
Does anyone have experience with added font links? Did it work? What are the situations that are going to bit me later?
The "not supported" clause in the linked article is telling you that you can't call Microsoft Support and complain because you used Regedit.exe incorrectly and messed up the machine. It doesn't say that font linking isn't supported.
You can't really affect another program negatively by doing this. Font linking doesn't replace glyphs, only substitute missing ones. Such a program would previously not render text correctly. It will show readable text after you're done. They'll buy you a very nice dinner and some dancing girls.
Can you use the font Arial Unicode MS?
That's what I use to display Chinese fonts in charts and PDFs.
So, the problem is that you want to use one font if the characters match some criteria, and another font if they don't, right?
So, why not just write some code that, when the text is updated, checks the criteria and sets the font appropriately? It may be a little bit of busy work, but if it's done all over the place I bet you could encapsulate it in a custom control.
Sometimes it's a lot easier to just do the work than to try and get clever with a bunch of system settings. Not as fun, admittedly, but less likely to cause problems.

Categories

Resources