本文整理汇总了C#中TextArea.LineToY方法的典型用法代码示例。如果您正苦于以下问题:C# TextArea.LineToY方法的具体用法?C# TextArea.LineToY怎么用?C# TextArea.LineToY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextArea
的用法示例。
在下文中一共展示了TextArea.LineToY方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PaintEditorOverlay
void PaintEditorOverlay (TextArea editor, PaintEventArgs args, List<Hunk> diff, bool paintRemoveSide)
{
if (diff == null)
return;
var cr = args.Context;
foreach (var hunk in diff) {
double y1 = editor.LineToY (paintRemoveSide ? hunk.RemoveStart : hunk.InsertStart) - editor.VAdjustment.Value;
double y2 = editor.LineToY (paintRemoveSide ? hunk.RemoveStart + hunk.Removed : hunk.InsertStart + hunk.Inserted) - editor.VAdjustment.Value;
if (y1 == y2)
y2 = y1 + 1;
cr.Rectangle (0, y1, editor.Allocation.Width, y2 - y1);
cr.SetSourceColor (GetColor (hunk, paintRemoveSide, false, 0.15));
cr.Fill ();
var paths = GetDiffPaths (diff, editors[0], hunk);
cr.Save ();
cr.Translate (-editor.HAdjustment.Value + editor.TextViewMargin.XOffset, -editor.VAdjustment.Value);
foreach (var rect in (paintRemoveSide ? paths.Item1 : paths.Item2)) {
cr.Rectangle (rect);
}
cr.SetSourceColor (GetColor (hunk, paintRemoveSide, false, 0.3));
cr.Fill ();
cr.Restore ();
cr.SetSourceColor (GetColor (hunk, paintRemoveSide, true, 0.15));
cr.MoveTo (0, y1);
cr.LineTo (editor.Allocation.Width, y1);
cr.Stroke ();
cr.MoveTo (0, y2);
cr.LineTo (editor.Allocation.Width, y2);
cr.Stroke ();
}
}