Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » SOLVED: Array and Grid on high definition monitor
|
|
|
|
Re: Array and Grid on high definition monitor [message #49598 is a reply to message #49595] |
Fri, 09 March 2018 19:24 |
|
forlano
Messages: 1202 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 |
|
mirek
Messages: 14039 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
|
|
|
|
Goto Forum:
Current Time: Sat Sep 21 03:50:01 CEST 2024
Total time taken to generate the page: 0.06477 seconds
|