码迷,mamicode.com
首页 > 其他好文 > 详细

Visio中的Undo和Redo

时间:2015-02-10 10:24:02      阅读:190      评论:0      收藏:0      [点我收藏+]

标签:

1.Visio默认Undo和Redo操作是可用的,Appliacation中的UndoEnabled标志Undo和Redo操作是否可用。

m_Visio.Window.Application.UndoEnabled = True

2.Visio中启动事务,结束事务

Dim vsoTextShape As Visio.Shape  
Dim UndoScopeID1 As Long
UndoScopeID1 = m_Visio.Window.Application.BeginUndoScope("添加文本形状")
Set vsoTextShape = m_Visio.Window.Application.ActiveWindow.Page.DrawRectangle(X2, Y2, X2 + 1, Y2 - 0.5)
vsoTextShape.TextStyle = "Normal"
vsoTextShape.LineStyle = "Text Only"
vsoTextShape.FillStyle = "Text Only"
vsoTextShape.CellsSRC(visSectionCharacter, 0, visCharacterColor).FormulaU = "2"
vsoTextShape.CellsSRC(visSectionCharacter, 0, visCharacterSize).FormulaU = "8 pt"
vsoTextShape.Characters = "两个输出不可连接"
m_Visio.Window.Application.EndUndoScope UndoScopeID1, True

这样在Undo和Redo操作时,添加文本形状,则以一个整体进行Undo和Redo记录操作,而不会把单元格属性等改变进行单独记录。

3.Visio中撤销所有的Undo队列,Application.PurgeUndo

m_Visio.Window.Application.PurgeUndo

4.操作排队开始事件和结束事件

Private Sub vsoApplication_EnterScope(ByVal app As Visio.IVApplication, ByVal nScopeID As Long, ByVal bstrDescription As String)
    排队内部命令开始时,或当自动化客户端通过使用BeginUndoScope方法打开一个作用域。
     MsgBox (bstrDescription)
End Sub

Private Sub vsoApplication_ExitScope(ByVal app As Visio.IVApplication, ByVal nScopeID As Long, ByVal bstrDescription As String, ByVal bErrOrCancelled As Boolean)
    排队内部命令结束时,或当自动化客户端通过使用EndUndoScope方法退出范围。
     MsgBox (bstrDescription)
End Sub

Visio中的Undo和Redo

标签:

原文地址:http://www.cnblogs.com/wuyuan2011woaini/p/4283067.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!