<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re : VB.NET Mtext style in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/vb-net-mtext-style/m-p/6025622#M37222</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;_gile, SENL1362 Thanks for the help I can know use&amp;nbsp;Mtext style&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;sgear&lt;/P&gt;</description>
    <pubDate>Fri, 05 Feb 2016 09:49:55 GMT</pubDate>
    <dc:creator>Sgear</dc:creator>
    <dc:date>2016-02-05T09:49:55Z</dc:date>
    <item>
      <title>VB.NET Mtext style</title>
      <link>https://forums.autodesk.com/t5/net-forum/vb-net-mtext-style/m-p/6023582#M37218</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I set style to mtext&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Sgear&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;           Dim objIniFile As New clsIni("c:\file\text.ini")

            Dim doc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
            Dim ed As Editor = doc.Editor
            Dim db As Database = doc.Database
            Dim tr As Transaction = db.TransactionManager.StartTransaction()
            ed.Regen()
            Using tr

                Dim pt As Point3d = ed.GetPoint(vbLf &amp;amp; "Select: ").Value
                Dim mtx As New MText()
                mtx.Location = pt
                mtx.SetDatabaseDefaults()
                mtx.TextHeight = 1

                mtx.Width = 35
       
                Dim HK = objIniFile.GetString("MAIN", "HK", "")
                Dim TP1 = objIniFile.GetString("MAIN", "TP1", "")
                Dim TP2 = objIniFile.GetString("MAIN", "TP2", "")
                Dim TP3 = " " + objIniFile.GetString("MAIN", "TP3", "")
                Dim TP4 = objIniFile.GetString("MAIN", "TP4", "")

            
                mtx.Contents = ("{\C1;" + HK + "}\P" + ("{\C1;" + TP1 + "}\P" + ("{\C1;" + TP2 + "}" + ("{\C3;" + TP3 + "}\P" + ("{\C3;" + TP4 + "}\P")))))


                mtx.SetAttachmentMovingLocation(mtx.Attachment)
                Dim btr As BlockTableRecord = DirectCast(tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite), BlockTableRecord)
                btr.AppendEntity(mtx)
                tr.AddNewlyCreatedDBObject(mtx, True)
                tr.Commit()
            End Using&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Feb 2016 09:20:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/vb-net-mtext-style/m-p/6023582#M37218</guid>
      <dc:creator>Sgear</dc:creator>
      <dc:date>2016-02-04T09:20:17Z</dc:date>
    </item>
    <item>
      <title>Re : VB.NET Mtext style</title>
      <link>https://forums.autodesk.com/t5/net-forum/vb-net-mtext-style/m-p/6023697#M37219</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did you try setting MText.TextStyleId property ?&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2016 10:57:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/vb-net-mtext-style/m-p/6023697#M37219</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2016-02-04T10:57:37Z</dc:date>
    </item>
    <item>
      <title>Re: VB.NET Mtext style</title>
      <link>https://forums.autodesk.com/t5/net-forum/vb-net-mtext-style/m-p/6023706#M37220</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;              string textStyleName = "MtextStyle";
                using (Transaction tr=db.TransactionManager.StartTransaction())
                {
                    var tsId = db.Textstyle;
                    var ts = (TextStyleTable)tr.GetObject(db.TextStyleTableId, OpenMode.ForRead);
                    if (ts.Has(textStyleName))
                        tsId = ts[textStyleName];

                    var mtext = new MText();
                    mtext.SetDatabaseDefaults();
                    mtext.TextStyleId = tsId;
                    ...


                    tr.Commit();
                }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2016 11:06:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/vb-net-mtext-style/m-p/6023706#M37220</guid>
      <dc:creator>SENL1362</dc:creator>
      <dc:date>2016-02-04T11:06:01Z</dc:date>
    </item>
    <item>
      <title>Re : VB.NET Mtext style</title>
      <link>https://forums.autodesk.com/t5/net-forum/vb-net-mtext-style/m-p/6023709#M37221</link>
      <description>sorry Gile.</description>
      <pubDate>Thu, 04 Feb 2016 11:08:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/vb-net-mtext-style/m-p/6023709#M37221</guid>
      <dc:creator>SENL1362</dc:creator>
      <dc:date>2016-02-04T11:08:10Z</dc:date>
    </item>
    <item>
      <title>Re : VB.NET Mtext style</title>
      <link>https://forums.autodesk.com/t5/net-forum/vb-net-mtext-style/m-p/6025622#M37222</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;_gile, SENL1362 Thanks for the help I can know use&amp;nbsp;Mtext style&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;sgear&lt;/P&gt;</description>
      <pubDate>Fri, 05 Feb 2016 09:49:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/vb-net-mtext-style/m-p/6025622#M37222</guid>
      <dc:creator>Sgear</dc:creator>
      <dc:date>2016-02-05T09:49:55Z</dc:date>
    </item>
    <item>
      <title>Re: VB.NET Mtext style</title>
      <link>https://forums.autodesk.com/t5/net-forum/vb-net-mtext-style/m-p/6845559#M37223</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i think this will be my code (what a english&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://forums.autodesk.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt; ).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;string textStyleName = "MtextStyle";
                using (Transaction tr=db.TransactionManager.StartTransaction())
                {
                    var tsId = db.Textstyle;
                    var ts = (TextStyleTable)tr.GetObject(db.TextStyleTableId, OpenMode.ForRead);
                    if (ts.Has(textStyleName))
                        tsId = ts[textStyleName];

                    var mtext = new MText();
                    mtext.SetDatabaseDefaults();
                    mtext.TextStyleId = tsId;
                    ...


                    tr.Commit();
                }&lt;/PRE&gt;&lt;P&gt;my problem is to us in vb.net.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my try looks like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;                        If TextStyleName.Length &amp;gt; 0 Then

                            Dim ts As TextStyleTable
                            Dim tsID As Autodesk.AutoCAD.DatabaseServices.TextStyleTableRecord
                            ts = CType(acTrans.GetObject(acCurDb.TextStyleTableId, Autodesk.AutoCAD.DatabaseServices.OpenMode.ForWrite), TextStyleTable)
                            If ts.Has(TextStyleName) = True Then

                            End If
                        End If&lt;/PRE&gt;&lt;P&gt;.. but then my knowledge is end.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;could someone help me?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regards Jan&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 10:56:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/vb-net-mtext-style/m-p/6845559#M37223</guid>
      <dc:creator>jan_tappenbeck</dc:creator>
      <dc:date>2017-02-01T10:56:30Z</dc:date>
    </item>
    <item>
      <title>Re: VB.NET Mtext style</title>
      <link>https://forums.autodesk.com/t5/net-forum/vb-net-mtext-style/m-p/6845877#M37224</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;If TextStyleName.Length &amp;gt; 0 Then
    ' initialize tsId with current text style ID
    Dim tsId As ObjectId = acCurDb.Textstyle
    Dim ts As TextStyleTable = CType(acTrans.GetObject(acCurDb.TextStyleTableId, OpenMode.ForRead), TextStyleTable)
	
    ' if the text style table contains a text style named as TextStyleName, set tsId with this text style ID
    If ts.Has(TextStyleName) Then
        tsId = ts(TextStyleName)
    End If
	
    Dim mtext As MText = new MText();
    mtext.SetDatabaseDefaults();
    mtext.TextStyleId = tsId;&lt;BR /&gt;    '...
	
End If&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As it looks like you just start learning .NET, I'd suggest you to learn C# instead of VB, because, as you can see you'll need, at least, to be able to read C# examples, even if you learn VB...&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 13:11:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/vb-net-mtext-style/m-p/6845877#M37224</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2017-02-01T13:11:31Z</dc:date>
    </item>
    <item>
      <title>Re: VB.NET Mtext style</title>
      <link>https://forums.autodesk.com/t5/net-forum/vb-net-mtext-style/m-p/6846042#M37225</link>
      <description>&lt;P&gt;Dear &lt;STRONG&gt;Gilles,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;since 1,5 years i work by vb.net to AutoCAD - but Primary in topobase map.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;in last 2 month i need more or less direct AutoCAD entities!&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;you understand?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;reagards Jan&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 14:00:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/vb-net-mtext-style/m-p/6846042#M37225</guid>
      <dc:creator>jan_tappenbeck</dc:creator>
      <dc:date>2017-02-01T14:00:10Z</dc:date>
    </item>
  </channel>
</rss>

