OberonPlace.com Forums  

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

Thread Tools Search this Thread Display Modes
Old 22-08-2007, 18:19
Craig Tucker
Posts: n/a
Default Rotation and PowerClip

Hi All,
I've got an image already imported into a shape and I'm trying to powerclip it into another shape (which is a trapezoid rotated at x degree) and when I powerclip in, it is chopping off the top part of the image because the center of the shape on a horizontal plane is not the center of the trapezoid...
Now that's clear is mud - so I try to rotate the trapezoid shape back to 0 degree, powerclip, then rotate back and I get an error... Here's a clip of the code. There's probably a better way - I've tried a few to no avail... Any help is greatly appreciated!
Thanks much,

For Each lolayer2 In mPage.Layers
lnRotation = 0
lcLayerType = UCase(Left(lolayer2.Name, 3))
If lcLayerType = "RL_" Then
lnRotation = Mid(lolayer2.Name, 4)
Set sc = Nothing
Set sc = lolayer2.FindShape("QC" & Mid(lcLookFor, 3))
If Not sc Is Nothing Then
Set sPCClone = mCorel.ActiveSelection.Clone

(Here, if you rotate before you powerclip - Corel Errors???)

sc.Rotate (-lnRotation)
sPCClone.AddToPowerClip (sc)
sc.Rotate (lnRotation)
Set sc = Nothing
Set sPCClone = Nothing
End If
End If
Next lolayer2
Reply With Quote
Old 23-08-2007, 14:02
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
Join Date: Mar 2005
Posts: 836

why do you use .Clone method? it is not the same as .Duplicate. If you need ordinary copy of the object then use .Duplicate:

Set sc = lolayer2.FindShape("QC" & Mid(lcLookFor, 3))
If Not sc Is Nothing Then
   set sPCClone=sc.Duplicate
p.s. in 99.9% cases one can use direct shape manipulation methods instead of .ActiveSelection
Reply With Quote
Old 23-08-2007, 14:35
shelbym's Avatar
shelbym shelbym is offline
Senior Member
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,790
Blog Entries: 13
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default PowerClip

If I understand what you are saying this works for me. I did simplify everything like taking out your For Next loop. I also agree with wOxxOm Clone is not what you want to use.
Sub myTrapezoid()
    Dim dblRotation As Double
    Dim sShape As Shape
    Dim sTrapezoid As Shape
    Set sShape = ActivePage.FindShape(Name:="myShape")
    Set sTrapezoid = ActivePage.FindShape(Name:="myTrapezoid")
    dblRotation = sTrapezoid.RotationAngle
    sTrapezoid.RotationAngle = 0
    sShape.AddToPowerClip sTrapezoid
    sTrapezoid.RotationAngle = dblRotation
End Sub
Best of luck,

Reply With Quote
Old 23-08-2007, 17:31
Craig Tucker
Posts: n/a
Default Best way?

Hi wOxxOm and Shelby,
Thanks a ton for your responses-and they are very helpful. I probably should have asked this first for maybe even a better solution.

Here's my delima: I have 3 trapezoid shapes rotated 60%, 180%, and 240% respectively in a circle. I want to import 3 images (jpg could be landscape or portrait) and power clip them into the trapezoids so the pictures completely fill the trapezoid and all the images facing the center of a circle.

Once the trapezoid has been rotated, the center point is different than when it is at 0% - so I was trying to rotate back to 0, powerclip, then rotate back; but maybe that's not the best way (then you have the whole portait issue of not filling the whole trapezoid too)

Thanks much for you help,
Reply With Quote

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

All times are GMT -5. The time now is 03:41.

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