我希望创建一个适用于vs2008的插件,可以在编辑器上显示一个透明的表单/窗口。
在下面的代码中,“aw.Left”和“aw.Top”是相对值,均为1。
问题:
你知道如何获取编辑器部分的左/上屏幕位置吗?
或者我可以将插入符移动到顶部/左侧字符位置,但你知道如何获取插入符的屏幕位置吗?
非常感谢。
public void Exec(string commandName, vsCommandExecOption executeOption, ref object varIn, ref object varOut, ref bool handled)
{
handled = false;
if(executeOption == vsCommandExecOption.vsCommandExecOptionDoDefault)
{
if(commandName == "MyAddin1.Connect.MyAddin1")
{
Window aw = _app.ActiveWindow;
int left = aw.Left;
int top = aw.Top;
LinkedWindowFrame
据说可以获取父级,因此您可以一直向上移动,直到获得绝对位置。或者,您可以将覆盖层设置为窗口的子级,避免需要绝对位置。 - ta.speot.is