Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » SOLVED: Array and Grid on high definition monitor
Re: Array and Grid on high definition monitor [message #49600 is a reply to message #49598] |
Fri, 09 March 2018 19:29 |
|
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
|
|
|
Goto Forum:
Current Time: Wed May 08 03:55:05 CEST 2024
Total time taken to generate the page: 0.02280 seconds
|