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
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
'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
Applying the Office 2007 Theme Author: Mike Palmatier
Posted: May 3, 2008
Environment:Visual Basic 6.0
Applying the Office 2007 theme to the Calendar can be accomplished with only a few lines of code. You also have the option to change the base color used in the theme. By default the color will be the same color blue as used in Office 2007. Start by instantiating a CalendarThemeOffice2007 object. 'Create a new Office 2007 theme object
Dim customOffice2007 As New CalendarThemeOffice2007 Next you can optionally define the base color used in the Office 2007 theme. 'set the base color for the Office 2007 theme to use 'This will give a default \ customOffice2007.BaseColor = RGB(22, 22, 22) Now apply the new Office 2007 theme to the Calendar.
'Apply the Office 2007 theme to the Calendar CalendarControl.SetTheme customOffice2007
Adding Drag and Drop Support Author: Mike Palmatier Posted: May 3, 2008
Environment:Visual Basic 6.0 Downloads:
DragandDropSample.zip - Source Files with Demo Project [4 KB]
To enable drag and drop in a report control only a single line of code is needed. The EnableDragDrop method enables drag and drop for a report control. You must use EnableDragDrop for each report control that will use drag and drop. The report control will handle everything else for you as long as you are dragging a row between report controls.
Use the EnableDragDrop method to enable drag and drop support for each report control that will use drag and drop. You need to use flags from the XTPReportDragDrop enumeration to specify which drag and drop operations that the report control will support. This is all you need to drag and drop rows between report controls. All data handling is handled internally.
Dim cfRecords As Integer
'Below, the clipboard string is \and we are allowing all drag and drop operations
cfRecords = wndReport.EnableDragDrop(\xtpReportAllowDrag Or xtpReportAllowDrop)
If you need to drag and drop between a report control and another control\\object that is not a report control a few more steps are required and you will need to do the data handling yourself. The sample below illustrates dragging item between a report control and a list control. Basically all you need to do is set up the OLE events of the list control so you can format the data into the correct format for the report control and list control. The report control also has BeginDrag and DropRecords events.
Below is the code used to implement drag and drop to\\from a report control and a list control:
Option Explicit
'An integer value that will be used to indicate whether an item in the DataObject object matches the
'specified ClipboardString(Parameter in EnableDrageDrop) format. The DataObject is a parameter in OLEDrag events for controls 'that contains the data on the clipboard. Dim cfRecords As Integer
Private Sub Form_Load()
'Adds 3 items to the List Control lstItems.AddItem \ lstItems.AddItem \ lstItems.AddItem \
'Do not allow columns to be removed from the Report Control wndReport.AllowColumnRemove = False
'Add a column named \ wndReport.Columns.Add 0, \True
Dim str As String, i As Long
'Add 4 records\\rows to the Report Control For i = 4 To 8
Dim Record As ReportRecord Dim Item As ReportRecordItem
Set Record = wndReport.Records.Add
str = \CStr(i)
Set Item = Record.AddItem(str) Next i
'Adds the records the Report Control wndReport.Populate
'To enable Drag and Drop in a Report Control the EnableDragDrop method must be used. EnableDragDrop
'does two things, first it sets a clipboard string that will be used to indicate the type of data
'that is copied to the clipboard. Second, it sets the drag and drop effects that are allowed when
'dragging items to\\from the report control. The available effects are stored in the XTPReportDragDrop
'enumeration. If dragging items to\\from one or more Report Control's , the same clipboard string must
'be used for all Report Control's when calling EnableDragDrop. '
'Below, the clipboard string is \and we are allowing all drag and drop operations
cfRecords = wndReport.EnableDragDrop(\xtpReportAllowDrag Or xtpReportAllowDrop) End Sub
Sub ClearListSelection() Dim i As Long
For i = 0 To lstItems.ListCount - 1 lstItems.Selected(i) = False Next End Sub
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库codejock英文教程(7)在线全文阅读。
相关推荐: