Setting Halftones on a Shape with Code

How do I set a shape to have Halftone type Dot, Frequency 45, Angle 45? I cannot find a place to properly set this.

I attempted to use Shape.Style.StringAssign() by getting the Shape.Style.Fill.Style, turning it into a string, and then setting just the screenSpec properties like I wanted.

Then I tried doing Shape.Style.Fill.SetPropertyString("screenSpec", "1,0,45000000,45,0"); and that did not work either.

I am using C# but I can figure out VBA code if someone has VBA code that works. 

Parents
  • //only for fun but works

    public static void FillShape(corel.Shape shape, double dotsize, double angle, double fillPercent)
            {
                CorelApp.Unit = corel.cdrUnit.cdrMillimeter;
                CorelApp.ActiveDocument.Unit = corel.cdrUnit.cdrMillimeter;

                CorelApp.EventsEnabled = false;
                CorelApp.Optimization = true;

                shape.RotateEx(angle * -1, 0, 0);
                double dist = dotsize + (dotsize * fillPercent / 100);
                int nx = (int)(shape.SizeWidth / dist);
                int ny = (int)(shape.SizeWidth / dist);
                corel.ShapeRange shapeRange = CorelApp.CreateShapeRange();

                double posX = shape.LeftX;
                double posY = shape.BottomY;

                for (int x = 0; x <= nx; x++)
                {
                    for (int y = 0; y <= ny; y++)
                    {

                        corel.Shape circle = CorelApp.ActiveLayer.CreateEllipse2(posX + (x * dist), posY + (y * dist), dotsize * .5);
                        shapeRange.Add(circle);
                    }
                }

                shapeRange.RotateEx(angle, 0, 0);
                shape.RotateEx(angle, 0, 0);
                corel.Shape dots = shapeRange.Combine();
                dots = shape.Intersect(dots, true, false);
                dots.Fill.UniformColor.CMYKAssign(0, 0, 0, 100);
                dots.Outline.SetNoOutline();

                CorelApp.EventsEnabled = true;
                CorelApp.Optimization = false;
                CorelApp.Refresh();
            }

Reply Children
No Data