本文整理汇总了C#中MonoTextEditor.LocationToPoint方法的典型用法代码示例。如果您正苦于以下问题:C# MonoTextEditor.LocationToPoint方法的具体用法?C# MonoTextEditor.LocationToPoint怎么用?C# MonoTextEditor.LocationToPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MonoTextEditor
的用法示例。
在下文中一共展示了MonoTextEditor.LocationToPoint方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDiffRectangles
public static ICollection<Cairo.Rectangle> GetDiffRectangles (MonoTextEditor editor, int startOffset, int endOffset)
{
ICollection<Cairo.Rectangle> rectangles = new List<Cairo.Rectangle> ();
var startLine = editor.GetLineByOffset (startOffset);
var endLine = editor.GetLineByOffset (endOffset);
int lineCount = endLine.LineNumber - startLine.LineNumber;
var line = startLine;
for (int i = 0; i <= lineCount; i++) {
Cairo.Point point = editor.LocationToPoint (editor.Document.OffsetToLocation (Math.Max (startOffset, line.Offset)), true);
Cairo.Point point2 = editor.LocationToPoint (editor.Document.OffsetToLocation (Math.Min (line.EndOffset, endOffset)), true);
rectangles.Add (new Cairo.Rectangle (point.X - editor.TextViewMargin.XOffset, point.Y, point2.X - point.X, editor.LineHeight));
line = line.NextLine;
}
return rectangles;
}
示例2: DrawBackground
public override void DrawBackground(MonoTextEditor editor, Context cr, LineMetrics metrics, int startOffset, int endOffset)
{
int x1 = editor.LocationToPoint(editor.OffsetToLocation(this.Offset), false).X;
int x2 = editor.LocationToPoint(editor.OffsetToLocation(this.Offset + this.Length), false).X;
cr.Rectangle(x1, metrics.LineYRenderStartPosition + 0.5, x2 - x1, metrics.LineHeight - 1);
cr.SetSourceRGB(1.0, 1.0, 0.0);
cr.Fill();
}
示例3: ShowPopup
void ShowPopup (MonoTextEditor editor, EventButton evt)
{
CommandEntrySet cset = IdeApp.CommandService.CreateCommandEntrySet ("/MonoDevelop/VersionControl/DiffView/ContextMenu");
Gtk.Menu menu = IdeApp.CommandService.CreateMenu (cset);
menu.Destroyed += delegate {
this.QueueDraw ();
};
if (evt != null) {
GtkWorkarounds.ShowContextMenu (menu, this, evt);
} else {
var pt = editor.LocationToPoint (editor.Caret.Location);
GtkWorkarounds.ShowContextMenu (menu, editor, new Gdk.Rectangle (pt.X, pt.Y, 1, (int)editor.LineHeight));
}
}