These seem like great functions to help user interactions, but the best I could manage so far was a very specifically sized and colored text box
'Gotta have some shape set as SDim Test As New OnScreenText Test.SetTextAndPosition "This is the bad shape!", S.CenterX, S.CenterY Test.SetTextColor (RGB(255, 0, 0)) Test.Show
The SetTextColor command did nothing (I may be using the wrong colort type, but there was no error message). The font is fairly specific and small.
Is there more information or examples of these functions anywhere? Ideally I would like to draw a box around corrupt shapes, for example. Or even better an outline to the shape, etc.
But how?
Maybe your RGB function has been return a invalid number after auto cast, RGB function returns a float number, SetTextColor expects a int number.
This exemple show how draw a curve onScreen,
Making a Zig Zag Tool for CorelDRAW and Corel DESIGNER - Docs & Tutorials - Developer Area - CorelDRAW Community
I have this code too,
SelectByWay/SelectByWay.cs at master · bonus630/SelectByWay (github.com)
Is in C#, but the call to corel API is the same
Thanks a lot, I figured how to show curves, which is pretty cool (if a little annoying that you cannot have text and curves at once (as far as I can tell)).
After digging through documentation, I realized that the RGB() function returns Long. So I built this:
Sub OnScreenTest() Set S = ActiveSelectionRange.Shapes.First Dim Col As New Color Col.RGBAssign 255, 0, 0 Dim Test As New OnScreenText Test.SetTextAndPosition "This is the bad shape!", S.CenterX, S.CenterY Test.SetTextColor RGB(255, 0, 0) Test.Show Dim Zest As OnScreenCurve Set Zest = Application.CreateOnScreenCurve() Zest.SetCurve S.DisplayCurve Zest.SetPen RGB(255, 0, 0), 200, cdrOnScreenCurvePenDash Zest.Show End Sub
Well, there are no error messages, but there are zero changes anywhere either.
Am I doing something wrong or is this functionality just half baked?
Wow, this is excellent. I have no idea how you figured that out, but it works great.
There's still the lack of formatting problem for text. But I guess that's just something unfinished on Corel's part.
Thank you!
Very good, but it's easy to get around this break...
Option Explicit
Private z As OnScreenCurve
Sub OnScreenTest() Dim s As Shape, d As Shape Set s = ActiveSelectionRange.Shapes.First Set z = Application.CreateOnScreenCurve() If s.Type = cdrTextShape Then Set d = s.Duplicate d.ConvertToCurves With z .SetCurve d.DisplayCurve .SetPen RGB(255, 0, 0), 200, cdrOnScreenCurvePenDash .Show End With d.Delete Else With z .SetCurve s.DisplayCurve .SetPen RGB(255, 0, 0), 200, cdrOnScreenCurvePenDash .Show End With End If RefreshEnd Sub
Sub testHideOnScreenSh()On Error Resume Nextz.Hide: RefreshEnd Sub
What does your code solve, please? I cannot understand what brings it to solve something...
When the file is a text font, in CorelDRAW 2020 a crash and closed occurs, then this implement duplicates the font and converts to curves, marks the font and deletes the curve and leaves only the text... is an option to avoid crashing...
My above code was tested in CorelDRAW 2020 and worked without any crush. Many times...