c# - 需要在 excel 主窗口(准任务 Pane )上放置一个 float 的无模式窗体

标签 c# excel vsto

您好,我需要通过在 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/

相关文章:

excel - 使用 gitlab 对 xslx 进行版本控制

java - 如何在 weburl 中使用 REST API Controller 返回 xls excel 文件响应

c# - VSTO Excel Com 添加功能区未加载

C#Excel : Programmatically open and copy workbook while ignoring dependency

c# - 为什么 foreach 语句接受实现 'Collection' 模式的对象而不是仅接受实现 IEnumerable 的对象?

c# - Ghostscript.NET 图片文字质量问题

c# - 我们在哪里可以看到命名语言值的完整列表?

C#:使用泛型创建指针数组

Excel找到对应的值,如果没有找到返回 `0`

c#-4.0 - 如何使用 C# 使用 VSTO wordAddIn 2010 访问 native Word 应用程序进度条