зеркало из https://github.com/mono/mail-archives.git
114 строки
4.0 KiB
HTML
114 строки
4.0 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE> [Gtk-sharp-list] Re: TreeViewColumn alignment
|
|
</TITLE>
|
|
<LINK REL="Index" HREF="index.html" >
|
|
<LINK REL="made" HREF="mailto:gtk-sharp-list%40lists.ximian.com?Subject=%5BGtk-sharp-list%5D%20Re%3A%20TreeViewColumn%20alignment&In-Reply-To=20050627141408.5BF8E1CFF58%40lists.ximian.com">
|
|
<META NAME="robots" CONTENT="index,nofollow">
|
|
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
|
|
<LINK REL="Previous" HREF="006079.html">
|
|
<LINK REL="Next" HREF="006068.html">
|
|
</HEAD>
|
|
<BODY BGCOLOR="#ffffff">
|
|
<H1>[Gtk-sharp-list] Re: TreeViewColumn alignment</H1>
|
|
<B>Bryan Buchanan</B>
|
|
<A HREF="mailto:gtk-sharp-list%40lists.ximian.com?Subject=%5BGtk-sharp-list%5D%20Re%3A%20TreeViewColumn%20alignment&In-Reply-To=20050627141408.5BF8E1CFF58%40lists.ximian.com"
|
|
TITLE="[Gtk-sharp-list] Re: TreeViewColumn alignment">adslh3nu at tpg.com.au
|
|
</A><BR>
|
|
<I>Mon Jun 27 17:50:49 EDT 2005</I>
|
|
<P><UL>
|
|
<LI>Previous message: <A HREF="006079.html">[Gtk-sharp-list] GTK# unstable API docs
|
|
</A></li>
|
|
<LI>Next message: <A HREF="006068.html">[Gtk-sharp-list] cannot run mono app on XP using MS CLR
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#6064">[ date ]</a>
|
|
<a href="thread.html#6064">[ thread ]</a>
|
|
<a href="subject.html#6064">[ subject ]</a>
|
|
<a href="author.html#6064">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
<HR>
|
|
<!--beginarticle-->
|
|
<PRE>
|
|
><i>
|
|
</I>><i> Message: 9
|
|
</I>><i> Date: Mon, 27 Jun 2005 19:21:56 +0530
|
|
</I>><i> From: Benoy George <<A HREF="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">mumsp at hotpop.com</A>>
|
|
</I>><i> Subject: [Gtk-sharp-list] TreeViewColumn alignment
|
|
</I>><i> To: <A HREF="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">gtk-sharp-list at lists.ximian.com</A>
|
|
</I>><i> Message-ID: <<A HREF="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">42C0047C.70408 at hotpop.com</A>>
|
|
</I>><i> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
|
|
</I>><i>
|
|
</I>><i> Dear Friends,
|
|
</I>><i>
|
|
</I>><i> Please help me on how to right align a column in
|
|
</I>><i> Gtk.TreeViewColumn
|
|
</I>><i>
|
|
</I>><i> My current column definitions are
|
|
</I>><i>
|
|
</I>><i> col = new TreeViewColumn ();
|
|
</I>><i> colr = new CellRendererText ();
|
|
</I>><i> col.Title = "Expense";
|
|
</I>><i> col.PackStart (colr, true);
|
|
</I>><i> col.AddAttribute (colr, "text", 2);
|
|
</I>><i> col.Alignment = 0.0f;
|
|
</I>><i> col.Resizable = true;
|
|
</I>><i> tv.AppendColumn (col);
|
|
</I>><i>
|
|
</I>><i> I want to align above said column Expense to right-align
|
|
</I>><i> with two decimal point. I googled a lot, but no way to get
|
|
</I>><i> it done.
|
|
</I>><i>
|
|
</I>col.Alignment = 1.0f; // col title right aligned
|
|
colr.Xalign = 1.0f; // render data right aligned
|
|
|
|
Depending how your data is stored in the model you might also need
|
|
|
|
col.SetCellDataFunc(colr, new TreeCellDataFunc(ShowExpense));
|
|
|
|
and
|
|
|
|
void ShowExpense (TreeViewColumn tree_column,
|
|
CellRenderer cell, TreeModel tree_model, TreeIter iter)
|
|
{
|
|
double x = (double) tree_model.GetValue(iter, 1);
|
|
((CellRendererText)cell).Text = String.Format("{0:N2}", x);
|
|
}
|
|
|
|
or similar.
|
|
|
|
Bryan
|
|
|
|
</PRE>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!--endarticle-->
|
|
<HR>
|
|
<P><UL>
|
|
<!--threads-->
|
|
<LI>Previous message: <A HREF="006079.html">[Gtk-sharp-list] GTK# unstable API docs
|
|
</A></li>
|
|
<LI>Next message: <A HREF="006068.html">[Gtk-sharp-list] cannot run mono app on XP using MS CLR
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#6064">[ date ]</a>
|
|
<a href="thread.html#6064">[ thread ]</a>
|
|
<a href="subject.html#6064">[ subject ]</a>
|
|
<a href="author.html#6064">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
|
|
<hr>
|
|
<a href="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">More information about the Gtk-sharp-list
|
|
mailing list</a><br>
|
|
</body></html>
|