Thread: Copy size
View Single Post
  #1  
Old 16-06-2019, 04:19
svk svk is offline
Junior Member
 
Join Date: Jul 2008
Posts: 3
Default Copy size

Till now I was using CorelDraw X5 and recently I have shifted to CorelDraw X9
And many of the old codes are now working anymore

I have this code which runs awesome on X5, can anyone help me so that it works on CorelDraw 2019. The code is as follows

-----------------------------

Option Explicit
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Const VK_SHIFT = &H10
Private Const VK_CONTROL = &H11

Sub EitherDim()
Dim s As Shape, sr As ShapeRange
Dim w As Double, h As Double, a As Double

Set sr = ActiveSelectionRange

sr(1).GetSize w, h
a = sr(1).RotationAngle

For Each s In sr
If IsShiftPressed() Then
's.SetSize w
s.SizeWidth = w
ElseIf IsCtrlPressed() Then
s.RotationAngle = a
Else
's.SetSize , h
s.SizeHeight = h
End If
Next s
End Sub

Public Function IsShiftPressed() As Boolean
IsShiftPressed = (GetAsyncKeyState(VK_SHIFT) < 0)
End Function

Private Function IsCtrlPressed() As Boolean
IsCtrlPressed = (GetAsyncKeyState(VK_CONTROL) < 0)
End Function
Reply With Quote