本文整理汇总了C#中Gtk.TextView.BufferToWindowCoords方法的典型用法代码示例。如果您正苦于以下问题:C# TextView.BufferToWindowCoords方法的具体用法?C# TextView.BufferToWindowCoords怎么用?C# TextView.BufferToWindowCoords使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.TextView
的用法示例。
在下文中一共展示了TextView.BufferToWindowCoords方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawLineEndAtIter
static void DrawLineEndAtIter (Cairo.Context cntx, TextView view, TextIter iter)
{
Gdk.Rectangle rect = view.GetIterLocation (iter);
int x, y;
view.BufferToWindowCoords (TextWindowType.Text,
rect.X,
rect.Y + rect.Height / 2,
out x, out y);
cntx.Save ();
cntx.Color = GetDrawingColorForIter (view, iter);
double arrowSize = 3;
cntx.MoveTo (x + 10, y);
cntx.RelLineTo (new Cairo.Distance (0, -arrowSize));
cntx.RelMoveTo (new Cairo.Distance (0, arrowSize));
cntx.RelLineTo (new Cairo.Distance (-8, 0));
cntx.RelLineTo (new Cairo.Distance (arrowSize, arrowSize));
cntx.RelMoveTo (new Cairo.Distance (-arrowSize, -arrowSize));
cntx.RelLineTo (new Cairo.Distance (arrowSize, -arrowSize));
cntx.Stroke ();
cntx.Restore ();
}
示例2: DrawSpaceAtIter
static void DrawSpaceAtIter (Cairo.Context cntx, TextView view, TextIter iter)
{
Gdk.Rectangle rect = view.GetIterLocation (iter);
int x, y;
view.BufferToWindowCoords (TextWindowType.Text,
rect.X + rect.Width / 2,
rect.Y + rect.Height / 2,
out x, out y);
cntx.Save ();
cntx.Color = GetDrawingColorForIter (view, iter);
//no overlap on the circle, even if context is set to LineCap.Square
cntx.LineCap = Cairo.LineCap.Butt;
cntx.MoveTo (x, y);
cntx.Arc (x, y, 0.5, 0, 2 * Math.PI);
cntx.Stroke ();
cntx.Restore ();
}