77范文网 - 专业文章范例文档资料分享平台

codejock英文教程(6)

来源:网络收集 时间:2019-02-17 下载这篇文档 手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:或QQ: 处理(尽可能给您提供完整文档),感谢您的支持与谅解。点击这里给我发消息

'Enable this button if all buttons are not expanded

Control.Enabled = (wndShortcutBar.ExpandedLinesCount <> 9)

'Adds the \

Set Control = frmMain.AddButton(.Controls, xtpControlButton, _

SHORTCUT_SHOW_FEWER, \Buttons\

'Enable this button if there are 1 or more buttons expanded Control.Enabled = (wndShortcutBar.ExpandedLinesCount <> 1)

'Adds the \2003,

'this will do nothing in our sample AddButton .Controls, xtpControlButton, SHORTCUT_NAVIGATE_PANE_OPTIONS, _

\Options...\

Now we will add the popup button that contains a button for each of the ShortcutBar items. These buttons will be used to hide\\show the corresponding item in the ShortcutBar. The picture below shows where these items will be displayed:

'Adds the \Buttons\ 'contain a button that corresponds to each item that is in the 'ShortcutBar. The buttons will allow you to hide\\show items 'in the ShortcutBar

Set Control = AddButton(.Controls, xtpControlButtonPopup, _ SHORTCUT_ADD_REMOVE_BUTTONS, \or Remove Buttons\

'Adds a button for each shortcutbar item to the '\

For Each Item In wndShortcutBar

If Not Item.Id = -1 Then With Control.CommandBar

Set SubControl = AddButton(.Controls, xtpControlButton, _

Item.Id, Item.Caption)

SubControl.IconId = Item.Id

'set the button as \ 'currently visible in the Shortcutbar SubControl.Checked = Item.Visible End With End If Next

The last part of the popup will contain a quick link to all of the ShortcutBar items that are currently hidden. The picture below shoes where these items are displayed: Dim BeginGroup As Boolean BeginGroup = True

'Adds all hidden shortcut bar buttons to the popup menu 'This will give you access to the buttons not currently 'displayed in the ShortcutBar For Each Item In wndShortcutBar

'If shortcut bar item is hidden, then add it to the popup menu

If (Item.Hidden) Then

AddButton .Controls, xtpControlButton, Item.Id, Item.Caption, _

BeginGroup

BeginGroup = False End If Next

End With

Next you will add the message handleing from the popup menu: End With

'stores the ID of the selected control from the expand button popup menu.

Dim nCommand As Long

'Displays the expand button popup. Control will not pass 'back to the code until the popup menu is closed.

'Passing TPM_RETURNCMD into ShowPopup will cause the ID of the control to

'be returned when a control in the popup is clicked. When using the

'TPM_RETURNCMD parameter, the CommandBars_Execute event does not fire

'because the ID of the control is returned instead. nCommand = Popup.ShowPopup(TPM_RETURNCMD)

'Popup is closed and the user did not select anything, they might have

'click on something other than the popup menu If (nCommand = 0) Then Exit Sub

'A control was selected from the popup menu. Determines which control

'was selected.

Select Case (nCommand)

Case SHORTCUT_INBOX To SHORTCUT_JOURNAL

'Hides or displays the ShortcutBar item that was clicked wndShortcutBar.FindItem(nCommand).Visible = _ Not

wndShortcutBar.FindItem(nCommand).Visible

Case SHORTCUT_SHOW_MORE:

'Expands the Shortcut list by 1 wndShortcutBar.ExpandedLinesCount = _ wndShortcutBar.ExpandedLinesCount + 1

Case SHORTCUT_SHOW_FEWER:

'Collapses the Shortcut list by 1

wndShortcutBar.ExpandedLinesCount = _ wndShortcutBar.ExpandedLinesCount - 1

Case SHORTCUT_NAVIGATE_PANE_OPTIONS:

Debug.Print \ End Select

End Sub

Below is the complete code for the ExpandButtonDown event:

'The ExpandButtonDown event is fired when the ShortcutBar's 'expand button is clicked.

Private Sub wndShortcutBar_ExpandButtonDown(CancelMenu As Boolean)

'Cancels the default menu that is displayed when the expand button is pressed. 'The default button only displays the \More Buttons\and \Fewer

'Buttons\ CancelMenu = True

Dim Popup As CommandBar

Dim Control As CommandBarControl Dim SubControl As CommandBarControl Dim i As Long

Dim Item As ShortcutBarItem

'Add the icons from the ShortcutBar to the Commandbars to 'be used in the commandbar popup that will be created

CommandBars.Icons.AddIcons wndShortcutBar.Icons

'Creates a popup command bar we will use as the 'ShortcutBar's expand button popup menu

Set Popup = CommandBars.Add(\

'Adds buttons to the popup command bar, we will add a total 'of 9 commands With Popup

'Adds the \

Set Control = frmMain.AddButton(.Controls, xtpControlButton, _

SHORTCUT_SHOW_MORE, \Buttons\

'Enable this button if all buttons are not expanded

Control.Enabled = (wndShortcutBar.ExpandedLinesCount <> 9)

'Adds the \

Set Control = frmMain.AddButton(.Controls, xtpControlButton, _

SHORTCUT_SHOW_FEWER, \Buttons\

'Enable this button if there are 1 or more buttons expanded Control.Enabled = (wndShortcutBar.ExpandedLinesCount <> 1)

'Adds the \2003,

'this will do nothing in our sample AddButton .Controls, xtpControlButton,

SHORTCUT_NAVIGATE_PANE_OPTIONS, _

\Options...\

'Adds the \Buttons\ 'contain a button that corresponds to each item that is in the 'ShortcutBar. The buttons will allow you to hide\\show items 'in the ShortcutBar

Set Control = AddButton(.Controls, xtpControlButtonPopup, _ SHORTCUT_ADD_REMOVE_BUTTONS, \or Remove Buttons\

'Adds a button for each shortcutbar item to the '\

百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库codejock英文教程(6)在线全文阅读。

codejock英文教程(6).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印 下载失败或者文档不完整,请联系客服人员解决!
本文链接:https://www.77cn.com.cn/wenku/zonghe/478878.html(转载请注明文章来源)
上一篇:-信息提示
下一篇:教书育人 关爱学生
Copyright © 2008-2022 免费范文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ: 邮箱:tiandhx2@hotmail.com
苏ICP备16052595号-18
× 注册会员免费下载(下载后可以自由复制和排版)
注册会员下载
全站内容免费自由复制
注册会员下载
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: