本文整理汇总了C#中Gtk.TreeViewColumn.CellGetPosition方法的典型用法代码示例。如果您正苦于以下问题:C# TreeViewColumn.CellGetPosition方法的具体用法?C# TreeViewColumn.CellGetPosition怎么用?C# TreeViewColumn.CellGetPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.TreeViewColumn
的用法示例。
在下文中一共展示了TreeViewColumn.CellGetPosition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCellAtPos
bool GetCellAtPos (int x, int y, out TreePath path, out TreeViewColumn col, out CellRenderer cellRenderer)
{
int cx, cy;
if (tree.GetPathAtPos (x, y, out path, out col, out cx, out cy)) {
tree.GetCellArea (path, col);
foreach (CellRenderer cr in col.CellRenderers) {
int xo, w;
col.CellGetPosition (cr, out xo, out w);
if (cr.Visible && cx >= xo && cx < xo + w) {
cellRenderer = cr;
return true;
}
}
}
cellRenderer = null;
return false;
}
示例2: CellTooltipWindow
public CellTooltipWindow (TreeView tree, TreeViewColumn col, TreePath path)
{
this.tree = tree;
this.col = col;
NudgeHorizontal = true;
Events |= Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask;
Gdk.Rectangle rect = tree.GetCellArea (path, col);
rect.Inflate (2, 2);
if (!tree.Model.GetIter (out iter, path)) {
Hide ();
return;
}
col.CellSetCellData (tree.Model, iter, false, false);
int x = 0;
int th = 0;
CellRenderer[] renderers = col.CellRenderers;
foreach (CellRenderer cr in renderers) {
int sp, wi, he, xo, yo;
col.CellGetPosition (cr, out sp, out wi);
Gdk.Rectangle crect = new Gdk.Rectangle (x, rect.Y, wi, rect.Height);
cr.GetSize (tree, ref crect, out xo, out yo, out wi, out he);
if (cr != renderers [renderers.Length - 1])
x += crect.Width + col.Spacing + 1;
else
x += wi + 1;
if (he > th) th = he;
}
SetSizeRequest (x, th + 2);
}