CAD parametric drawing text (Web version)

In the CAD design, the need to draw text, the user can set the settings for text display attributes such as height.


The main use of Function:


_DMxDrawX::DrawText


Draw a single line of text. Details are as follows:


parameter Explanation

DOUBLE dPosX

X coordinate of the position of the text

DOUBLE dPosY

Y coordinate position of the character

BSTR pszText

Text string

Double dHeight

Text height

DOUBLE dRotation

The angle of rotation of text

SHORT horizontalMode

Text horizontal alignment, 0 = kTextLeft, 1 = kTextCenter, 2 = kTextRight

SHORT verticalMode

Vertical alignment of the text, 1 = kTextBottom, 2 = kTextVertMid, 3 = kTextTop


_DMxDrawX::AddTextStyle1


Add a text style to the database. Details are as follows:


parameter Explanation

BSTR pszName

Text style name

BSTR pszFileName

shx file name

BSTR pszBigFontFileName

big shx file name

DOUBLE dXScale

Text width scaling


js implemented Definitions:


the DrawText function () 
{ 
    // clear the currently displayed content 
    mxOcx.NewFile (); 
    // put back to black and white color 
    mxOcx.DrawColor = 0; 
    // create a layer called "TextLayer" 
    mxOcx.AddLayer ( "TextLayer" ); 
    // set the current layer to "TextLayer" 
    mxOcx.LayerName = "TextLayer"; 
    // draw a line text 
    // parameter a is the X coordinate position of the character; two parameters for the Y coordinate position of the character; parameters of three text string 
    // text height is four parameters; five parameters of the rotation angle of the text 
    // parameter six horizontal justification of the text, kTextLeft = 0, = kTextCenter. 1, 2 = kTextRight 
    // seven vertically aligned mode parameter text, kTextBottom =. 1, 2 = kTextVertMid, kTextTop. 3 = 
    // --------------------------- -------------------------------------------------- -------------------- 
    // write a text, 0,1 is left-aligned. 
    mxOcx.DrawColor = 65280;
    mxOcx.DrawText (0, 1900, "dream drawing control www.mxdraw.com 3.0", 100, 0, 0,. 1); 
    // ------------------- -------------------------------------------------- ------------------------------ 
    // write a text, 2,1 is the lower right-aligned. 
    mxOcx.DrawColor = 4556677; 
    mxOcx.DrawText (3000, 2100, "dream drawing control www.mxdraw.com 3.0", 100, -20, 2,. 1); 
    // ------------------ -------------------------------------------------- ------------------------------ 
    // specified style to draw text 
    mxOcx.AddTextStyle1 ( "MyTextStyle", "italicc.shx " , "gbcbig.shx", 0.7); 
    mxOcx.TextStyle = "MyTextStyle"; 
    mxOcx.DrawColor = 255; 
    mxOcx.DrawText (0, 3000, "dream drawing control 3.0 www.mxdraw.com", 100, 0, 0, 1);
    // ------------------------------------------------ -------------------------------------------------- 
    // write a TureType font 
    mxOcx.AddTextStyle2 ( "MyTrueTypeStyle", "black body", 0.7); 
    mxOcx.TextStyle = "MyTrueTypeStyle";
    mxOcx.DrawText (0, 3150, "dream drawing control www.mxdraw.com 3.0", 100, 0, 0,. 1); 
    mxOcx.ZoomAll (); 
    mxOcx.UpdateDisplay (); 
}

Guess you like

Origin www.cnblogs.com/yzy0224/p/11039389.html