Text Style
Previous Topic  Next Topic 

       

 

      sdTextStyle

 

 To control the settings on a text style. All the text style objects will be created and added to the TextStyles collection. The active text style (set with the ActiveTextStyle property) determines the appearance of new text created in the drawing, and existing text that has no distinct text style specified. 

 

        Adding Text styles  

 

        private void butTextStyles_Click(object sender, EventArgs e)

        {

             fDrawCtrl1.Document.BackgroundColor.SynColor = Color.White;

            fDrawCtrl1.Document.UseAxis3D = true;

            fDrawCtrl1.MouseDoubleClick += fDrawCtrl1_MouseDoubleClick;

            //fDrawCtrl1.SetEditPanelVisibility(true);

            string path = Path.Combine(Environment.CurrentDirectory, "Font");

            fDrawCtrl1.Document.SupportPath.Add(path);

 

            fDrawCtrl1.Document.AutoCalCenterOfOrbit = false;

            fDrawCtrl1.Document.BackgroundColor.SynColor = Color.Gainsboro;

            fDrawCtrl1.Document.ActiveLineColor.FromSystemColor(Color.Black);

 

            string style1 = "style1";

            string style2 = "style2";

            string style3 = "style3";

 

            fDrawCtrl1.Document.TextStyles.Add(new fDraw.External.Rendering.sdFont("Time New Roman", 10), style1, 1, 10);

            fDrawCtrl1.Document.TextStyles.Add(new fDraw.External.Rendering.sdFont("Arial Black", 10), style2, 1, 10);

            // Add SHX font

            fDrawCtrl1.Document.TextStyles.Add("simplex.shx", style3, fDraw.Constants.CodePageEnum.ANSI_1200, 1, 10);

 

            fDrawCtrl1.Document.ActiveTextJustification = fDraw.External.Rendering.TextJustification.bottomLeft;

 

            //sdBox b;

            sdText t;

            // Set Active text style to style2

            fDrawCtrl1.Document.ActiveTextStyleStr = style2;

            t=fDrawCtrl1.Document.AddText("Testing"new Point3D(0, 0, 0), 1);

 

            // Set Active text style to style3

            fDrawCtrl1.Document.ActiveTextStyleStr = style3;

            t = fDrawCtrl1.Document.AddText("Testing"new Point3D(10, 3, 0), 1);

            t.Height *= 1.5;

 

            // Set Active text style to style1

            fDrawCtrl1.Document.ActiveTextStyleStr = style1;

            t = fDrawCtrl1.Document.AddText("%%uUnder Line Text"new Point3D(10, 0, 0), 1);

           

 

            fDrawCtrl1.Document.ActiveTextStyleStr = style1;

            t = fDrawCtrl1.Document.AddText("MiddleCenter Justification"new Point3D(10, -5, 0), 1);

            t.HoriJust = fDraw.External.Rendering.TextHoriJustification.Center;

            t.VerJust = fDraw.External.Rendering.TextVertJustification.Middle;

 

            fDrawCtrl1.Document.ActiveBitmapFont.ChangeBitmapSize(80);

            fDrawCtrl1.Document.AddBitmapText("Bitmap Testing"new Point3D(10, 5, 0));

 

            sdMText mtext = fDrawCtrl1.Document.AddMText(@"Multi Text"new Point3D(0, 5, 0), 1);

 

            fDrawCtrl1.Document.ZoomAll();

            fDrawCtrl1.Refresh();

        }