<?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 Background mask for Multiline Attribute In Block in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/background-mask-for-multiline-attribute-in-block/m-p/7755568#M27537</link>
    <description>&lt;P&gt;This doesn't seem to turn on the background mask for a multiline attribute in a block. Anyone know what will?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;BlockReference blkRef = (BlockReference)tr.GetObject(blkId, OpenMode.ForRead);
                            BlockTableRecord btr = (BlockTableRecord)tr.GetObject(blkRef.BlockTableRecord, OpenMode.ForRead);
                            AttributeCollection attCol = blkRef.AttributeCollection;
                            foreach (ObjectId attId in attCol)
                            {
                                AttributeReference attRef = (AttributeReference)tr.GetObject(attId, OpenMode.ForRead);
 
                                if (attRef.IsMTextAttribute)
                                {
                                    btr.UpgradeOpen();
                                    attRef.UpgradeOpen();        
                                    attRef.MTextAttribute.BackgroundFillColor = Autodesk.AutoCAD.Colors.Color.FromColorIndex(Autodesk.AutoCAD.Colors.ColorMethod.None, 198);
                                    attRef.MTextAttribute.UseBackgroundColor = false;
                                    attRef.UpdateMTextAttribute();
                                    blkRef.RecordGraphicsModified(true);&lt;/PRE&gt;</description>
    <pubDate>Tue, 06 Feb 2018 15:32:51 GMT</pubDate>
    <dc:creator>brianchapmandesign</dc:creator>
    <dc:date>2018-02-06T15:32:51Z</dc:date>
    <item>
      <title>Background mask for Multiline Attribute In Block</title>
      <link>https://forums.autodesk.com/t5/net-forum/background-mask-for-multiline-attribute-in-block/m-p/7755568#M27537</link>
      <description>&lt;P&gt;This doesn't seem to turn on the background mask for a multiline attribute in a block. Anyone know what will?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;BlockReference blkRef = (BlockReference)tr.GetObject(blkId, OpenMode.ForRead);
                            BlockTableRecord btr = (BlockTableRecord)tr.GetObject(blkRef.BlockTableRecord, OpenMode.ForRead);
                            AttributeCollection attCol = blkRef.AttributeCollection;
                            foreach (ObjectId attId in attCol)
                            {
                                AttributeReference attRef = (AttributeReference)tr.GetObject(attId, OpenMode.ForRead);
 
                                if (attRef.IsMTextAttribute)
                                {
                                    btr.UpgradeOpen();
                                    attRef.UpgradeOpen();        
                                    attRef.MTextAttribute.BackgroundFillColor = Autodesk.AutoCAD.Colors.Color.FromColorIndex(Autodesk.AutoCAD.Colors.ColorMethod.None, 198);
                                    attRef.MTextAttribute.UseBackgroundColor = false;
                                    attRef.UpdateMTextAttribute();
                                    blkRef.RecordGraphicsModified(true);&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Feb 2018 15:32:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/background-mask-for-multiline-attribute-in-block/m-p/7755568#M27537</guid>
      <dc:creator>brianchapmandesign</dc:creator>
      <dc:date>2018-02-06T15:32:51Z</dc:date>
    </item>
    <item>
      <title>Re: Background mask for Multiline Attribute In Block</title>
      <link>https://forums.autodesk.com/t5/net-forum/background-mask-for-multiline-attribute-in-block/m-p/7755749#M27538</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@friendfromarea51 wrote:&lt;BR /&gt;
&lt;P&gt;This doesn't seem to turn on the background mask for a multiline attribute in a block. Anyone know what will?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;BlockReference blkRef = (BlockReference)tr.GetObject(blkId, OpenMode.ForRead);
                            BlockTableRecord btr = (BlockTableRecord)tr.GetObject(blkRef.BlockTableRecord, OpenMode.ForRead);
                            AttributeCollection attCol = blkRef.AttributeCollection;
                            foreach (ObjectId attId in attCol)
                            {
                                AttributeReference attRef = (AttributeReference)tr.GetObject(attId, OpenMode.ForRead);
 
                                if (attRef.IsMTextAttribute)
                                {
                                    btr.UpgradeOpen();
                                    attRef.UpgradeOpen();        
                                    attRef.MTextAttribute.BackgroundFillColor = Autodesk.AutoCAD.Colors.Color.FromColorIndex(Autodesk.AutoCAD.Colors.ColorMethod.None, 198);
                                    &lt;FONT color="#FF0000"&gt;attRef.MTextAttribute.UseBackgroundColor = false;&lt;/FONT&gt;
                                    attRef.UpdateMTextAttribute();
                                    blkRef.RecordGraphicsModified(true);&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Just having a quick look at your code, did you try with true instead?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;FONT color="#FF0000"&gt;attRef.MTextAttribute.UseBackgroundColor = true;&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2018 16:12:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/background-mask-for-multiline-attribute-in-block/m-p/7755749#M27538</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2018-02-06T16:12:46Z</dc:date>
    </item>
    <item>
      <title>Re: Background mask for Multiline Attribute In Block</title>
      <link>https://forums.autodesk.com/t5/net-forum/background-mask-for-multiline-attribute-in-block/m-p/7756136#M27539</link>
      <description>&lt;P&gt;Thanks Gile, I did &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; Appears to not work either.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2018 18:06:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/background-mask-for-multiline-attribute-in-block/m-p/7756136#M27539</guid>
      <dc:creator>brianchapmandesign</dc:creator>
      <dc:date>2018-02-06T18:06:39Z</dc:date>
    </item>
    <item>
      <title>Re: Background mask for Multiline Attribute In Block</title>
      <link>https://forums.autodesk.com/t5/net-forum/background-mask-for-multiline-attribute-in-block/m-p/7756327#M27540</link>
      <description>&lt;P&gt;Here is the source for the AttributeReference.MTextAttribute property:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;// Autodesk.AutoCAD.DatabaseServices.AttributeReference
public MText MTextAttribute
{
	get
	{
		IntPtr unmanagedObjPtr = new IntPtr(&amp;lt;Module&amp;gt;.AcDbAttribute.getMTextAttribute(this.GetImpObj()));
		return new MText(unmanagedObjPtr, false);
	}
	set
	{
		int num = (int)&amp;lt;Module&amp;gt;.AcDbAttribute.setMTextAttribute(this.GetImpObj(), value.GetImpObj());
		if (num != 0)
		{
			throw new Autodesk.AutoCAD.Runtime.Exception((ErrorStatus)num);
		}
	}
}&lt;/PRE&gt;&lt;P&gt;Each use of that property produces a new MText managed wrapper. The wrapper is not stored by the AtttribueReference, and it doesn't know or care what you do with it, other than that it must be disposed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When you do this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; attRef.MTextAttribute.BackgroundFillColor = Autodesk.AutoCAD.Colors... blah blah blah
 attRef.MTextAttribute.UseBackgroundColor = false;&lt;/PRE&gt;&lt;P&gt;you are assigning the value of one property to each of two different MText objects.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You instead have to do this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; MText mtext = attRef.MtextAttribute;
 mtext.BackgroundFillColor = Autodesk.AutoCAD.Colors... blah blah blah
 mtext.UseBackgroundColor = true;
 &lt;STRONG&gt;attRef.MtextAttribute = mtext;
 &lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@friendfromarea51 wrote:&lt;BR /&gt;&lt;P&gt;This doesn't seem to turn on the background mask for a multiline attribute in a block. Anyone know what will?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;BlockReference blkRef = (BlockReference)tr.GetObject(blkId, OpenMode.ForRead);
                            BlockTableRecord btr = (BlockTableRecord)tr.GetObject(blkRef.BlockTableRecord, OpenMode.ForRead);
                            AttributeCollection attCol = blkRef.AttributeCollection;
                            foreach (ObjectId attId in attCol)
                            {
                                AttributeReference attRef = (AttributeReference)tr.GetObject(attId, OpenMode.ForRead);
 
                                if (attRef.IsMTextAttribute)
                                {
                                    btr.UpgradeOpen();
                                    attRef.UpgradeOpen();        
                                    &lt;FONT color="#FF0000"&gt;attRef.MTextAttribute.BackgroundFillColor = Autodesk.AutoCAD.Colors.Color.FromColorIndex(Autodesk.AutoCAD.Colors.ColorMethod.None, 198);
                                    attRef.MTextAttribute.UseBackgroundColor = false;&lt;/FONT&gt;
                                    attRef.UpdateMTextAttribute();
                                    blkRef.RecordGraphicsModified(true);&lt;/PRE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2018 19:06:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/background-mask-for-multiline-attribute-in-block/m-p/7756327#M27540</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2018-02-06T19:06:28Z</dc:date>
    </item>
    <item>
      <title>Re: Background mask for Multiline Attribute In Block</title>
      <link>https://forums.autodesk.com/t5/net-forum/background-mask-for-multiline-attribute-in-block/m-p/7756778#M27541</link>
      <description>&lt;P&gt;Thank you both&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2018 21:15:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/background-mask-for-multiline-attribute-in-block/m-p/7756778#M27541</guid>
      <dc:creator>brianchapmandesign</dc:creator>
      <dc:date>2018-02-06T21:15:08Z</dc:date>
    </item>
  </channel>
</rss>

