Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » SOLVED: Array and Grid on high definition monitor
SOLVED: Array and Grid on high definition monitor [message #49578] Sun, 04 March 2018 23:53 Go to next message
forlano is currently offline  forlano
Messages: 1182
Registered: March 2006
Location: Italy
Senior Contributor
Hello,

on Surface 4 with Windows 10 at 2160x1440 both ctrl do not show correctly. It seems the font are not scaled properly.
See picture attached.
The ArrayCtrl shows the problem in case of custom display.
Am I the only who experience this problem?

Thanks,
Luigi

index.php?t=getfile&id=5522&private=0
  • Attachment: pic.png
    (Size: 178.58KB, Downloaded 424 times)

[Updated on: Fri, 09 March 2018 22:55]

Report message to a moderator

Re: Array and Grid on high definition monitor [message #49593 is a reply to message #49578] Thu, 08 March 2018 10:01 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
forlano wrote on Sun, 04 March 2018 23:53
Hello,

on Surface 4 with Windows 10 at 2160x1440 both ctrl do not show correctly. It seems the font are not scaled properly.
See picture attached.
The ArrayCtrl shows the problem in case of custom display.
Am I the only who experience this problem?

Thanks,
Luigi

index.php?t=getfile&id=5522&private=0


Is not it possible that you have some issue in your code, like using SetLineCy or some custom Displays? AttrText?

E.g. providing the short example would be nice...

Not sure if that is your machine, but if it is, do you experience any issue with e.g. theide?

Mirek
Re: Array and Grid on high definition monitor [message #49594 is a reply to message #49593] Thu, 08 March 2018 12:10 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1182
Registered: March 2006
Location: Italy
Senior Contributor
mirek wrote on Thu, 08 March 2018 10:01


Is not it possible that you have some issue in your code, like using SetLineCy or some custom Displays? AttrText?



In both case I use SetLineCy and custom Display.
I have not a Surface machine. I'll try to do a short program showing the issue.

Thanks,
Luigi
Re: Array and Grid on high definition monitor [message #49595 is a reply to message #49594] Thu, 08 March 2018 14:30 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
forlano wrote on Thu, 08 March 2018 12:10
mirek wrote on Thu, 08 March 2018 10:01


Is not it possible that you have some issue in your code, like using SetLineCy or some custom Displays? AttrText?



In both case I use SetLineCy and custom Display.
I have not a Surface machine. I'll try to do a short program showing the issue.

Thanks,
Luigi


Well, those numbers with SetLineCy etc... are absolute number of pixels. They should always be scaled. You can scale with Zx / Zy (for zoom X or zoom Y) - this scales based on size of standard font and should therefore take care about HDPI displays.

Alternative is using DPI - this simply multiplies the argument by 2 if running on HDPI. Better for image related work.

Also note that .iml images can be scaled automatically, if they are set correctly - Image can be marked as normal DPI (and is then automatically upscaled in HDPI), or can be marked HIDPI (and is eventually downscaled), or is "no resolition" and left intact.

Mirek
Re: Array and Grid on high definition monitor [message #49598 is a reply to message #49595] Fri, 09 March 2018 19:24 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1182
Registered: March 2006
Location: Italy
Senior Contributor
mirek wrote on Thu, 08 March 2018 14:30

Well, those numbers with SetLineCy etc... are absolute number of pixels. They should always be scaled. You can scale with Zx / Zy (for zoom X or zoom Y) - this scales based on size of standard font and should therefore take care about HDPI displays.


Hi Mirek,

I am sorry but I have not understood how to scale.
In the ArrayCtrl I am using 3 different display that affect 5 columns. Here are 2 Display:

struct FontDisplay3 : Display {
	virtual void Paint(Draw& w, const Rect& r, const Value& q,
		               Color ink, Color paper, dword style) const
	{		
		Font fnt = Courier(15).Bold(); 
	        ink = Blue();
		String txt = AsString(q);
	 	w.DrawRect(r, paper);
		w.DrawText(r.left + 2, r.top + (r.Height() - GetTextSize(txt, fnt).cy) / 2, txt, fnt, ink); 
	}
};

struct PaperResult : Display {
	virtual void Paint(Draw& w, const Rect& r, const Value& q,
		               Color ink, Color paper, dword style) const
	{				
		Font fnt = Roman(16).Bold();
		String txt = AsString(q);
		if (txt.Find("F")>=0) paper=Color(250,150,150);
		else if (txt.Find("U")>=0) paper=Color(124,252,0);
		else if (txt.Find("   ")>=0) paper=Color(255,255,204);
	 	w.DrawRect(r, paper);
	 	int a=(r.Width()-GetTextSize(txt, fnt).cx)/2;
		w.DrawText(r.left + a, r.top + (r.Height() - GetTextSize(txt, fnt).cy) / 2, txt, fnt, ink); 
	}
};


Can you please show me how to scale one of these?
Thanks!
Luigi
Re: Array and Grid on high definition monitor [message #49600 is a reply to message #49598] Fri, 09 March 2018 19:29 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member


struct FontDisplay3 : Display {
	virtual void Paint(Draw& w, const Rect& r, const Value& q,
		               Color ink, Color paper, dword style) const
	{		
		Font fnt = Courier(Zy(15)).Bold(); 
	        ink = Blue();
		String txt = AsString(q);
	 	w.DrawRect(r, paper);
		w.DrawText(r.left + DPI(2), r.top + (r.Height() - GetTextSize(txt, fnt).cy) / 2, txt, fnt, ink); 
	}
};

struct PaperResult : Display {
	virtual void Paint(Draw& w, const Rect& r, const Value& q,
		               Color ink, Color paper, dword style) const
	{				
		Font fnt = Roman(Zy(16)).Bold();
		String txt = AsString(q);
		if (txt.Find("F")>=0) paper=Color(250,150,150);
		else if (txt.Find("U")>=0) paper=Color(124,252,0);
		else if (txt.Find("   ")>=0) paper=Color(255,255,204);
	 	w.DrawRect(r, paper);
	 	int a=(r.Width()-GetTextSize(txt, fnt).cx)/2;
		w.DrawText(r.left + a, r.top + (r.Height() - GetTextSize(txt, fnt).cy) / 2, txt, fnt, ink); 
	}
};


(Use of DPI in FontDisplay3 is more matter of taste, could be Zx instead probably).

Mirek
Can you please show me how to scale one of these?
Thanks!
Luigi[/quote]

[Updated on: Fri, 09 March 2018 19:29]

Report message to a moderator

Re: Array and Grid on high definition monitor [message #49601 is a reply to message #49600] Fri, 09 March 2018 22:55 Go to previous message
forlano is currently offline  forlano
Messages: 1182
Registered: March 2006
Location: Italy
Senior Contributor
Great!

The problem disappeared. I was warried that on this device my program could not work properly.

Thanks,
Luigi
Previous Topic: GridControl release memory
Next Topic: [BUG #1739, + PATCH]ArrayCtrl: in Multiselect mode, WhenSel is called 5 time each cursor change
Goto Forum:
  


Current Time: Fri Mar 29 16:24:05 CET 2024

Total time taken to generate the page: 0.01237 seconds