Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » Is it possible to set the Font type for the arrayctrl?
Re: Is it possible to set the Font type for the arrayctrl? [message #3943 is a reply to message #3920] |
Mon, 10 July 2006 15:46   |
 |
forlano
Messages: 1213 Registered: March 2006 Location: Italy
|
Senior Contributor |
|
|
luzr wrote on Sun, 09 July 2006 16:04 | Please check reference/Display.
|
It does work!
Let me show the steps done for the next generations:
1. create a column of the arrayctrl in this way:
arrp.AddColumn("wname", "White Player", 19).SetDisplay(Single<FontDisplay>());
Here should be noted the SetDisplay() method that does the job.
2. Create the following singletone ( ) derived by Display:
struct FontDisplay : Display {
virtual void Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const
{
Font fnt = Courier(14);
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);
}
};
Of course one may want to set a different foreground color (ink), different font size and so on.
Quote: |
If all you need is different font, you can also use
AttrText("My cell text").SetFont(Courier(14));
as the value you put inside the ArrayCtrl.
Mirek
|
I've not understood what to do in this last case, but it doesn't matter. For today it's enough. Now I want to study the singletone to really understand what I've done
Luigi
[Updated on: Mon, 10 July 2006 15:47] Report message to a moderator
|
|
|
 |
|
Is it possible to set the Font type for the arrayctrl?
By: forlano on Sat, 06 May 2006 14:56
|
 |
|
Re: Is it possible to set the Font type for the arrayctrl?
|
 |
|
Re: Is it possible to set the Font type for the arrayctrl?
|
 |
|
Re: Is it possible to set the Font type for the arrayctrl?
By: forlano on Sun, 07 May 2006 14:45
|
 |
|
Re: Is it possible to set the Font type for the arrayctrl?
By: forlano on Sun, 07 May 2006 19:44
|
 |
|
Re: Is it possible to set the Font type for the arrayctrl?
By: forlano on Wed, 28 June 2006 18:45
|
 |
|
Re: Is it possible to set the Font type for the arrayctrl?
By: mirek on Thu, 29 June 2006 20:16
|
 |
|
Re: Is it possible to set the Font type for the arrayctrl?
By: forlano on Sat, 01 July 2006 09:38
|
 |
|
Re: Is it possible to set the Font type for the arrayctrl?
By: mirek on Sun, 07 May 2006 19:53
|
 |
|
Re: Is it possible to set the Font type for the arrayctrl?
By: mirek on Sun, 09 July 2006 16:04
|
 |
|
Re: Is it possible to set the Font type for the arrayctrl?
By: forlano on Mon, 10 July 2006 15:46
|
 |
|
Re: Is it possible to set the Font type for the arrayctrl?
By: mirek on Mon, 10 July 2006 17:31
|
Goto Forum:
Current Time: Sun Aug 17 01:23:29 CEST 2025
Total time taken to generate the page: 0.03886 seconds
|