Office 2007 menu
Posted: Mon Jul 03, 2006 6:15 am
Is there someone who knows how to make an Office 2007 menu with FW?
Regards
Otto
Regards
Otto
www.FiveTechSoft.com
http://forums.fivetechsoft.com/
Code: Select all
VERSION 5.00
Object = "{555E8FCC-830E-45CC-AF00-A012D5AE7451}#10.2#0"; "CommandBars.ocx"
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
Begin VB.Form frmMain
Caption = "RibbonBar Sample"
ClientHeight = 8265
ClientLeft = 60
ClientTop = 345
ClientWidth = 14400
LinkTopic = "Form1"
ScaleHeight = 8265
ScaleWidth = 14400
StartUpPosition = 3 'Windows Default
Begin RichTextLib.RichTextBox txtClient
Height = 3975
Left = 3960
TabIndex = 0
Top = 840
Width = 7575
_ExtentX = 13361
_ExtentY = 7011
_Version = 393217
BorderStyle = 0
TextRTF = $"frmMain.frx":0000
End
Begin XtremeCommandBars.CommandBars CommandBars
Left = 240
Top = 120
_Version = 655362
_ExtentX = 635
_ExtentY = 635
_StockProps = 0
VisualTheme = 5
End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim SkinFramework As Object
Dim bShowTableContextTabs As Boolean
Dim bShowChartContextTabs As Boolean
Private Function RibbonBar() As RibbonBar
Set RibbonBar = CommandBars.ActiveMenuBar
End Function
Private Function AddButton(Controls As CommandBarControls, ControlType As XTPControlType, Id As Long, Caption As String, Optional BeginGroup As Boolean = False, Optional DescriptionText As String = "", Optional ButtonStyle As XTPButtonStyle = xtpButtonAutomatic, Optional Category As String = "Controls") As CommandBarControl
Dim Control As CommandBarControl
Set Control = Controls.Add(ControlType, Id, Caption)
Control.BeginGroup = BeginGroup
Control.DescriptionText = DescriptionText
Control.Style = ButtonStyle
Control.Category = Category
Set AddButton = Control
End Function
Private Sub CommandBars_Customization(ByVal Options As XtremeCommandBars.ICustomizeOptions)
Options.ShowRibbonQuickAccessPage = True
Dim Controls As CommandBarControls
Set Controls = CommandBars.DesignerControls
If (Controls.Count = 0) Then
AddButton Controls, xtpControlButton, ID_FILE_NEW, "&New", False, "Create a new document", xtpButtonAutomatic, "File"
AddButton Controls, xtpControlButton, ID_FILE_OPEN, "&Open", False, "Open an existing document", xtpButtonAutomatic, "File"
AddButton Controls, xtpControlButton, ID_FILE_SAVE, "&Save", False, "Save the active document", xtpButtonAutomatic, "File"
AddButton Controls, xtpControlButton, ID_FILE_PRINT, "&Print", False, "Print the active document", xtpButtonAutomatic, "File"
AddButton Controls, xtpControlButton, ID_FILE_PRINT_SETUP, "Print Set&up", False, "Print Setup", xtpButtonAutomatic, "File"
AddButton Controls, xtpControlButton, ID_EDIT_CUT, "Cu&t", False, "Cut the selection and put it on the Clipboard", xtpButtonAutomatic, "Edit"
AddButton Controls, xtpControlButton, ID_EDIT_COPY, "&Copy", False, "Copy the selection and put it on the Clipboard", xtpButtonAutomatic, "Edit"
AddButton Controls, xtpControlButton, ID_EDIT_PASTE, "&Paste", False, "Insert Clipboard contents", xtpButtonAutomatic, "Edit"
AddButton Controls, xtpControlButton, ID_CHAR_BOLD, "Bold", False, "", xtpButtonAutomatic, "Format"
AddButton Controls, xtpControlButton, ID_CHAR_ITALIC, "Italic", False, "", xtpButtonAutomatic, "Format"
AddButton Controls, xtpControlButton, ID_CHAR_UNDERLINE, "Underline", False, "", xtpButtonAutomatic, "Format"
AddButton Controls, xtpControlButton, ID_PARA_LEFT, "Align Left", False, "", xtpButtonAutomatic, "Format"
AddButton Controls, xtpControlButton, ID_PARA_CENTER, "Center", False, "", xtpButtonAutomatic, "Format"
AddButton Controls, xtpControlButton, ID_PARA_RIGHT, "Align Right", False, "", xtpButtonAutomatic, "Format"
AddButton Controls, xtpControlButton, ID_APP_ABOUT, "About", False, "", xtpButtonAutomatic, "Help"
End If
End Sub
Private Sub CommandBars_Execute(ByVal Control As XtremeCommandBars.ICommandBarControl)
On Error Resume Next
Select Case Control.Id
Case XTP_ID_RIBBONCUSTOMIZE:
CommandBars.ShowCustomizeDialog 3
Case ID_APP_ABOUT:
MsgBox "Version " & App.Major & "." & App.Minor
Case ID_THEME_OFFICE2003:
CommandBars.VisualTheme = xtpThemeOffice2003
If Not SkinFramework Is Nothing Then
SkinFramework.LoadSkin "", ""
End If
CommandBars.ToolTipContext.Style = xtpToolTipLuna
Case ID_THEME_OFFICE2007:
CommandBars.VisualTheme = xtpThemeOffice2007
If Not SkinFramework Is Nothing Then
SkinFramework.LoadSkin App.Path & "..\..\..\..\SkinFramework\Styles\Office2007.cjstyles", ""
End If
CommandBars.ToolTipContext.Style = xtpToolTipOffice2007
Case ID_CHAR_BOLD: txtClient.SelBold = Not txtClient.SelBold
Case ID_CHAR_ITALIC: txtClient.SelItalic = Not txtClient.SelItalic
Case ID_CHAR_UNDERLINE: txtClient.SelUnderline = Not txtClient.SelUnderline
Case ID_PARA_LEFT: txtClient.SelAlignment = rtfLeft
Case ID_PARA_CENTER: txtClient.SelAlignment = rtfCenter
Case ID_PARA_RIGHT: txtClient.SelAlignment = rtfRight
Case ID_EDIT_CUT:
Clipboard.SetText txtClient.SelRTF
txtClient.SelText = vbNullString
Case ID_EDIT_COPY: Clipboard.SetText txtClient.SelRTF
Case ID_EDIT_PASTE: txtClient.SelRTF = Clipboard.GetText
Case ID_EDIT_CUT:
Clipboard.SetText txtClient.SelRTF
txtClient.SelText = vbNullString
Case ID_EDIT_COPY: Clipboard.SetText txtClient.SelRTF
Case ID_EDIT_PASTE: txtClient.SelRTF = Clipboard.GetText
Case ID_APP_EXIT:
Unload Me
Case ID_VIEW_RULER To ID_VIEW_ACTINBAR:
Control.Checked = Not Control.Checked
Case ID_ILLUSTRATION_CHART:
bShowChartContextTabs = Not bShowChartContextTabs
Case ID_TABLE_NEW, ID_TABLE_INSERTTABLE:
bShowTableContextTabs = Not bShowTableContextTabs
Case Else:
MsgBox Control.Caption & " clicked"
End Select
End Sub
Private Sub CommandBars_Resize()
On Error Resume Next
Dim Left As Long
Dim Top As Long
Dim Right As Long
Dim Bottom As Long
CommandBars.GetClientRect Left, Top, Right, Bottom
txtClient.Move Left + 400, Top + 400, Right - Left - 800, Bottom - Top - 800
End Sub
Private Sub Form_Paint()
On Error Resume Next
Dim Left As Long
Dim Top As Long
Dim Right As Long
Dim Bottom As Long
CommandBars.GetClientRect Left, Top, Right, Bottom
Dim pic As StdPicture
Set pic = LoadPicture(App.Path & "\res\ClientFace.bmp")
PaintPicture pic, 0, Top, Me.ScaleWidth, Me.ScaleHeight - Top
End Sub
Private Sub CommandBars_Update(ByVal Control As XtremeCommandBars.ICommandBarControl)
On Error Resume Next
Select Case Control.Id
Case ID_THEME_OFFICE2003:
Control.Checked = CommandBars.VisualTheme = xtpThemeOffice2003
Case ID_THEME_OFFICE2007:
Control.Checked = CommandBars.VisualTheme = xtpThemeOffice2007
Case ID_CHAR_BOLD: Control.Checked = txtClient.SelBold
Case ID_CHAR_ITALIC: Control.Checked = txtClient.SelItalic
Case ID_CHAR_UNDERLINE: Control.Checked = txtClient.SelUnderline
Case ID_PARA_LEFT: Control.Checked = txtClient.SelAlignment = rtfLeft
Case ID_PARA_CENTER: Control.Checked = txtClient.SelAlignment = rtfCenter
Case ID_PARA_RIGHT: Control.Checked = txtClient.SelAlignment = rtfRight
Case ID_EDIT_CUT: Control.Enabled = Not txtClient.SelLength = 0
Case ID_EDIT_COPY: Control.Enabled = Not txtClient.SelLength = 0
Case XTPCommandBarsSpecialCommands.XTP_ID_RIBBONCONTROLTAB:
Dim RibbonBar As RibbonBar
Set RibbonBar = CommandBars.ActiveMenuBar
RibbonBar.FindTab(ID_TAB_TABLEDESIGN).Visible = bShowTableContextTabs
RibbonBar.FindTab(ID_TAB_TABLELAYOUT).Visible = bShowTableContextTabs
RibbonBar.FindTab(ID_TAB_CHARTDESIGN).Visible = bShowChartContextTabs
RibbonBar.FindTab(ID_TAB_CHARTLAYOUT).Visible = bShowChartContextTabs
RibbonBar.FindTab(ID_TAB_CHARTFORMAT).Visible = bShowChartContextTabs
End Select
End Sub
Private Sub Form_Load()
CreateRibbonBar
'CrateSkinFramework
CommandBars.KeyBindings.Add FCONTROL, Asc("N"), ID_FILE_NEW
CommandBars.KeyBindings.Add FCONTROL, Asc("O"), ID_FILE_OPEN
CommandBars.KeyBindings.Add FCONTROL, Asc("S"), ID_FILE_SAVE
CommandBars.KeyBindings.Add FCONTROL, Asc("X"), ID_EDIT_CUT
CommandBars.KeyBindings.Add FCONTROL, Asc("C"), ID_EDIT_COPY
CommandBars.KeyBindings.Add FCONTROL, Asc("V"), ID_EDIT_PASTE
LoadIcons
Dim StatusBar As StatusBar
Set StatusBar = CommandBars.StatusBar
StatusBar.Visible = True
StatusBar.AddPane 0
StatusBar.AddPane ID_INDICATOR_CAPS
StatusBar.AddPane ID_INDICATOR_NUM
StatusBar.AddPane ID_INDICATOR_SCRL
RibbonBar.EnableFrameTheme
CommandBars.Options.KeyboardCuesShow = xtpKeyboardCuesShowWindowsDefault
bShowTableContextTabs = False
bShowChartContextTabs = False
CommandBars.EnableCustomization True
CommandBars.LoadCommandBars "Codejock Software ActiveX Demos", App.Title, "Layout"
End Sub
Private Sub LoadIcons()
CommandBars.Options.UseSharedImageList = False
CommandBars.Icons.LoadBitmap App.Path & "\res\GroupIcons.bmp", _
Array(ID_GROUP_CLIPBOARD, ID_GROUP_FONT, ID_GROUP_PARAGRAPH, ID_GROUP_FIND), xtpImageNormal
CommandBars.Icons.LoadBitmap App.Path & "\res\GroupParagraph.bmp", _
Array(ID_INSERT_BULLET, ID_INSERT_NUMBERING, ID_INSERT_LIST, _
ID_PARA_DECREASEINDENT, ID_PARA_INCREASEINDENT, ID_PARA_SORT, ID_PARA_SHOWMARKS, ID_PARA_LEFT, _
ID_PARA_CENTER, ID_PARA_RIGHT, ID_PARA_JUSTIFY, ID_PARA_LINESPACING, ID_PARA_SHADING, ID_BORDERS_NOBORDER), xtpImageNormal
CommandBars.Icons.LoadBitmap App.Path & "\res\GroupClipboard.bmp", _
Array(ID_EDIT_PASTE, ID_EDIT_CUT, ID_EDIT_COPY, ID_FORMAT_PAINTER), xtpImageNormal
CommandBars.Icons.LoadBitmap App.Path & "\res\GroupFont.bmp", _
Array(ID_FONT_GROW, ID_FONT_SHRINK, ID_FONT_CLEAR, ID_CHAR_BOLD, ID_CHAR_ITALIC, _
ID_CHAR_UNDERLINE, ID_CHAR_STRIKETHROUGH, ID_TEXT_SUBSCRIPT, ID_TEXT_SUPERSCRIPT, _
ID_TEXT_CHANGECASE, ID_TEXT_COLOR, ID_TEXT_HIGHLIGHTCOLOR), xtpImageNormal
CommandBars.Icons.LoadBitmap App.Path & "\res\GroupFind.bmp", _
Array(ID_EDIT_FIND, ID_EDIT_REPLACE, ID_EDIT_GOTO, ID_EDIT_SELECT), xtpImageNormal
CommandBars.Icons.LoadBitmap App.Path & "\res\InsertTab.bmp", _
Array(ID_PAGES_NEW, ID_PAGES_COVER, ID_PAGES_BREAK, ID_INSERT_HEADER, ID_INSERT_FOOTER, _
ID_INSERT_PAGENUMBER, ID_TEXT_PARTS, ID_TEXT_WORDART, ID_TEXT_DROPCAP, _
ID_ILLUSTRATION_GRAPHIC, ID_ILLUSTRATION_CLIPART, ID_ILLUSTRATION_CLIPART, _
ID_ILLUSTRATION_CHART, ID_INSERT_HYPERLINK, ID_INSERT_BOOKMARK, ID_INSERT_CROSS_REFERENCE, _
ID_TEXT_SIGNATURE, ID_TEXT_DATETIME, ID_TEXT_INSERTOBJECT), xtpImageNormal
CommandBars.Icons.LoadBitmap App.Path & "\res\SmallIcons.bmp", _
Array(ID_FILE_NEW, ID_FILE_OPEN, ID_FILE_SAVE, ID_EDIT_CUT, ID_EDIT_COPY, ID_EDIT_PASTE, _
ID_FILE_PRINT, ID_APP_ABOUT), xtpImageNormal
CommandBars.Icons.LoadBitmap App.Path & "\res\LargeIcons.bmp", _
Array(ID_EDIT_PASTE, ID_EDIT_FIND, ID_PAGES_NEW, ID_PAGES_COVER, ID_PAGES_BREAK, ID_TABLE_NEW, _
ID_ILLUSTRATION_PICTURE, ID_ILLUSTRATION_GRAPHIC, ID_ILLUSTRATION_CHART, ID_INSERT_HEADER, _
ID_INSERT_FOOTER, ID_INSERT_PAGENUMBER, ID_TEXT_TEXTBOX, ID_TEXT_PARTS, ID_TEXT_WORDART, _
ID_TEXT_DROPCAP, ID_SYMBOL_EQUATIONS, ID_SYMBOL_SYMBOL), xtpImageNormal
CommandBars.Icons.LoadBitmap App.Path & "\res\LayoutTabLarge.bmp", _
Array(ID_THEMES_THEMES, ID_PAGE_MARGINS, ID_PAGE_ORIENTATION, ID_PAGE_SIZE, _
ID_PAGE_COLUMNS, ID_PAGE_WATERMARK, ID_PAGE_COLOR, ID_PAGE_BORDERS, _
ID_ARRANGE_POSITION, ID_ARRANGE_TEXTWRAPPING), xtpImageNormal
CommandBars.Icons.LoadBitmap App.Path & "\res\LayoutTab.bmp", _
Array(ID_THEMES_COLORS, ID_THEMES_FONTS, ID_THEMES_EFFECTS, _
ID_PAGE_ORIENTATION, ID_PAGE_SIZE, ID_PAGE_COLUMNS, _
ID_PAGE_BREAKS, ID_PAGE_LINENUMBERS, ID_PAGE_HYPHENATATION, ID_PAGE_WATERMARK, _
ID_PAGE_COLOR, ID_PAGE_BORDERS, ID_ARRANGE_FRONT, ID_ARRANGE_BACK, ID_ARRANGE_ALIGN, _
ID_ARRANGE_GROUP, ID_ARRANGE_UNGROUP, ID_ARRANGE_ROTATE), xtpImageNormal
CommandBars.Icons.LoadBitmap App.Path & "\res\shiny-gear.bmp", ID_SYSTEM_ICON, xtpImageNormal
CommandBars.Icons.LoadIcon App.Path & "\res\GroupPopup.ico", ID_GROUP_POPUPICON, xtpImageNormal
Dim ToolTipContext As ToolTipContext
Set ToolTipContext = CommandBars.ToolTipContext
ToolTipContext.Style = xtpToolTipOffice2007
ToolTipContext.ShowTitleAndDescription True, xtpToolTipIconNone
ToolTipContext.SetMargin 2, 2, 2, 2
ToolTipContext.MaxTipWidth = 180
End Sub
Private Sub CreateRibbonBar()
Dim TabWrite As RibbonTab, TabInsert As RibbonTab, TabPageLayout As RibbonTab, TabView As RibbonTab
Dim GroupClipborad As RibbonGroup, GroupFont As RibbonGroup, GroupParagraph As RibbonGroup, GroupFormatting As RibbonGroup
Dim GroupFind As RibbonGroup, GroupPages As RibbonGroup, GroupTable As RibbonGroup, GroupIllustrations As RibbonGroup
Dim GroupLinks As RibbonGroup, GroupHeader As RibbonGroup, GroupText As RibbonGroup, GroupSymbols As RibbonGroup
Dim ViewGroup As RibbonGroup, TableTabs As RibbonTab, ChartTabs As RibbonTab, TabReview As RibbonTab
Dim ControlPaste As CommandBarPopup, Control As CommandBarControl
Dim ControlSelect As CommandBarPopup
Dim ControlPicture As CommandBarPopup
Dim ControlNew As CommandBarPopup
Dim ControlCover As CommandBarPopup
Dim ControlPageNumber As CommandBarPopup
Dim ControlEquations As CommandBarPopup
Dim ControlTable As CommandBarPopup
Dim ControlDocumentParts As CommandBarPopup
Dim ControlTextBox As CommandBarPopup
Dim ControlPopup As CommandBarPopup
Dim RibbonBar As RibbonBar
Set RibbonBar = CommandBars.AddRibbonBar("The Ribbon")
RibbonBar.EnableDocking xtpFlagStretched
Dim ControlFile As CommandBarPopup, ControlTheme As CommandBarPopup, ControlAbout As CommandBarControl
Set ControlFile = RibbonBar.AddSystemButton()
ControlFile.IconId = ID_SYSTEM_ICON
With ControlFile.CommandBar.Controls
.Add xtpControlButton, ID_FILE_NEW, "&New"
.Add xtpControlButton, ID_FILE_OPEN, "&Open..."
.Add xtpControlButton, ID_FILE_SAVE, "&Save"
.Add xtpControlButton, ID_FILE_SAVE_AS, "Save &As..."
Set Control = .Add(xtpControlButton, ID_FILE_PRINT, "&Print")
Control.BeginGroup = True
.Add xtpControlButton, ID_FILE_PRINT_PREVIEW, "Print Pre&view"
.Add xtpControlButton, ID_FILE_PRINT_SETUP, "Pr&int Setup..."
Set Control = .Add(xtpControlButton, ID_FILE_MRU_FILE1, "Recent File")
Control.BeginGroup = True
Control.Enabled = False
Set Control = .Add(xtpControlButton, ID_APP_EXIT, "E&xit")
Control.BeginGroup = True
End With
Set ControlAbout = RibbonBar.Controls.Add(xtpControlButton, ID_APP_ABOUT, "&About")
ControlAbout.Flags = xtpFlagRightAlign
Set TabWrite = RibbonBar.InsertTab(0, "Writ&e")
TabWrite.Id = ID_TAB_WRITE
Set GroupClipborad = TabWrite.Groups.AddGroup("&Clipboard", ID_GROUP_CLIPBOARD)
Set ControlPaste = GroupClipborad.Add(xtpControlSplitButtonPopup, ID_EDIT_PASTE, "&Paste")
ControlPaste.CommandBar.Controls.Add xtpControlButton, ID_EDIT_PASTE, "&Paste"
ControlPaste.CommandBar.Controls.Add xtpControlButton, ID_EDIT_PASTE_SPECIAL, "&Paste Special"
GroupClipborad.Add xtpControlButton, ID_EDIT_CUT, "&Cut"
GroupClipborad.Add xtpControlButton, ID_EDIT_COPY, "&Copy"
Set Control = GroupClipborad.Add(xtpControlButton, ID_FORMAT_PAINTER, "Format Painter")
Control.Enabled = False
GroupClipborad.ShowOptionButton = True
GroupClipborad.ControlGroupOption.ToolTipText = "Show clipboard dialog"
GroupClipborad.IconId = ID_EDIT_PASTE
Set GroupFont = TabWrite.Groups.AddGroup("&Font", ID_GROUP_FONT)
GroupFont.ControlsGrouping = True
Dim Combo As CommandBarComboBox
Set Combo = GroupFont.Add(xtpControlComboBox, ID_FONT_FACE, "")
Combo.DropDownListStyle = True
Combo.Width = 130
Combo.Text = "Tahoma"
Set Combo = GroupFont.Add(xtpControlComboBox, ID_FONT_SIZE, "")
Combo.DropDownListStyle = True
Combo.Width = 50
Combo.Text = "10"
Set Control = GroupFont.Add(xtpControlButton, ID_FONT_GROW, "Grow Font")
Control.BeginGroup = True
GroupFont.Add xtpControlButton, ID_FONT_SHRINK, "Shrink Font"
Set Control = GroupFont.Add(xtpControlButton, ID_FONT_CLEAR, "Clear Formatting")
Control.BeginGroup = True
Set Control = GroupFont.Add(xtpControlButton, ID_CHAR_BOLD, "&Bold")
Control.BeginGroup = True
GroupFont.Add xtpControlButton, ID_CHAR_ITALIC, "&Italic"
GroupFont.Add xtpControlButtonPopup, ID_CHAR_UNDERLINE, "&Underline"
GroupFont.Add xtpControlButton, ID_CHAR_STRIKETHROUGH, "&Strikethrough"
Set Control = GroupFont.Add(xtpControlButton, ID_TEXT_SUBSCRIPT, "Subscript")
Control.BeginGroup = True
Control.Enabled = False
Set Control = GroupFont.Add(xtpControlButton, ID_TEXT_SUBSCRIPT, "Subscript")
Control.Enabled = False
Set Control = GroupFont.Add(xtpControlButtonPopup, ID_TEXT_SUPERSCRIPT, "Superscript")
Control.Enabled = False
Set Control = GroupFont.Add(xtpControlPopup, ID_TEXT_CHANGECASE, "Change Case")
Control.Style = xtpButtonIcon
Set Control = GroupFont.Add(xtpControlPopup, ID_TEXT_COLOR, "Color")
Control.BeginGroup = True
Control.Style = xtpButtonIcon
Set Control = GroupFont.Add(xtpControlPopup, ID_TEXT_HIGHLIGHTCOLOR, "Highlight Color")
Control.Style = xtpButtonIcon
GroupFont.ShowOptionButton = True
GroupFont.ControlGroupOption.ToolTipText = "Show font dialog"
Set GroupParagraph = TabWrite.Groups.AddGroup("&Paragraph", ID_GROUP_PARAGRAPH)
GroupParagraph.ControlsGrouping = True
GroupParagraph.Add xtpControlSplitButtonPopup, ID_INSERT_BULLET, "Bullet"
GroupParagraph.Add xtpControlSplitButtonPopup, ID_INSERT_NUMBERING, "Numbering"
GroupParagraph.Add xtpControlSplitButtonPopup, ID_INSERT_LIST, "List"
Set Control = GroupParagraph.Add(xtpControlButton, ID_PARA_DECREASEINDENT, "Decrease Indent")
Control.BeginGroup = True
GroupParagraph.Add xtpControlButton, ID_PARA_INCREASEINDENT, "Increase Indent"
Set Control = GroupParagraph.Add(xtpControlButton, ID_PARA_SORT, "Sort")
Control.BeginGroup = True
Set Control = GroupParagraph.Add(xtpControlButton, ID_PARA_SHOWMARKS, "Show/Hide Marks")
Control.BeginGroup = True
Set Control = GroupParagraph.Add(xtpControlButton, ID_PARA_LEFT, "&Left")
Control.BeginGroup = True
GroupParagraph.Add xtpControlButton, ID_PARA_CENTER, "&Center"
GroupParagraph.Add xtpControlButton, ID_PARA_RIGHT, "&Right"
GroupParagraph.Add xtpControlButton, ID_PARA_JUSTIFY, "&Justify"
Set Control = GroupParagraph.Add(xtpControlButtonPopup, ID_PARA_LINESPACING, "Line Spaceing")
Control.BeginGroup = True
Set Control = GroupParagraph.Add(xtpControlSplitButtonPopup, ID_PARA_SHADING, "Shading")
Control.BeginGroup = True
Set Control = GroupParagraph.Add(xtpControlSplitButtonPopup, ID_BORDERS_NOBORDER, "No Border")
Control.BeginGroup = True
GroupParagraph.ShowOptionButton = True
Set GroupFind = TabWrite.Groups.AddGroup("&Find", ID_GROUP_FIND)
GroupFind.Add xtpControlButton, ID_EDIT_FIND, "&Find"
GroupFind.Add xtpControlButton, ID_EDIT_REPLACE, "&Replace"
GroupFind.Add xtpControlButton, ID_EDIT_GOTO, "&Goto"
Set ControlSelect = GroupFind.Add(xtpControlPopup, ID_EDIT_SELECT, "&Select")
ControlSelect.CommandBar.Controls.Add xtpControlButton, ID_EDIT_SELECT_ALL, "&Select All"
Set Control = ControlSelect.CommandBar.Controls.Add(xtpControlButton, ID_EDIT_SELECT_OBJECTS, "&Select Objects")
Control.Enabled = False
Set Control = ControlSelect.CommandBar.Controls.Add(xtpControlButton, ID_EDIT_SELECT_MULTIPLE_OBJECTS, "Select Multiple Objects")
Control.Enabled = False
Set TabInsert = RibbonBar.InsertTab(1, "&Insert")
TabInsert.Id = ID_TAB_INSERT
Set GroupPages = TabInsert.Groups.AddGroup("&Pages", 0)
Set ControlNew = GroupPages.Add(xtpControlSplitButtonPopup, ID_PAGES_NEW, "&New Page")
ControlNew.CommandBar.Controls.Add xtpControlButton, ID_NEWPAGE_BLANKPAGE, "&Blank Page"
ControlNew.CommandBar.Controls.Add xtpControlButton, ID_NEWPAGE_SELECTION, "&Save Selection as New Page"
Set ControlCover = GroupPages.Add(xtpControlSplitButtonPopup, ID_PAGES_COVER, "Cover Page")
ControlCover.DescriptionText = "Insert a fully-formatted cover page. You fill in the title, author, date, and other information."
ControlCover.CommandBar.Controls.Add xtpControlButton, ID_COVERPAGE_REMOVECURRENTCOVERPAGE, "&Remove Current Cover Page"
ControlCover.CommandBar.Controls.Add xtpControlButton, ID_COVERPAGE_SAVESELECTIONASNEWCOVERPAGE, "&Save Selectio as New Cover Page"
GroupPages.Add xtpControlButton, ID_PAGES_BREAK, "Page Break"
Set GroupTable = TabInsert.Groups.AddGroup("&Table", 0)
Set ControlTable = GroupTable.Add(xtpControlButtonPopup, ID_TABLE_NEW, "&Table")
ControlTable.CommandBar.Controls.Add xtpControlButton, ID_TABLE_INSERTTABLE, "&Insert Table.."
ControlTable.CommandBar.Controls.Add xtpControlButton, ID_TABLE_DRAWTABLE, "Dra&w Table"
ControlTable.CommandBar.Controls.Add xtpControlButton, ID_TABLE_CONVERTTEXTTOTABLE, "Con&vert Text to Table..."
Set GroupIllustrations = TabInsert.Groups.AddGroup("&Illustrations", 0)
Set ControlPicture = GroupIllustrations.Add(xtpControlSplitButtonPopup, ID_ILLUSTRATION_PICTURE, "&Picture")
ControlPicture.CommandBar.Controls.Add xtpControlButton, ID_ILLUSTRATION_PICTURE, "&Picture..."
ControlPicture.CommandBar.Controls.Add xtpControlButton, ID_ILLUSTRATION_CLIPART, "&Clip Art..."
ControlPicture.CommandBar.Controls.Add xtpControlButton, ID_ILLUSTRATION_FROMCAMERA, "From &Scanner or Camera..."
GroupIllustrations.Add xtpControlButton, ID_ILLUSTRATION_GRAPHIC, "Graphic"
GroupIllustrations.Add xtpControlButton, ID_ILLUSTRATION_CHART, "&Chart"
Set GroupLinks = TabInsert.Groups.AddGroup("&Links", 0)
GroupLinks.Add xtpControlButton, ID_INSERT_HYPERLINK, "Hyperlink"
GroupLinks.Add xtpControlButton, ID_INSERT_BOOKMARK, "&Bookmark"
GroupLinks.Add xtpControlButton, ID_INSERT_CROSS_REFERENCE, "Cross-reference"
Set GroupHeader = TabInsert.Groups.AddGroup("&Header && Footer", ID_GROUP_HEADERANDFOOTER)
GroupHeader.ShowOptionButton = True
Set ControlPopup = GroupHeader.Add(xtpControlButtonPopup, ID_INSERT_HEADER, "Header")
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 1"
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 2"
Set ControlPopup = GroupHeader.Add(xtpControlButtonPopup, ID_INSERT_FOOTER, "Footer")
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 1"
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 2"
Set ControlPageNumber = GroupHeader.Add(xtpControlButtonPopup, ID_INSERT_PAGENUMBER, "Page Number")
ControlPageNumber.CommandBar.Controls.Add xtpControlButton, ID_PAGENUMBER_FORMATPAGENUMBERS, "&Format Page Numbers"
ControlPageNumber.CommandBar.Controls.Add xtpControlButton, ID_PAGENUMBER_REMOVEPAGENUMBERS, "&Remove Page Numbers"
Set GroupText = TabInsert.Groups.AddGroup("&Text", 0)
GroupText.IconId = ID_GROUP_POPUPICON
Set ControlTextBox = GroupText.Add(xtpControlButtonPopup, ID_TEXT_TEXTBOX, "Text Box")
ControlTextBox.CommandBar.Controls.Add xtpControlButton, ID_TEXTBOX_DRAWTEXTBOX, "&Draw Text Box"
ControlTextBox.CommandBar.Controls.Add xtpControlButton, ID_TEXTBOX_SAVESELECTIONASNEWTEXTBOX, "&Save Selection as New Text Box"
Set ControlDocumentParts = GroupText.Add(xtpControlSplitButtonPopup, ID_TEXT_PARTS, "Document Parts")
ControlDocumentParts.CommandBar.Controls.Add xtpControlButton, ID_DOCUMENTPARTS_AUTOTEXT, "AutoText"
ControlDocumentParts.CommandBar.Controls.Add xtpControlButton, ID_DOCUMENTPARTS_PROPERTY, "Property"
ControlDocumentParts.CommandBar.Controls.Add xtpControlButton, ID_DOCUMENTPARTS_FIELD, "Field..."
ControlDocumentParts.CommandBar.Controls.Add xtpControlButton, ID_DOCUMENTPARTS_BUILDINGBLOCKORGANIZER, "Building Block Organizer"
Set ControlPopup = GroupText.Add(xtpControlButtonPopup, ID_TEXT_WORDART, "Wordart")
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 1"
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 2"
Set ControlPopup = GroupText.Add(xtpControlButtonPopup, ID_TEXT_DROPCAP, "Drop Cap")
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 1"
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 2"
Set ControlPopup = GroupText.Add(xtpControlSplitButtonPopup, ID_TEXT_SIGNATURE, "Signature Line")
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 1"
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 2"
GroupText.Add xtpControlButton, ID_TEXT_DATETIME, "Date && Time"
Set ControlPopup = GroupText.Add(xtpControlPopup, ID_TEXT_INSERTOBJECT, "Insert Object")
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 1"
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 2"
Set GroupSymbols = TabInsert.Groups.AddGroup("&Symbols", 0)
GroupSymbols.IconId = ID_GROUP_POPUPICON
Set ControlEquations = GroupSymbols.Add(xtpControlButtonPopup, ID_SYMBOL_EQUATIONS, "Equations")
ControlEquations.CommandBar.Controls.Add xtpControlButton, ID_EQUATIONS_MATH, "&Math"
Set ControlPopup = GroupSymbols.Add(xtpControlButtonPopup, ID_SYMBOL_SYMBOL, "Symbol")
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 1"
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 2"
Set TabPageLayout = RibbonBar.InsertTab(2, "&Page Layout")
TabPageLayout.Id = ID_TAB_PAGELAYOUT
Dim GroupThemes As RibbonGroup, GroupPageSetup As RibbonGroup, GroupPageBackground As RibbonGroup
Dim GroupArrange As RibbonGroup
Set GroupThemes = TabPageLayout.Groups.AddGroup("Themes", 0)
Set ControlPopup = GroupThemes.Add(xtpControlSplitButtonPopup, ID_THEMES_THEMES, "Themes")
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 1"
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 2"
Set ControlPopup = GroupThemes.Add(xtpControlPopup, ID_THEMES_COLORS, "Colors")
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 1"
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 2"
Set ControlPopup = GroupThemes.Add(xtpControlPopup, ID_THEMES_FONTS, "Fonts")
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 1"
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 2"
Set ControlPopup = GroupThemes.Add(xtpControlPopup, ID_THEMES_EFFECTS, "Effects")
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 1"
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 2"
Set GroupPageSetup = TabPageLayout.Groups.AddGroup("Page Setup", 0)
Set ControlPopup = GroupPageSetup.Add(xtpControlPopup, ID_PAGE_MARGINS, "Margins")
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 1"
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 2"
Set ControlPopup = GroupPageSetup.Add(xtpControlPopup, ID_PAGE_ORIENTATION, "Orientation")
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 1"
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 2"
Set ControlPopup = GroupPageSetup.Add(xtpControlPopup, ID_PAGE_SIZE, "Size")
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 1"
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 2"
Set ControlPopup = GroupPageSetup.Add(xtpControlPopup, ID_PAGE_COLUMNS, "Columns")
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 1"
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 2"
Set ControlPopup = GroupPageSetup.Add(xtpControlPopup, ID_PAGE_BREAKS, "Breaks")
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 1"
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 2"
Set ControlPopup = GroupPageSetup.Add(xtpControlPopup, ID_PAGE_LINENUMBERS, "Line Numbers")
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 1"
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 2"
Set ControlPopup = GroupPageSetup.Add(xtpControlPopup, ID_PAGE_HYPHENATATION, "Hyphenatation")
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 1"
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 2"
Set GroupPageBackground = TabPageLayout.Groups.AddGroup("Page Background", 0)
Set ControlPopup = GroupPageBackground.Add(xtpControlPopup, ID_PAGE_WATERMARK, "Watermark")
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 1"
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 2"
Set ControlPopup = GroupPageBackground.Add(xtpControlPopup, ID_PAGE_COLOR, "Color")
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 1"
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 2"
GroupPageBackground.Add xtpControlButton, ID_PAGE_BORDERS, "Borders and Shading"
Set GroupArrange = TabPageLayout.Groups.AddGroup("Arrange", 0)
Set ControlPopup = GroupArrange.Add(xtpControlPopup, ID_ARRANGE_POSITION, "Position")
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 1"
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 2"
Set ControlPopup = GroupArrange.Add(xtpControlPopup, ID_ARRANGE_TEXTWRAPPING, "Text Wrapping")
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 1"
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 2"
Set ControlPopup = GroupArrange.Add(xtpControlPopup, ID_ARRANGE_FRONT, "Bring to Front")
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 1"
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 2"
Set ControlPopup = GroupArrange.Add(xtpControlPopup, ID_ARRANGE_BACK, "Send to Back")
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 1"
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 2"
Set ControlPopup = GroupArrange.Add(xtpControlPopup, ID_ARRANGE_ALIGN, "Align")
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 1"
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 2"
Set ControlPopup = GroupArrange.Add(xtpControlPopup, ID_ARRANGE_GROUP, "Group")
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 1"
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 2"
GroupArrange.Add xtpControlButton, ID_ARRANGE_UNGROUP, "Ungroup"
Set ControlPopup = GroupArrange.Add(xtpControlPopup, ID_ARRANGE_ROTATE, "Rotate")
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 1"
ControlPopup.CommandBar.Controls.Add xtpControlButton, ID_SAMPLE_MENU_ITEM, "Item 2"
RibbonBar.InsertTab 3, "&References"
RibbonBar.InsertTab 4, "&Mailings"
Set TabReview = RibbonBar.InsertTab(5, "&Review")
TabReview.Color = xtpRibbonTabContextColorPurple
TabReview.Id = ID_TAB_REVIEW
Set TabView = RibbonBar.InsertTab(6, "&View")
TabView.Id = ID_TAB_VIEW
Set ViewGroup = TabView.Groups.AddGroup("&Show/Hide", ID_GROUP_SHOWHIDE)
ViewGroup.Add xtpControlCheckBox, ID_VIEW_RULER, "Ruler"
ViewGroup.Add xtpControlCheckBox, ID_VIEW_GRIDLINES, "GridLines"
ViewGroup.Add xtpControlCheckBox, ID_VIEW_PROPERTIES, "Properties"
ViewGroup.Add xtpControlCheckBox, ID_VIEW_DOCUMENTMAP, "Document Map"
ViewGroup.Add xtpControlCheckBox, ID_VIEW_THUMBNAILS, "Thumbnails"
ViewGroup.Add xtpControlCheckBox, ID_VIEW_ACTINBAR, "Document Action Bar"
Set TableTabs = RibbonBar.InsertTab(7, "&Design")
TableTabs.Id = ID_TAB_TABLEDESIGN
TableTabs.ContextCaption = "Table Tools"
TableTabs.Color = xtpRibbonTabContextColorOrange
Set TableTabs = RibbonBar.InsertTab(8, "&Layout")
TableTabs.Id = ID_TAB_TABLELAYOUT
TableTabs.ContextCaption = "Table Tools"
TableTabs.Color = xtpRibbonTabContextColorOrange
Set TableTabs = RibbonBar.InsertTab(9, "&Design")
TableTabs.ContextCaption = "Chart Tools"
TableTabs.Id = ID_TAB_CHARTDESIGN
TableTabs.Color = xtpRibbonTabContextColorGreen
Set TableTabs = RibbonBar.InsertTab(10, "&Layout")
TableTabs.ContextCaption = "Chart Tools"
TableTabs.Id = ID_TAB_CHARTLAYOUT
TableTabs.Color = xtpRibbonTabContextColorGreen
Set TableTabs = RibbonBar.InsertTab(11, "&Format")
TableTabs.ContextCaption = "Chart Tools"
TableTabs.Id = ID_TAB_CHARTFORMAT
TableTabs.Color = xtpRibbonTabContextColorGreen
RibbonBar.QuickAccessControls.Add xtpControlButton, ID_FILE_NEW, "&New"
RibbonBar.QuickAccessControls.Add xtpControlButton, ID_EDIT_COPY, "&Copy"
RibbonBar.QuickAccessControls.Add xtpControlButton, ID_FILE_PRINT, "&Print"
End Sub
Private Sub CrateSkinFramework()
On Error GoTo lblExit
Set SkinFramework = CreateObject("Codejock.SkinFramework." & XtremeCommandBars.Version)
SkinFramework.ApplyWindow Me.hWnd
SkinFramework.LoadSkin App.Path & "..\..\..\..\SkinFramework\Styles\Office2007.cjstyles", ""
lblExit:
End Sub
Private Sub Form_Unload(Cancel As Integer)
If Not SkinFramework Is Nothing Then
SkinFramework.LoadSkin "", ""
Set SkinFramework = Nothing
End If
CommandBars.SaveCommandBars "Codejock Software ActiveX Demos", App.Title, "Layout"
End Sub
Private Sub txtClient_MouseUp(Button As Integer, Shift As Integer, x As Single, Y As Single)
If (Button = 2) Then
ZOrder
Dim Popup As CommandBar
Dim Control As CommandBarControl
Set Popup = CommandBars.Add("Popup", xtpBarPopup)
With Popup.Controls
.Add xtpControlButton, ID_EDIT_CUT, "Cu&t", -1, False
.Add xtpControlButton, ID_EDIT_COPY, "&Copy", -1, False
.Add xtpControlButton, ID_EDIT_PASTE, "&Paste", -1, False
Set Control = .Add(xtpControlButton, ID_CONTEXT_FONT, "&Font...", -1, False)
Control.BeginGroup = True
Set Control = .Add(xtpControlButton, ID_PARA_PARAGRAPH, "&Paragraph...", -1, False)
Control.BeginGroup = True
.Add xtpControlButton, ID_INSERT_BULLET, "Bullets", -1, False
End With
Popup.ShowPopup
End If
End Sub