[存档] Xtreme Suite 笔记

很久前,去年使用Xtreme Suite这个东西时的一些零散笔记,放在这儿备忘。

1. 使用前首先需要有:
CommandBarsGlobalSettings.App = App
CommandBarsGlobalSettings.ResourceFile = "E:\Documents\Xtreme Suite Pro ActiveX v9.60\bin\Translations\XTPResourceZhCn.dll"
前者是设置,后者是指定资源文件。

2. 最简单的方式,设计好,load:
CommandBars.LoadDesignerBars App.Path & "\visio.xcb"

保存、读入设置,更改:
CommandBars.LoadCommandBars "Codejock Software ActiveX Demos", App.Title, "Layout"
CommandBars.SaveCommandBars "Codejock Software ActiveX Demos", App.Title, "Layout"

同时注意保存窗口位置:
If Me.WindowState <> vbMinimized Then
      SaveSetting App.Title, "Settings", "MainLeft", Me.Left
      SaveSetting App.Title, "Settings", "MainTop", Me.Top
      SaveSetting App.Title, "Settings", "MainWidth", Me.Width
      SaveSetting App.Title, "Settings", "MainHeight", Me.Height
End If

读入:
Me.Left = GetSetting(App.Title, "Settings", "MainLeft", Me.Left)
Me.Top = GetSetting(App.Title, "Settings", "MainTop", Me.Top)
Me.Width = GetSetting(App.Title, "Settings", "MainWidth", Me.Width)
Me.Height = GetSetting(App.Title, "Settings", "MainHeight", Me.Height)

3. 不过使用命令创建菜单、按钮也很简单,类似Office VBA下对Commandbar编程;

4. 每个命令都有一个ID,使用ID在CommandBars_Execute 事件可以中可以写事件处理代码。例如:

Select Case Control.Id
      Case ID_APP_ABOUT: MsgBox "Version " & App.Major & "." & App.Minor & "." & App.Revision
      Case ID_FILE_NEW: MsgBox Control.Caption & " Clicked"
      Case ID_FILE_OPEN: MsgBox Control.Caption & " Clicked"
      Case ID_FILE_CLOSE: MsgBox Control.Caption & " Clicked"
      Case ID_FILE_SAVE: MsgBox Control.Caption & " Clicked"

5. 对于简单的控件,窗口范围设置可以:
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
      rtfText.Move Left, Top, Right - Left, Bottom - Top
      rtfText.RightMargin = IIf(rtfText.Width > 400, rtfText.Width - 400, rtfText.Width)
End Sub

其中GetClientRect获取目前的区域位置。

7. CommandBars_Update事件可以处理按钮按下、鼠标移动等事件,以设置其Enable等属性。

可以动态的添加、设置按钮,然后设置图像等文件信息。

8. 关于TabManager和CommarderBars

放置时要把CommarderBars放在顶层,否则显示效果不对。RAD设计界面,包括VB 6,WinForm都是类似,和渲染机制相关。

9. 简单总结:

CommardBar
菜单和按钮,工具条,可以使用Design设计,也可以使用代码添加,类似于Office的VBA下界面设计。其中对于MDI,可以定义Workspace,添加文档的导航条。

DockPanel Manager
使用代码设计,每个Panel是一个Form,动态添加,独立设计。

ShortcutBar
类似于Outlook的导航条,代码设计和添加,每个Panel是一个Form。
其中可以为各个Panel使用ShortcutCaption控件。
使用AddImageList添加Image时,其图标对应是通过Index号对应的

TaskPanel
类似Office和XP的任务条,可以使用代码添加条目,文字或者单击的按钮,超连接,或者独立设计自己的Panel,使用一个容器,一般是PictureBox,然后关联之。

ReportControl
类似Outllok的报告显示

PropertControl
属性显示控件

PopControl
显示MSN,Outllook风格的提示信息。个人觉得不是很好用。


 

原文地址:https://www.cnblogs.com/maweifeng/p/328677.html