<?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 How to new a TextStyle? And then set it current? in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-to-new-a-textstyle-and-then-set-it-current/m-p/3109664#M59908</link>
    <description>&lt;P&gt;Hello.I want to set a TestStyle,so I can control the fontsize,fontname,etc.Is there anyone who have done that before,Can your code be shared with us? Thank you.&lt;/P&gt;</description>
    <pubDate>Sat, 30 Jul 2011 11:22:22 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2011-07-30T11:22:22Z</dc:date>
    <item>
      <title>How to new a TextStyle? And then set it current?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-new-a-textstyle-and-then-set-it-current/m-p/3109664#M59908</link>
      <description>&lt;P&gt;Hello.I want to set a TestStyle,so I can control the fontsize,fontname,etc.Is there anyone who have done that before,Can your code be shared with us? Thank you.&lt;/P&gt;</description>
      <pubDate>Sat, 30 Jul 2011 11:22:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-new-a-textstyle-and-then-set-it-current/m-p/3109664#M59908</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-07-30T11:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to new a TextStyle? And then set it current?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-new-a-textstyle-and-then-set-it-current/m-p/3109710#M59909</link>
      <description>&lt;P&gt;Here is one way you can go about it:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Document curDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;&lt;BR /&gt;Database db = curDoc.Database;&lt;BR /&gt;Editor ed = curDoc.Editor;&lt;/P&gt;&lt;P&gt;TextStyleTableRecord txtStyle = new TextStyleTableRecord();&lt;BR /&gt;txtStyle.Name = "My Style";&lt;BR /&gt;txtStyle.Font = new Autodesk.AutoCAD.GraphicsInterface.FontDescriptor("Symbol", false, false, 0, 0);&lt;BR /&gt;txtStyle.Annotative = AnnotativeStates.True;&lt;BR /&gt;txtStyle.TextSize = 0.125;&lt;/P&gt;&lt;P&gt;using (Transaction trans = db.TransactionManager.StartTransaction())&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;TextStyleTable tab = (TextStyleTable)db.TextStyleTableId.GetObject(OpenMode.ForWrite);&lt;BR /&gt;&amp;nbsp;tab.Add(txtStyle);&lt;BR /&gt;&amp;nbsp;trans.AddNewlyCreatedDBObject(txtStyle, true);&lt;BR /&gt;&amp;nbsp;db.Textstyle = txtStyle.Id;&lt;BR /&gt;&amp;nbsp;trans.Commit();&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Sat, 30 Jul 2011 15:00:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-new-a-textstyle-and-then-set-it-current/m-p/3109710#M59909</guid>
      <dc:creator>cadMeUp</dc:creator>
      <dc:date>2011-07-30T15:00:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to new a TextStyle? And then set it current?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-new-a-textstyle-and-then-set-it-current/m-p/3739762#M59910</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how can I show what is the current TextStyle ??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this show me my style, but I know what is this name:&lt;/P&gt;&lt;PRE&gt;textStyleId = textStyleTable["MyTextStyle"];
TextStyleTableRecord style = tr.GetObject(textStyleId, OpenMode.ForRead) as TextStyleTableRecord;
string sTx = style.Name;

ed.WrittenMessage("\nCurrent Text Style: {0}", sTx);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;but If I don't??&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;textStyleId = textStyleTable[??];  // - I want to know name current TextStyle
TextStyleTableRecord style = tr.GetObject(textStyleId, OpenMode.ForRead) as TextStyleTableRecord;
string sTx = style.Name;
 
ed.WrittenMessage("\nCurrent Text Style: {0}", sTx);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;regards&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Dec 2012 12:56:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-new-a-textstyle-and-then-set-it-current/m-p/3739762#M59910</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-12-19T12:56:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to new a TextStyle? And then set it current?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-new-a-textstyle-and-then-set-it-current/m-p/3739778#M59911</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if you have access to your database you also have access to the property &lt;FONT color="#666699" face="lucida sans unicode,lucida sans"&gt;.Textstyle&lt;/FONT&gt; (e.g. &lt;FONT color="#666699" face="lucida sans unicode,lucida sans"&gt;AcadDocDB.Textstyle&lt;/FONT&gt;) which gives you the ObjectID for the TextStyleTableRecord.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- alfred -&lt;/P&gt;</description>
      <pubDate>Wed, 19 Dec 2012 13:13:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-new-a-textstyle-and-then-set-it-current/m-p/3739778#M59911</guid>
      <dc:creator>Alfred.NESWADBA</dc:creator>
      <dc:date>2012-12-19T13:13:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to new a TextStyle? And then set it current?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-new-a-textstyle-and-then-set-it-current/m-p/3739818#M59912</link>
      <description>&lt;P&gt;Hi Alfred,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you it's work &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#3366FF"&gt;TextStyleTableRecord style = tr.GetObject(db.Textstyle, OpenMode.ForRead) as TextStyleTableRecord;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt; string sTx = style.Name;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;</description>
      <pubDate>Wed, 19 Dec 2012 13:50:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-new-a-textstyle-and-then-set-it-current/m-p/3739818#M59912</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-12-19T13:50:11Z</dc:date>
    </item>
  </channel>
</rss>

