![]()
|
Resizing Object Keeping Its Aspect RatioIf you want to set Photo-Paint to "Maximize Workarea" mode, you'll need to use this code. Automation interface doesn't offer such command, so we need to use this "hack". What this script does is just sending a Windows message to the application window as if you were clicking the corresponding button on the toolbar. First it uses Windows API function FindWindow to locate Photo-Paint's main window and then it sends the Windows WM_COMMAND message to it: MaxX&=FROMCENTIMETERS(10) MaxY&=FROMCENTIMETERS(10) withobject "CorelDRAW.Automation.9" .GetSize sx&,sy& IF sx*(MaxY/sy)>MaxX THEN sy=sy*(MaxX/sx) sx=MaxX ELSE sx=sx*(MaxY/sy) sy=MaxY ENDIF .SetSize sx,sy end withobject To ensure that the application is running and its main window is visible, WIDTHOBJECT is used along with SetVisible command. Howevere you can launch Photo-Paint yourself as described in the following example: Launching an application from script. |
[ CorelSCRIPT Tips&Tricks | Learning CorelSCRIPT | Oberon Home Page ] |
|
Copyright © 2000 by Alex Vakulenko. All rights reserved.
|