久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

Excel...

 F2967527 2022-07-13 發(fā)布于北京

Excel-DNA項(xiàng)目中的自定義功能區(qū)和自定義任務(wù)窗格需要用到各種命名空間、添加所需文件,才能實(shí)現(xiàn),。后來我發(fā)現(xiàn)可以把所有代碼都寫在Class1.vb這個默認(rèn)文件中,。

大家可以在Visual Studio中創(chuàng)建一個類庫項(xiàng)目(.Net Framework),,然后把默認(rèn)的Class1.vb中的代碼整體替換為下面我貼的這個代碼,。然后啟動調(diào)試,,就可以看到自定義功能區(qū)和任務(wù)窗格了,。

 1 Imports System.Runtime.InteropServices
 2 Imports ExcelDna.Integration
 3 Imports ExcelDna.Integration.CustomUI
 4 Imports Excel = Microsoft.Office.Interop.Excel
 5 <ComVisible(True)>
 6 Public Class Class1
 7     Inherits ExcelRibbon
 8     Implements IExcelAddIn
 9     Public R As IRibbonUI
10     Public Overrides Function GetCustomUI(RibbonID As String) As String
11         Dim xml As XElement
12         xml = <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="OnLoad">
13                   <ribbon startFromScratch="false">
14                       <tabs>
15                           <tab id="Tab1" label="RibbonXmlEditor">
16                               <group id="Group1" label="Author:ryueifu">
17                                   <button id="Button1" label="CTP" imageMso="C" onAction="Button1_Click"/>
18                                   <button id="Button2" label="UnLoad" imageMso="U" onAction="Button2_Click"/>
19                               </group>
20                           </tab>
21                       </tabs>
22                   </ribbon>
23               </customUI>
24         Return xml.ToString()
25     End Function
26     Public Sub OnLoad(ribbon As IRibbonUI)
27         R = ribbon
28         R.ActivateTab(ControlID:="Tab1")
29     End Sub
30     Public Sub Button1_Click(control As IRibbonControl)
31         ctp.Visible = Not ctp.Visible
32     End Sub
33     Public Sub Button2_Click(control As IRibbonControl)
34         Dim ThisAddin As Excel.AddIn
35         ThisAddin = ExcelDnaUtil.Application.AddIns.Item(Index:=My.Application.Info.AssemblyName)
36         ThisAddin.Installed = False
37     End Sub
38 
39     Public Sub AutoOpen() Implements IExcelAddIn.AutoOpen
40         Module1.CreateCTP()
41     End Sub
42 
43     Public Sub AutoClose() Implements IExcelAddIn.AutoClose
44         Module1.DisposeCTP()
45     End Sub
46 End Class
47 
48 Public Module Module1
49     Public uc As System.Windows.Forms.UserControl
50     Public ctp As CustomTaskPane
51     Public Sub CreateCTP()
52         uc = New Windows.Forms.UserControl
53         ctp = CustomTaskPaneFactory.CreateCustomTaskPane(userControl:=uc, title:="CTP")
54         With ctp
55             .DockPosition = MsoCTPDockPosition.msoCTPDockPositionRight
56             .Visible = True
57         End With
58     End Sub
59     Public Sub DisposeCTP()
60         ctp.Dispose()
61     End Sub
62 End Module

 

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn),。請注意甄別內(nèi)容中的聯(lián)系方式,、誘導(dǎo)購買等信息,謹(jǐn)防詐騙,。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,,請點(diǎn)擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多