本文整理汇总了C#中TextEditor.LineToVisualY方法的典型用法代码示例。如果您正苦于以下问题:C# TextEditor.LineToVisualY方法的具体用法?C# TextEditor.LineToVisualY怎么用?C# TextEditor.LineToVisualY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextEditor
的用法示例。
在下文中一共展示了TextEditor.LineToVisualY方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MouseIsOverError
int MouseIsOverError (TextEditor editor, MarginMouseEventArgs args)
{
if (layouts == null)
return -1;
int lineNumber = editor.Document.OffsetToLineNumber (lineSegment.Offset);
int y = editor.LineToVisualY (lineNumber) - (int)editor.VAdjustment.Value;
int height = editor.LineHeight * errors.Count;
if (!fitsInSameLine) {
y += editor.LineHeight;
}
// Console.WriteLine (lineNumber + ": height={0}, y={1}, args={2}", height, y, args.Y);
if (y > args.Y || args.Y > y + height)
return -1;
int error = (args.Y - y) / editor.LineHeight;
// Console.WriteLine ("error:" + error);
if (error >= layouts.Count)
return -1;
int errorCounterWidth = 0;
int ew = 0, eh = 0;
if (error == 0 && errors.Count > 1 && errorCountLayout != null) {
errorCountLayout.GetPixelSize (out ew, out eh);
errorCounterWidth = ew + 10;
}
int labelWidth = LayoutWidth + border + (ShowIconsInBubble ? errorPixbuf.Width : 0) + errorCounterWidth + editor.LineHeight / 2;
if (editor.Allocation.Width - editor.TextViewMargin.XOffset - args.X < labelWidth)
return error;
return -1;
}
示例2: MouseIsOverMarker
bool MouseIsOverMarker (TextEditor editor, MarginMouseEventArgs args)
{
int ew = 0, eh = 0;
int lineNumber = editor.Document.OffsetToLineNumber (lineSegment.Offset);
int y = editor.LineToVisualY (lineNumber) - (int)editor.VAdjustment.Value;
if (fitsInSameLine) {
if (args.Y < y + 2 || args.Y > y + editor.LineHeight - 2)
return false;
} else {
if (args.Y < y + editor.LineHeight + 2 || args.Y > y + editor.LineHeight * 2 - 2)
return false;
}
if (errors.Count > 1 && errorCountLayout != null) {
errorCountLayout.GetPixelSize (out ew, out eh);
int errorCounterWidth = ew + 10;
if (editor.Allocation.Width - args.X - editor.TextViewMargin.XOffset <= errorCounterWidth)
return true;
}
return false;
}