本文整理汇总了C#中IEditor.ConvertColumnEditorToScreen方法的典型用法代码示例。如果您正苦于以下问题:C# IEditor.ConvertColumnEditorToScreen方法的具体用法?C# IEditor.ConvertColumnEditorToScreen怎么用?C# IEditor.ConvertColumnEditorToScreen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEditor
的用法示例。
在下文中一共展示了IEditor.ConvertColumnEditorToScreen方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SelectColumn
static void SelectColumn(IEditor editor, bool right, int line, int caretOld, int caretNew)
{
int x1, y1, x2, y2;
if (editor.SelectionExists)
{
if (editor.SelectionKind != PlaceKind.Column)
return;
// editor selection
var place = editor.SelectionPlace;
y1 = place.First.Y;
y2 = place.Last.Y;
// screen selection and carets
int select1 = editor.ConvertColumnEditorToScreen(y1, place.First.X);
int select2 = editor.ConvertColumnEditorToScreen(y2, place.Last.X);
int caret1 = editor.ConvertColumnEditorToScreen(line, caretOld);
int caret2 = editor.ConvertColumnEditorToScreen(line, caretNew);
if (right)
{
if (caret1 < select2 && caret2 > select2)
{
// invert selection
x1 = select2 + 1;
x2 = caret2 - 1;
}
else if (caret1 != select1)
{
// expand selection
x1 = select1;
x2 = caret2 - 1;
}
else
{
// reduce selection
x1 = caret2;
x2 = select2;
}
}
else
{
if (caret2 >= select1)
{
// reduce selection
x1 = select1;
x2 = caret2 - 1;
}
else if (caret1 > select1)
{
// invert selection
x1 = caret2;
x2 = select1 - 1;
}
else
{
// expand selection
x1 = caret2;
x2 = select2;
}
}
}
else
{
// start selection
y1 = y2 = line;
if (right)
{
x1 = editor.ConvertColumnEditorToScreen(y1, caretOld);
x2 = editor.ConvertColumnEditorToScreen(y1, caretNew - 1);
}
else
{
x1 = editor.ConvertColumnEditorToScreen(y1, caretNew);
x2 = editor.ConvertColumnEditorToScreen(y1, caretOld - 1);
}
}
// set/drop selection and set the caret
editor.GoTo(caretNew, line);
editor.SelectText(x1, y1, x2, y2, PlaceKind.Column);
editor.Redraw();
}