[Gtk-sharp-list] Fonts in TreeView

Anyware Electronics any at anyelec.com
Tue Apr 16 12:23:13 UTC 2013


Thank you for your good will.

I already tried this, for instance:

		CellRenderer Col0r=new CellRendererText();
		...
		// Select fonts here ???
		Col0r.CellBackground="Green"; // it works
		Col0r.Font="Arial"; // error:

This gives an error, as you may see in the enclosed image.

Have you any suggestion?

Thank you

Paolo


------- Messaggio originale -------
Da: Bertrand Lorentz <bertrand.lorentz at gmail.com>
A: any at anyelec.com
Oggetto: Re: [Gtk-sharp-list] Fonts in TreeView
Data: Sun, 14 Apr 2013 16:53:03 +0200


Hi,

Unless I'm missing something, you should be able to change fonts, set
to bold, etc. through various properties on the CellRendererText
object:
Font, Weight, FontDesc, etc.
See this page for the list of the properties:
http://docs.go-mono.com/?link=T%3aGtk.CellRendererText%2f*


On Tue, Apr 2, 2013 at 6:34 PM, Anyware Electronics <any at anyelec.com> wrote:
> I started to work with the MonoDevelop environment a few days ago, so I am
> quite new even if I worked for al lot of years in other languages.
> I have MonoDevelop 2.8.6.3 in Ubuntu 12.04 LTS.
>
> I was able to make a TreeView that shows a list of files and dates, and I
> can also order the columns by clicking on their header.
>
> My problem is that I cannot find how Fonts can be changed: I would like to
> have different fonts for the two columns and maybe also to hve the haeders
> in bold.
> I was only able to change the background color and the line spacing.
>
> Here is the part of my code that constructs the TreeView:
>
> public partial class MainWindow: Gtk.Window
> {
> static ListStore Store1=new ListStore(typeof(string),typeof(DateTime));
> static TreeIter Iter1=new TreeIter();
> TreeViewColumn Col0=new TreeViewColumn();
> TreeViewColumn Col1=new TreeViewColumn();
> static int sl;
>
> public MainWindow (): base (Gtk.WindowType.Toplevel)
> {
> Build ();
>
> // Make the ListView
> LeftTree.HeadersClickable=true;
> // Col0 = filename
> CellRenderer Col0r=new CellRendererText();
> Col0.Title="File";
> Col0.PackStart (Col0r,true);
> Col0.AddAttribute(Col0r,"text",0);
>                 Col0.Resizable=true;
>                 Col0.Clickable=true;
> Col0.Clicked+=new EventHandler(C0Click);
> LeftTree.AppendColumn(Col0);
>
> // Col1 = date/time
> CellRenderer Col1r=new CellRendererText();
> Col1.Title="Date/Time";
> Col1.PackStart (Col1r,true);
>                 Col1.Resizable=true;
>                 Col1.Clickable=true;
> Col1.Clicked+=new EventHandler(C1Click);
> LeftTree.AppendColumn(Col1);
> Col1.SetCellDataFunc(Col1r, new Gtk.TreeCellDataFunc(RenderDateTime)); //
> formatting function for dates
>
> // Make the liststore
> LeftTree.Model=Store1;
> Store1.SetSortFunc(0,C0Comp);
> Store1.SetSortFunc(1,C1Comp);
>
> // Select fonts here ???
> Col0r.CellBackground="Green"; // it works
> Col0r.Height=30; // it works
>
> }
>
> Thank you for your help!
>
> Paolo
>
>
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20130416/fc09e7d3/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FontError.jpg
Type: image/jpeg
Size: 19920 bytes
Desc: not available
URL: <http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20130416/fc09e7d3/attachment-0001.jpg>


More information about the Gtk-sharp-list mailing list