Text with styles

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

Post Reply
zebiya
Posts: 27
Joined: 14 Feb 2007, 22:45
Location: Spain

Text with styles

Post by zebiya » 10 Jan 2008, 23:35

Hi

Could you give me some examples on how to create several texts with different styles (bold, underlined, different fonts...)

I am using CADImport.NET and VB

Thanks and happy new year

support
Posts: 3272
Joined: 30 Mar 2005, 11:36
Contact:

Post by support » 11 Jan 2008, 14:37

Hello!

Please try the following code:

Code: Select all

<font color="blue">Private Sub</font id="blue"> AddText_Click(<font color="blue">ByVal</font id="blue"> sender <font color="blue">As</font id="blue"> System.Object, <font color="blue">ByVal</font id="blue"> e <font color="blue">As</font id="blue"> System.EventArgs) <font color="blue">Handles</font id="blue"> AddText.Click
    <font color="blue">If</font id="blue"> (<font color="blue">Me</font id="blue">.cadImage <font color="blue">Is Nothing</font id="blue">) <font color="blue">Then
        Me</font id="blue">.cadImage = <font color="blue">New</font id="blue"> CADImage
        <font color="blue">Me</font id="blue">.cadImage.InitialNewImage()
        <font color="blue">Me</font id="blue">.cadImage.UseDoubleBuffering() = <font color="blue">False
    End If

    Me</font id="blue">.cadImage.Converter.PointDisplayMode = 0
    <font color="blue">Me</font id="blue">.cadImage.UseDoubleBuffering = <font color="blue">False</font id="blue">
    Dim text As CADText = <font color="blue">New</font id="blue"> CADText
    Dim st1 As CADStyle = <font color="blue">New</font id="blue"> CADStyle
    st1.FontName = "txt"
    text.SetStyle(st1)
    text.Color = Color.Red
    text.Point = <font color="blue">New</font id="blue"> DPoint(0, 0, 0)
    text.Height = 10
    text.Rotation = 0
    text.Text = "Hello World!!"
    text.LineWeight = 0.1
    text.Loaded(<font color="blue">Me</font id="blue">.cadImage.Converter)
    <font color="blue">Me</font id="blue">.cadImage.CurrentLayout.Entities.Add(text)
    <font color="blue">Me</font id="blue">.cadImage.Converter.OnCreate(text)
    <font color="blue">Me</font id="blue">.cadPictBox.Invalidate()
<font color="blue">End Sub</font id="blue">
Texs parameters must be changed through the CADStyle.

Sergey.

Please post questions to the forum or write to support@cadsofttools.com

zebiya
Posts: 27
Joined: 14 Feb 2007, 22:45
Location: Spain

Post by zebiya » 16 Jan 2008, 21:42

Thanks Sergey, very useful.

Could you explain to me the effects of this line?

Me.cadImage.Converter.PointDisplayMode = 0

Besides Ñ—Which fontnames can I use?

Thanks again

Alfredo

support
Posts: 3272
Joined: 30 Mar 2005, 11:36
Contact:

Post by support » 18 Jan 2008, 12:32

<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">Could you explain to me the effects of this line?

Me.cadImage.Converter.PointDisplayMode = 0<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
Property CADConverter.PointDisplayMode - gets or sets a value indicating a mode of displaying the CADPoint entities in the loaded CAD image.
Returns 0 if CADPoints are visible; returns 1 if CADPoints are invisible.
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">Besides Ñ—Which fontnames can I use?<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
What ever you need.

Sergey.





Please post questions to the forum or write to support@cadsofttools.com

Post Reply