为按钮提供扩展帮助

扩展帮助指的是档鼠标悬停在按钮上,出现的更多关于该按钮的描述信息,包括文字和图片,甚至视频。最终用户就不需要查阅帮助手册就能快速的了解该按钮的相关功能。

image


API提供了对应的能力,实现自定义按钮的扩展帮助。以下VBA代码演示了流程。当然,最终创建按钮需要用插件。


Public Sub ProgressiveToolTips()    
   Dim g_FilePath As String 
   g_FilePath = "C:\temp\" 
  
    ' Create the button definition. 
    Dim smallIcon As IPictureDisp 
    Set smallIcon = LoadPicture(g_FilePath & "SmallProgTooltip.bmp") 
    
    Dim largeIcon As IPictureDisp 
    Set largeIcon = LoadPicture(g_FilePath & "LargeProgTooltip.bmp") 
    
    Dim buttonDef As ButtonDefinition 
    Set buttonDef = ThisApplication.CommandManager.ControlDefinitions.AddButtonDefinition("Sample1", "SampleCommand", kQueryOnlyCmdType, "", "Sample command to show progressive tool tips.", "Sample", smallIcon, largeIcon) 
    
    ' Add a control to the Work Feature panel of the Model tab of the Part ribbon. 
    Call ThisApplication.UserInterfaceManager.Ribbons.Item("Part").RibbonTabs.Item("id_TabModel").RibbonPanels.Item("id_PanelA_ModelWorkFeatures").CommandControls.AddButton(buttonDef, True) 
    
    ' Define the progressive tooltip.  This would typically be done in the 
    ' same section of code where the button definition is created but there's 
    ' a problem with the beta version where the progressive tooltip can only 
    ' be defined on a control has been created. 
    With buttonDef.ProgressiveToolTip 
        .Description = "The short description." 
        .ExpandedDescription = "This is the long expaned version of the description that could have a more complete description to accompany the picture." 
        Dim progImage As IPictureDisp 
        Set progImage = LoadPicture(g_FilePath & "koala.jpg") 
         .Image = progImage 
        .IsProgressive = True 
        .Title = "Sample1" 
       
    End With 
End Sub


image



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值