您好,我需要通过在 Excel 主窗口上 float 一个无模式窗体来模拟任务 Pane 。提出此要求的原因是我需要为我的 Excel 2003 加载项提供任务 Pane 功能,但不能使用以文档为中心的模型。
谁能建议最好的方法是什么?无模式窗体需要检测主窗口调整大小事件并相应地调整自身大小,并且还需要始终将自身定位在窗口底部(有点像停靠 Pane )。
最佳答案
我更喜欢 this method which is simple and straight forward :
以下是我的实现方式(在 VB 中):
Public Class WindowWrapper
Implements System.Windows.Forms.IWin32Window
Private _hwnd As IntPtr
Public Sub New(ByVal handle As IntPtr)
_hwnd = handle
End Sub
Public ReadOnly Property Handle() As IntPtr Implements System.Windows.Forms.IWin32Window.Handle
Get
Return _hwnd
End Get
End Property
End Class
Dim owner As New WindowWrapper(CType(gXLApp.Hwnd, IntPtr))
gfTimeStamp = New FTimeStamp
gfTimeStamp.Show(owner)
效果很好!
关于c# - 需要在 excel 主窗口(准任务 Pane )上放置一个 float 的无模式窗体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2553362/