So I recently updated to CorelDraw 2020 from X7. I'm moving over my macros and I've run into a view issues. My biggest problem right now is that I cant change a Rectangle Shape's corner radius / type without crashing CorelDraw. This error doesn't even bring up the VBA debugger with an error on the offending line of code in the macro. The following is the code being used in my macro that causes a crash:
Sub StartTest() '
Dim OrigSelection As ShapeRange Set OrigSelection = ActiveSelectionRange Dim s1 As Shape Set s1 = OrigSelection(1) s1.Rectangle.CornerType = cdrCornerTypeChamfer ' crash occurs here s1.Rectangle.RelativeCornerScaling = True s1.Rectangle.RadiusLowerLeft = 0.4 s1.Rectangle.RadiusLowerRight = 0.4 s1.Rectangle.RadiusUpperLeft = 0.4 s1.Rectangle.RadiusUpperRight = 0.4 End Sub
So after selecting a Rectangle shape in my document and running this macro I get a crash. I've even recorded a macro where I simply change the corner type to Chamfer and edit the radii and after replaying the macro it causes a crash.
My OS is Windows 7 by the way.
Any insights into this issue would be greatly appreciated!
This bug has been reported to Corel, hopefully that can get it fixed in a service pack.
-Shelby
An alternative I found (when needed) was to create another rectangle with rounded corners. But you must take care to recalculate, using the radius you want to obtain, like in the next code:
1 2 3 4 5 6 7 8 9 10 11 12 13
Sub replaceRectangleRoundC() Dim sh As Shape, shR As Shape, radius As Double, rD As Long Set sh = ActiveShape ActiveDocument.Unit = cdrInch: Application.Unit = cdrInch radius = 0.2 'inch rD = CLng((sh.SizeWidth * sh.SizeHeight) / 2 * radius * 400) 'max 100 Set shR = ActiveLayer.CreateRectangle(sh.LeftX, sh.TopY, _ sh.LeftX + sh.SizeWidth, sh.TopY - sh.SizeHeight, rD, rD, rD, rD) shR.Fill.UniformColor = sh.Fill.UniformColor 'and so on, if other properties are needed sh.Delete End Sub
This bug has been fixed in Update 1 which is available now. You may find it here:
https://www.coreldraw.com/en/support/updates/?_ga=2.254734664.1736955759.1592522615-198978048.1588826085#cdgs-2020
Thanks for reporting it so we could get it fixed.