本文整理汇总了C#中ICSharpCode.GetPositionFromPoint方法的典型用法代码示例。如果您正苦于以下问题:C# ICSharpCode.GetPositionFromPoint方法的具体用法?C# ICSharpCode.GetPositionFromPoint怎么用?C# ICSharpCode.GetPositionFromPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICSharpCode
的用法示例。
在下文中一共展示了ICSharpCode.GetPositionFromPoint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EditorMouseHover
public void EditorMouseHover(ICSharpCode.AvalonEdit.TextEditor editor, DepthScanner scanner, MouseEventArgs e)
{
TextViewPosition? pos = editor.GetPositionFromPoint(e.GetPosition(editor));
if (pos != null)
{
try
{
int line = pos.Value.Line;
int offset = editor.Document.GetOffset(pos.Value.Location);
Globals globs = GetGlobals();
if (globs != null)
{
bool isFunc = false;
string[] words = IntellisenseHelper.ExtractPath(editor.Document, offset, pos.Value.Location.Line, out isFunc);
if (words != null && words.Length > 0)
{
BaseTypeInfo info = null;
FunctionInfo func = null;
NameResolver reso = new NameResolver(globs, scanner);
if (words.Length > 1)
{
for (int i = 0; i < words.Length; ++i)
{
if (i == words.Length - 1 && info != null && isFunc)
{
if (info is TypeInfo)
func = ((TypeInfo)info).Functions.FirstOrDefault(f => f.Name.Equals(words[i]));
}
else
{
if (info == null)
{
info = reso.GetClassType(editor.Document, editor.TextArea.Caret.Line, words[i]);
}
else if (info != null && info is TypeInfo)
{
if (((TypeInfo)info).Properties.ContainsKey(words[i]))
info = ((TypeInfo)info).Properties[words[i]];
}
}
}
}
else if (isFunc && words.Length == 1)
{
func = globs.GetFunction(words[0]);
}
else if (!isFunc && words.Length == 1)
{
info = reso.GetClassType(editor.Document, line, words[0]);
if (info == null)
{
TypeInfo ty = globs.GetTypeInfo(words[0]);
if (ty != null)
info = ty;
}
}
string msg = "";
// Ask documentation for the information
if (info != null && func != null && info is TypeInfo)
{ //member function
msg = func.ReturnType.Name + " " + func.Name;
string m = IDEProject.inst().DocDatabase.GetDocumentationFor(((TypeInfo)info).Name + "::" + func.Name + func.Inner);
if (m != null)
msg += "\r\n" + m;
}
else if (func != null)
{ //global function
msg = func.ReturnType.Name + " " + func.Name;
string m = IDEProject.inst().DocDatabase.GetDocumentationFor(func.Name + func.Inner);
if (m != null)
msg += "\r\n" + m;
}
else if (info != null && info is TypeInfo)
{ //global or member type
msg = ((TypeInfo)info).Name;
string m = IDEProject.inst().DocDatabase.GetDocumentationFor(((TypeInfo)info).Name);
if (m != null)
msg += "\r\n" + m;
}
if (msg.Length > 0)
{
InsightWindow window = new InsightWindow(editor.TextArea);
window.Content = msg;
window.Show();
}
}
}
}
catch (Exception ex)
{
//deliberately swallow any exceptions here
}
}
}