Esempio n. 1
0
        public static ulong AddTextByLayer(vdDocument activeDocument, string textContent, gPoint insertPoint, VdConstVerJust verJust, VdConstHorJust horJust, string fontFile, double textHeight, double widthFactor, VectorDraw.Render.grTextStyleExtra.TextLineFlags textLineFlags, double textRotation, bool ifBold)
        {
            //We will create a vdText object and add it to the Active Layout which is the basic Model Layout always existing in a Document.
            VectorDraw.Professional.vdFigures.vdText onetext = new VectorDraw.Professional.vdFigures.vdText();
            //We set the document where the text is going to be added.This is important for the vdText in order to obtain initial properties with setDocumentDefaults.
            onetext.SetUnRegisterDocument(activeDocument);
            onetext.setDocumentDefaults();


            onetext.TextString = textContent;

            //vdText object with setDocumentDefaults has the STANDARD TextStyle.We will change the font of this textstyle to Verdana.
            //   activeDocument.TextStyles.Standard.FontFile = fontFile;
            //We set the insertion point depending the width of the Text from the vdFigure's BoundingBox

            onetext.InsertionPoint = insertPoint;
            onetext.VerJustify     = verJust;
            onetext.HorJustify     = horJust;
            onetext.TextLine       = textLineFlags;
            onetext.Height         = textHeight;
            onetext.WidthFactor    = widthFactor;
            onetext.Rotation       = textRotation;
            onetext.Bold           = ifBold;
            //Now we will add this object to the Entities collection of the Model Layout(ActiveLayout).
            activeDocument.ActiveLayOut.Entities.AddItem(onetext);
            return(onetext.Handle.Value);
        }
Esempio n. 2
0
        public static ulong AddText(vdDocument activeDocument, string textContent, gPoint insertPoint, int textColor, VdConstVerJust verJust, VdConstHorJust horJust, string txtStyle)
        {
            //We will create a vdText object and add it to the Active Layout which is the basic Model Layout always existing in a Document.
            VectorDraw.Professional.vdFigures.vdText onetext = new VectorDraw.Professional.vdFigures.vdText();
            //We set the document where the text is going to be added.This is important for the vdText in order to obtain initial properties with setDocumentDefaults.
            onetext.SetUnRegisterDocument(activeDocument);
            onetext.setDocumentDefaults();

            //The two previus steps are important if a vdFigure object is going to be added to a document.
            //Now we will change some properties of the text.
            onetext.PenColor.SystemColor = Color.FromArgb(textColor);
            onetext.TextString           = textContent;


            onetext.InsertionPoint = insertPoint;
            onetext.VerJustify     = verJust;
            onetext.HorJustify     = horJust;

            onetext.Style = GetTextStyleByName(activeDocument, txtStyle);

            //Now we will add this object to the Entities collection of the Model Layout(ActiveLayout).
            activeDocument.ActiveLayOut.Entities.AddItem(onetext);
            return(onetext.Handle.Value);
        }
Esempio n. 3
0
        public static ulong AddZongPaiMText(vdDocument activeDocument, double txtSize, string txtStyle, string textContent, gPoint insertPoint, VdConstVerJust verJust, VdConstHorJust horJust, string fontFile, double verAreaHeight)
        {
            double txtsize = txtSize;

            //We will create a vdMText object and add it to the Active Layout which is the basic Model Layout always existing in a Document.
            VectorDraw.Professional.vdFigures.vdMText onemtext = new VectorDraw.Professional.vdFigures.vdMText();
            //We set the document where the Mtext is going to be added.This is important for the vdMText in order to obtain initial properties with setDocumentDefaults.
            onemtext.SetUnRegisterDocument(activeDocument);
            onemtext.setDocumentDefaults();

            //The two previus steps are important if a vdFigure object is going to be added to a document.
            //Now we will change some properties of the text.
            onemtext.InsertionPoint = insertPoint;
            onemtext.HorJustify     = horJust;
            if (verAreaHeight > 0.000001)
            {
                onemtext.Height = verAreaHeight / 2;
            }


            vdTextstyle txtStyleObj = GetTextStyleByName(activeDocument, txtStyle);

            if (!string.IsNullOrEmpty(fontFile))
            {
                txtStyleObj.FontFile = fontFile;
            }
            if (txtSize > 0.00001)
            {
                txtStyleObj.Height = txtSize;
            }
            onemtext.Style = txtStyleObj;

            onemtext.HorJustify = horJust;
            onemtext.VerJustify = verJust;
            string tmp = "";

            char[] ss = textContent.ToCharArray();
            for (int i = 0; i < ss.Length; i++)
            {
                tmp = tmp + ss[i] + "\\P";
            }
            if (txtsize > 0.00001)
            {
                tmp = "\\H" + txtSize.ToString() + tmp;
            }

            onemtext.TextString = tmp;



            /*
             \0...\o             Turns overline on and off
             * \L...\l               Turns underline on and off
             \\                      Inserts a backslash
             \{...\}                Inserts an opening and closing brace
             \\\Cindex;        Changes to the  specified color
             \\\Hvalue;       Changes to the text height specified in drawing units
             \\\Hvaluex;     Changes the text height  to a multiple of the current text height
             \\\Tvalue;       Adjusts the space between characters, from .75 to 4 times
             \\\Qangle;      Changes obliquing angle
             \\\Wvalue;     Changes width factor to produce wide text
             \\\Ffile name; Changes to the specified font file
             \\\A                   Sets the alignment value; valid values: 0, 1, 2
             \\\P                   Ends paragraph
             \\\S...^...;         Stacks the subsequent text at the \, #, or ^ symbol
             */

            //Now we will add this object to the Entities collection of the Model Layout(ActiveLayout).
            activeDocument.ActiveLayOut.Entities.AddItem(onemtext);
            return(onemtext.Handle.Value);
        }
Esempio n. 4
0
        public static ulong AddText(vdDocument activeDocument, string textContent, gPoint insertPoint, VdConstVerJust verJust, VdConstHorJust horJust, int TextColor, string fontFile, double textHeight, double widthFactor, VectorDraw.Render.grTextStyleExtra.TextLineFlags textLineFlags, double textRotation, bool ifBold)
        {
            //We will create a vdText object and add it to the Active Layout which is the basic Model Layout always existing in a Document.
            VectorDraw.Professional.vdFigures.vdText onetext = new VectorDraw.Professional.vdFigures.vdText();
            //We set the document where the text is going to be added.This is important for the vdText in order to obtain initial properties with setDocumentDefaults.
            onetext.SetUnRegisterDocument(activeDocument);
            onetext.setDocumentDefaults();

            //The two previus steps are important if a vdFigure object is going to be added to a document.
            //Now we will change some properties of the text.
            onetext.PenColor.SystemColor = Color.FromArgb(TextColor);
            onetext.TextString           = textContent;


            onetext.InsertionPoint = insertPoint;
            onetext.VerJustify     = verJust;
            onetext.HorJustify     = horJust;
            onetext.TextLine       = textLineFlags;
            onetext.Height         = textHeight;
            onetext.WidthFactor    = widthFactor;
            onetext.Rotation       = textRotation;
            onetext.Bold           = ifBold;
            onetext.Style.FontFile = fontFile;

            //Now we will add this object to the Entities collection of the Model Layout(ActiveLayout).
            activeDocument.ActiveLayOut.Entities.AddItem(onetext);
            return(onetext.Handle.Value);
        }
Esempio n. 5
0
        public static ulong AddMultiLineText(vdDocument activeDocument, double txtSize, string txtStyle, string textContent, gPoint insertPoint, VdConstVerJust verJust, VdConstHorJust horJust, string fontFile, double verAreaHeight, double horAreaWidth)
        {
            //We will create a vdMText object and add it to the Active Layout which is the basic Model Layout always existing in a Document.
            VectorDraw.Professional.vdFigures.vdMText onemtext = new VectorDraw.Professional.vdFigures.vdMText();
            //We set the document where the Mtext is going to be added.This is important for the vdMText in order to obtain initial properties with setDocumentDefaults.
            onemtext.SetUnRegisterDocument(activeDocument);
            onemtext.setDocumentDefaults();

            //The two previus steps are important if a vdFigure object is going to be added to a document.
            //Now we will change some properties of the text.
            onemtext.InsertionPoint = insertPoint;
            onemtext.HorJustify     = VectorDraw.Professional.Constants.VdConstHorJust.VdTextHorCenter;
            onemtext.BoxWidth       = 30;
            onemtext.Thickness      = 10;
            onemtext.Style          = activeDocument.TextStyles.FindName("zt");
            onemtext.lunits.FormatLength(10);
            onemtext.PenColor.SystemColor = Color.Red;
            // onemtext.TextString = "\\C1;\\H5.0;VectorDraw \\C2;\\H2x;Development \\C3;\\H2.5;Framework";
            string content = "姚二段,nihao,8888,你好啊,早上好";
            string tmp     = "";
            string tmp2    = "";

            // content = "\\T2;" + content;
            char[] ss = content.ToCharArray();
            for (int i = 0; i < ss.Length; i++)
            {
                tmp = tmp + ss[i] + "\\P";
            }
            tmp = "\\H3" + tmp;

            onemtext.TextString = content;
            double width        = onemtext.BoundingBox.Width;
            int    count        = content.Length;
            double wordwidth    = width / count;
            int    countPerLine = (int)(horAreaWidth / wordwidth);

            if (countPerLine > 0)
            {
                for (int j = 0; j < ss.Length; j++)
                {
                    int modcount = (j + 1) % countPerLine;
                    if (modcount.Equals(0))
                    {
                        tmp2 = tmp2 + ss[j] + "\\P";
                    }
                    else
                    {
                        tmp2 = tmp2 + ss[j];
                    }
                }
                tmp2 = "\\H3" + tmp2;
                onemtext.TextString = tmp2;
            }
            onemtext.Height = 50;



            //   MessageBox.Show(width.ToString());
            //  onemtext.TextString="\\H3.0;真正的\\P;\\T2;工程,确实的工程";

            //  onemtext.TextString = "\\H3.0;你好啊,我们一起回家妈妈,";


            /*
             \0...\o             Turns overline on and off
             * \L...\l               Turns underline on and off
             \\                      Inserts a backslash
             \{...\}                Inserts an opening and closing brace
             \\\Cindex;        Changes to the  specified color
             \\\Hvalue;       Changes to the text height specified in drawing units
             \\\Hvaluex;     Changes the text height  to a multiple of the current text height
             \\\Tvalue;       Adjusts the space between characters, from .75 to 4 times
             \\\Qangle;      Changes obliquing angle
             \\\Wvalue;     Changes width factor to produce wide text
             \\\Ffile name; Changes to the specified font file
             \\\A                   Sets the alignment value; valid values: 0, 1, 2
             \\\P                   Ends paragraph
             \\\S...^...;         Stacks the subsequent text at the \, #, or ^ symbol
             */

            //Now we will add this object to the Entities collection of the Model Layout(ActiveLayout).
            activeDocument.ActiveLayOut.Entities.AddItem(onemtext);


            return(onemtext.Handle.Value);
        }