OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Corel User Forums > CorelDRAW > Macros/Add-ons

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 19-12-2014, 14:41
BlackNight BlackNight is offline
Junior Member
 
Join Date: Jun 2012
Posts: 10
Default AlignToPageCenter adn AlignAndDistribute do not work in X7

I am upgrading from CorelDraw X5 to X7. I have an external program written in Vb.Net. When I change the reference to use X7 form X5 and run the code below the AlignToPageCenter does not work. The box is created but the box.AlignToPageCenter does not work, nothing happens to the box it does not move. I have tried box.AlignAndDistribute but that throws an Access violation error. I also need to align text to the center of the box but in X7 that does not work either using ThisLine.AlignToShape(just, box, CorelDRAW.cdrTextAlignOrigin.cdrTextAlignBoundingBox)


I understand that I could simply do something like box = CorelApp.ActiveLayer.CreateRectangle2(0 + 0.045, CorelDoc.MasterPage.BottomY + 0.045, (CorelDoc.MasterPage.SizeWidth - 0) - 0.09, CorelDoc.MasterPage.SizeHeight - 0.09)
to place the red box centered on the page but this is a siplified example of what I am doing. The issue is that AlignToPageCenter adn AlignAndDistribute do not work in X7. What is the alternative to this. I have uploaded the VS 2013 solution if it helps.


Any help on this would be greatly appreciated Thanks
Paul




CorelApp.Windows.CloseAll()
CorelApp.Application.Visible = True


CorelDoc = CorelApp.CreateDocument()


CorelDoc.Resolution = 1200

CorelDoc.Unit = CorelDRAW.cdrUnit.cdrInch
CorelApp.ActiveWindow.ActiveView.SetViewPoint(1.0#, 0.5, 100)
CorelDoc.MasterPage.SetSize(2.0#, 2.0#)
CorelDoc.MasterPage.Orientation = CorelDRAW.cdrPageOrientation.cdrLandscape
CorelDoc.MasterPage.PrintExportBackground = True
CorelDoc.MasterPage.Bleed = 0.0#
CorelDoc.MasterPage.Background = CorelDRAW.cdrPageBackground.cdrPageBackgroundNone



Dim boxColor As New CorelDRAW.Color
boxColor.CMYKAssign(0, 100, 100, 0)

Dim box As CorelDRAW.Shape
'box = CorelApp.ActiveLayer.CreateRectangle2(0 + 0.014, CorelDoc.MasterPage.TopY, (CorelDoc.MasterPage.SizeWidth - 0) - 0.09, CorelDoc.MasterPage.SizeHeight - 0.09)
box = CorelApp.ActiveLayer.CreateRectangle2(0 + 0.014, CorelDoc.MasterPage.CenterX, (CorelDoc.MasterPage.SizeWidth - 0) - 0.09, CorelDoc.MasterPage.SizeHeight - 0.09)
box.Outline.SetProperties(Color:=boxColor)
box.Name = "Box"
box.Fill.ApplyNoFill()
box.Outline.Width = 0.014 * 1

'box.AlignToPageCenter(CorelDRAW.cdrAlignType.cdrAlignVCenter, CorelDRAW.cdrTextAlignOrigin.cdrTextAlignBoundingBox)

box.AlignAndDistribute(VGCore.cdrAlignDistributeH.cdrAlignDistributeHDistributeCenter, VGCore.cdrAlignDistributeV.cdrAlignDistributeVDistributeCenter, VGCore.cdrAlignShapesTo.cdrAlignShapesToCenterOfPage)
Attached Files
File Type: zip CorelDrawTest.zip (536.8 KB, 255 views)
Reply With Quote
  #2  
Old 07-07-2015, 14:12
mtracy mtracy is offline
Member
 
Join Date: Jun 2012
Location: Niceville, Florida
Posts: 31
Default This worked for me in X7

Sub CenterToPage()
Dim sr As ShapeRange
Set sr = ActiveSelectionRange


sr.AlignRangeToPageCenter cdrAlignVCenter

End Sub
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
t AlignToPageCenter adn AlignAndDistribute do not work in X7 BlackNight CorelDRAW/Corel DESIGNER VBA 3 06-02-2015 09:38
why it can't work? engandy CorelDRAW/Corel DESIGNER VBA 1 04-10-2008 23:38
won't work doodedoo Calendar Wizard 7 06-12-2006 20:09
Can't get my puppy to work thedays6 Calendar Wizard 1 25-07-2006 12:22
VBA does not work with my CD 10 ! jobar CorelDRAW/Corel DESIGNER VBA 1 24-08-2003 12:38


All times are GMT -5. The time now is 05:19.


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