Quantcast
Viewing all articles
Browse latest Browse all 14319

Transient text color

Hello,

 

I am working with transient graphics to show some indicators over the current drawing, those indicators have a polygon with a boundary and a text.

 

I do not have any problems with the polygon and with the boundary, but the text is drawn allways with black color and I need it to be in another color. This is the code that I use to draw them in a class that inherits "Transient":

 

        protected override bool SubWorldDraw(WorldDraw wd)
        {
                //Polygon  properties
                wd.SubEntityTraits.TrueColor = new EntityColor(255, 255, 0);
                wd.SubEntityTraits.FillType = FillType.FillAlways;
                wd.SubEntityTraits.Transparency = new Transparency(75);
                //Filled polygon
                wd.Geometry.Polygon(myP3DCol);

                //Line properties
                wd.SubEntityTraits.FillType = FillType.FillNever;
                wd.SubEntityTraits.Transparency = new Transparency(TransparencyMethod.ByLayer);
                //Outline
                wd.Geometry.Polyline(myP3DCol.p3dCol, Vector3d.ZAxis, new IntPtr());

                TextStyle _style = new TextStyle();
                _style.Font = new FontDescriptor("Arial", false, false, 0, 0);
                _style.TextSize = 10;

                wd.SubEntityTraits.TrueColor = new EntityColor(0, 0, 255);

                //Text
                wd.Geometry.Text(
                    myP3DCol.p3dCol[0],         // Position
                    new Vector3d(0, 0, 1),      // Normal
                    new Vector3d(1, 0, 0),      // Direction
                    "MyText",                   // Text
                    true,                       // Rawness
                    _style                      // TextStyle
                );
            Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.UpdateScreen();
            return true;
        }

 Can anyone tell me why the text is allways black or provide me an example code to check for differences?

 

Thanks!

Image may be NSFW.
Clik here to view.

Viewing all articles
Browse latest Browse all 14319

Trending Articles