OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 25-05-2004, 08:45
Michael Cervantes
Guest
 
Posts: n/a
Default stack order 2

Alex, any other idea to find out or keep object stack order.

Thanks and best regards

Michael Cervantes
Reply With Quote
  #2  
Old 25-05-2004, 12:27
Lev
Guest
 
Posts: n/a
Default

shapes.index property reports z-order of an object
for example:
ActivePage.Shapes(1).AddToSelection
selects the top-most (highest) shape on the page
ActivePage.Shapes(ActivePage.Shapes.Count).AddToSelection
selects the bottom-most (lowest) shape on the page
ActiveLayer.Shapes(ActiveLayer.Shapes.Count).AddToSelection
selects the bottom-most shape on the layer
Reply With Quote
  #3  
Old 14-06-2004, 10:24
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default Re: stack order 2

Quote:
Originally Posted by Michael Cervantes
Alex, any other idea to find out or keep object stack order.
I would just do it myself.

Find out all the shapes from layers below the active layer, then move them to the active one, and execute "OrderToBack" on them. Finally, move all the shapes above the active layer to the active layer and they will appear on the top.

Code:
Private Sub MoveShapesToLayer(ByVal sr As ShapeRange, ByVal TargetLayer As Layer)
    Dim srAbove As New ShapeRange
    Dim srBelow As New ShapeRange
    Dim s As Shape
    For Each s In sr
        If s.Layer.Index <> TargetLayer.Index Then
            If s.Layer.Index < TargetLayer.Index Then
                srAbove.Add s
            Else
                srBelow.Add s
            End If
        End If
    Next s
    If srBelow.Count > 0 Then
        srBelow.MoveToLayer TargetLayer
        srBelow.OrderToBack
    End If
    If srAbove.Count > 0 Then
        srAbove.MoveToLayer TargetLayer
    End If
End Sub

Public Sub MoveSelectionToActiveLayer()
    MoveShapesToLayer ActiveSelectionRange, ActiveLayer
End Sub
I hope this helps.
Reply With Quote
  #4  
Old 15-06-2004, 06:58
Michael Cervantes
Guest
 
Posts: n/a
Default stack order 2

Execellent.

Thanks and best regards

Michael Cervantes
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Thumbnailer - File Order dgearl Macros/Add-ons 1 12-05-2017 02:39
stack order Michael Cervantes CorelDRAW/Corel DESIGNER VBA 2 20-05-2004 00:32
Keeping the stacking order when changing layers Rick Randall CorelDRAW/Corel DESIGNER VBA 1 04-02-2003 22:34


All times are GMT -5. The time now is 08:51.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com