Hello,Object-to-object or page-to-page alignment is a standard option. I need a method / VBA code to align the object to the screen or window. Is it possible?I have an idea to use Desktop object but I don't know how.
Greetings!
Not sure what you mean by screen or window? Do you mean align to page center (Keystroke p)?
I dont know if works in X5
[CgsAddInMacro] public void AlignByScreen() { double leftX = 0; double bottomY = 0; corelApp.ActiveWindow.ScreenToDocument(corelApp.ActiveWindow.Left, corelApp.ActiveWindow.Top + corelApp.ActiveWindow.Height, out leftX, out bottomY); corelApp.ActiveShape.BottomY = bottomY; corelApp.ActiveShape.LeftX = leftX; }
Converted ti VBA by ChatGPT,
Dim leftX As DoubleDim bottomY As Double
' Convert screen coordinates to document coordinatesActiveWindow.ScreenToDocument ActiveWindow.Left, ActiveWindow.Top + ActiveWindow.Height, leftX, bottomY
' Set the BottomY and LeftX properties of the active shapeActiveShape.BottomY = bottomYActiveShape.LeftX = leftX
This is interesting for doing things like this
Hello,Thanks for this answer. I'll check later today-Greetings!
Hello,Sorry for the wrong question.I mean the alignment to be in the lower left corner of the active file window - where the document page tags are visible.I'm thinking in this position to display a non-modal user form that says something like "The active page is......."It would have been better to have the option to have the tag on the active page red, but it can't be done. In newer versions of Corel it might be possible, but I have no information and it doesn't matter to me either. Because my corel versions are X5/X3/X8. I want to make something that works on all three.Greetings!