[Gtk-sharp-list] Fonts in TreeView

Anyware Electronics any at anyelec.com
Tue Apr 2 16:34:42 UTC 2013


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20130402/ea80c382/attachment.html>


More information about the Gtk-sharp-list mailing list