MaterialSkin icon indicating copy to clipboard operation
MaterialSkin copied to clipboard

Strange Behavior on Listview Column font

Open ThibaudMZN opened this issue 5 years ago • 7 comments

Hi,

I'm facing a strange behavior on listviews, with the column name font size. When creating a new Listview, each item line size is really small, so following your example, I applied one of your font using :

listview.Font = MaterialSkinManager.Instance.getFontByType(MaterialSkinManager.fontType.H4);

The problem is, it displays properly on my computer, but not on my client's one, as you can see below :

My computer : Capture

My client's computer : unknown

I know for a fact that my client doesn't have the Roboto font installed on his computer, so that could be one of the problem, but since this font is embedded in the dll, I was really sure it wouldn't cause any trouble.

If you have any ideas on where to look to fix that, once again, thank you !

ThibaudMZN avatar Jun 22 '20 14:06 ThibaudMZN

Thanks for reporting, this is most likely causes by the windows dpi scaling, maybe related to #93

leocb avatar Jun 22 '20 14:06 leocb

For info, Uninstalling Roboto Font on my computer created this issue. And the AutoScaleMode set to DPI doesn't seems to fix it...

ThibaudMZN avatar Jun 23 '20 04:06 ThibaudMZN

It's even stranger since in your listview control, you force the actual column Font here I don't know how it can actually change it...

ThibaudMZN avatar Jun 23 '20 14:06 ThibaudMZN

To fix it, I actually set the listview font to a generic font with a higher size (Microsoft Sans Serif; 32,25pt), and this actually works to make item lines bigger withouth actually changing the font !

ThibaudMZN avatar Jun 23 '20 15:06 ThibaudMZN

Can you post a screenshot? I believe it's the header that's too big, not the items that are too small

leocb avatar Jun 23 '20 15:06 leocb

Here you can see the differences :

Capture

  1. Default Listview when dropped directly in design mode

  2. Listview with higher size font (Microsoft Sans Serif; 32,25pt)

  3. Listview when trying to force font size with code materialListView.Font = MaterialSkinManager.Instance.getFontByType(MaterialSkinManager.fontType.H4)

ThibaudMZN avatar Jun 23 '20 16:06 ThibaudMZN

1 and 2 looks correct, but with wrong height. The tab selector component in the title bar also seems to have the same problem, it really looks like a dpi scaling problem. I can tell you have a 4k monitor, and that could be messing things up. Honestly at this point, my suggestion is that you migrate to WPF or UWP The thing is, I don't have much control when using the windows form's list view as a base component, it does weird things and don't obey every property set; I'm sure you've also encountered these problems when trying to solve this (thanks btw). You could try and write your own list view component, but it would be a enormous amount of work to handle every use case - that's why we use base components! I'm currently don't have any projects that use this lib, that means I'm not actively working on it. But I want to in the future! please keep trying to solve this. it's a bit of a curve ball but it can be done!

leocb avatar Jun 23 '20 16:06 leocb