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 » 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 Go to previous messageGo to previous message
forlano is currently offline  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! Very Happy

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 ( Rolling Eyes ) 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 Smile

Luigi

[Updated on: Mon, 10 July 2006 15:47]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Combine Cells?
Next Topic: About the movement of a row in a ArrayCtrl
Goto Forum:
  


Current Time: Sun Aug 17 01:23:29 CEST 2025

Total time taken to generate the page: 0.03886 seconds