Is there more information/examples about OnScreenCurve, OnScreenHandle and OnScreenText?

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 S
Dim 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?

Parents Reply Children
  • Former Member
    0 Former Member over 3 years ago in reply to Joe

    You can try some hacks to display curve and a text, use only CreateOnScreenCurve(), to display a curve of a text joined yours others curves

        try
                {
                    Color color = app.CreateColor();
                    color.RGBAssign(255, 0, 0);
    
                    string text = "Test";
                    double positionX = 0;
                    double positionY = 0;
    
                    app.Optimization = true;
                    OnScreenCurve ui = app.CreateOnScreenCurve();
                    
                    Shape q = app.ActiveLayer.CreateRectangle2(positionX, positionY, 1, 1);
                    Shape t = app.ActiveLayer.CreateArtisticText(positionX, positionY, text);
                    q.ConvertToCurves();
                    t.ConvertToCurves();
    
                    Curve c = app.CreateCurve();
                    c.AppendCurve(q.DisplayCurve);
                    c.AppendCurve(t.DisplayCurve);
    
                    t.Delete();
                    q.Delete();
    
                    ui.SetCurve(c);
                    ui.SetPen(color.RGBValue, 10, cdrOnScreenCurvePenStyle.cdrOnScreenCurvePenSolid);
                    
                    app.Optimization = false;
                    app.Refresh();
                    ui.Show();
                }
                catch(Exception e)
                {
                    
                }
                finally
                {
                    app.Optimization = false;
                    app.Refresh();
                }
    
  • 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?

    My experience with OnScreenCurve is limited to using rectangles, e.g., in my Weed Box macro, to show where the box is going to be created.