Previous Document Next Document

Object Model Reference : Classes : A : Application : Properties : Application.Optimization


Application.Optimization

Property Optimization As Boolean

Description

Member of Application

The Optimization property returns or specifies the optimization, the ability to suppress screen redraws when working with documents and shapes.

Setting the Optimization property to True disables some internal updating. It is important to disable optimization when exiting a macro, or CorelDRAW may not update its screens. You may also want to refresh the document window after disabling optimization so the display is updated and reflects all changes.

VBA example

The following VBA example creates 100 random circles in the active document, with optimization enabled for increased performance.

Sub Optimize()
 Dim i As Long
 Dim x As Double, y As Double, r As Double
 Dim n As Long
 Dim num As Long
 Dim MaxX As Double, MaxY As Double, MaxR As Double
 MaxX = ActivePage.SizeWidth
 MaxY = ActivePage.SizeHeight
 MaxR = 1
 num = ActivePalette.ColorCount
 Optimization = True
 For i = 1 To 100
  x = Rnd() * MaxX
  y = Rnd() * MaxY
  r = Rnd() * MaxR
  n = CLng(Fix(Rnd() * num)) + 1
  Set s = ActiveLayer.CreateEllipse2(x, y, r)
  s.Fill.ApplyUniformFill ActivePalette.Color(n)
 Next i
 Optimization = False
 ActiveWindow.Refresh
End Sub

Previous Document Next Document Back to Top

Copyright 2013 Corel Corporation. All rights reserved.