如何使用SetWindowPos定位窗口?

时间:2019-04-03 06:16:40

标签: .net

我正在使用以下代码在Excel工作区旁边显示一个新窗口。一切正常,但我希望新窗口位于左侧。我尝试在SetWindowPos中更改X,但它仍加载在右侧。有人可以帮忙吗

SafeNativeMethods.SetWindowPos(this.SiblingWindow, IntPtr.Zero, 0, 0, newWidth, siblingRect.Height, SafeNativeMethods.SWP_NOMOVE | SafeNativeMethods.SWP_NOZORDER);
  

哪里

  1. this.SiblingWindow是Excel Workarea的句柄
  2. newWidth = Excel Workarea.Width-新Window.Width

enter image description here

0 个答案:

没有答案
相关问题