AVAX-software.com Forums: How to add many objects faster - AVAX-software.com Forums

Jump to content

Page 1 of 1

How to add many objects faster

#1 User is offline   Athanasios Gardos Icon

  • Administrator
  • Icon
  • Group: Admin
  • Posts: 333
  • Joined: 21-March 05
  • Gender:Male

Posted 13 May 2008 - 01:08 PM

VB6 example on how to add many objects faster:

Option Explicit

Private Sub Command1_Click()
    Dim i As Single
    cAvax1.AutoRedraw = False
    Screen.MousePointer = vbHourglass
    For i = 1 To 1200
        Call cAvax1.Add_Rectangle(0, 0, i * 0.01, i * 0.01)
        If i Mod 100 = 0 Then Label1.Caption = Str$(i): Label1.Refresh
        If i = 1 Then cAvax1.UndoRecorderOn = True
        cAvax1.ContinueUndo = True
    Next i
    cAvax1.UndoRecorderOn = False
    cAvax1.ContinueUndo = False
    cAvax1.AutoRedraw = True
    Screen.MousePointer = vbDefault
End Sub

Private Sub Command2_Click()
    cAvax1.Command = Undo_c
End Sub

Private Sub Command3_Click()
    cAvax1.Command = Redo_c
End Sub

Private Sub Form_Load()
    Command1.Caption = "Add Rectangles"
    Command2.Caption = "Undo"
    Command3.Caption = "Redo"
    Label1.Caption = ""
    Call cAvax1.StartAvax
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Call cAvax1.EndAvax
End Sub

Athanasios Gardos
Avax-Software.com

#2 User is offline   MUZAK Icon

  • Member
  • PipPip
  • Group: Members
  • Posts: 27
  • Joined: 04-December 07

Posted 14 May 2008 - 03:42 PM

I already use autoredraw=false/true. Does the undoRecorder affect the speed as well? Do I need to explicitly turn it off?

In my current application, all of my drawing is done by parameters, so there is no need for an undo.

Thanks!

#3 User is offline   Athanasios Gardos Icon

  • Administrator
  • Icon
  • Group: Admin
  • Posts: 333
  • Joined: 21-March 05
  • Gender:Male

Posted 14 May 2008 - 05:51 PM

UndoRecorder is to pack all objects as one into the undo queue.

Autoredraw=false/true is making the addition faster.

If you don't need undo/redo feature use the following declaration:
Call cAvax1.SetAvaxProperty(UndoRedoOn_p, False)
This will make the addition a little bit faster.
Athanasios Gardos
Avax-Software.com

Page 1 of 1


Fast Reply

  

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users