.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Table Cell Content Color - Trouble

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
Anonymous
910 Views, 6 Replies

Table Cell Content Color - Trouble

I'm in great need of help!!
I'm using c# and I've created a table & i want to give certain cells' contents in that table a different color:
my table is called: t1

AcadDocument myDocument;

t1.SetCellContentColor(row,column, AcadAcCmColor)

I can't understand this "AcadAcCmColor"

I've tried this code:
AcadAcCmColor color = myDocument.application.GetInterfaceObject("AutoCAD.AcCmColor.16");
color.SetRGB(255,0,0);
t1.SetCellContentColor(2,1,color);

but i get this error
Run-Time Error ... Problem in loading application

please help me step by step to set the color of this cell

Thank you
6 REPLIES 6
Message 2 of 7
Anonymous
in reply to: Anonymous

Call GetCellColor() or whatever the name of the method that
returns the existing color is, modify the resulting AcadAcCmColor
object it returns, and then pass that to SetCellContentColor()

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2008
Supporting AutoCAD 2000 through 2008
http://www.acadxtabs.com

wrote in message news:5831411@discussion.autodesk.com...
I'm in great need of help!!
I'm using c# and I've created a table & i want to give certain cells' contents in that table a different color:
my table is called: t1

AcadDocument myDocument;

t1.SetCellContentColor(row,column, AcadAcCmColor)

I can't understand this "AcadAcCmColor"

I've tried this code:
AcadAcCmColor color = myDocument.application.GetInterfaceObject("AutoCAD.AcCmColor.16");
color.SetRGB(255,0,0);
t1.SetCellContentColor(2,1,color);

but i get this error
Run-Time Error ... Problem in loading application

please help me step by step to set the color of this cell

Thank you
Message 3 of 7
Anonymous
in reply to: Anonymous

Tony Tanzillo , Thank You, man
It worked like a charm
Thanx a million 🙂
Message 4 of 7
Anonymous
in reply to: Anonymous

Hi I'm having a similar issue, trying to set the colour variables, using ColorIndex:

 

my code is as follows:

 

AcadAcCmColor col;
AcadAcCmColor col2;
AcadAcCmColor col3;

 

col.ColorIndex = 90;

col.ColorIndex = 253;

col.ColorIndex = 3;

 

PressTable.SetCellContentColor(LstRow, 0, col3);

 

Can anyone point me in the right direction?

Message 5 of 7
_gile
in reply to: Anonymous

Hi,

 

it looks like you're assigning the ColorIndex property 3 times to same instance (col)...



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 6 of 7
Anonymous
in reply to: _gile

sorry that was a typo

 

AcadAcCmColor col;
AcadAcCmColor col2;
AcadAcCmColor col3;

 

col.ColorIndex = 90;

col2.ColorIndex = 253;

col3.ColorIndex = 3;

 

PressTable.SetCellContentColor(LstRow, 0, col3);

 

the error is the color index not being set, the variables need to be a AcadAcCmColor to work in the SetCellContentColour method.

 

Regards,

Message 7 of 7
_gile
in reply to: Anonymous

You need to create new instances of AcadAcCmColor before assigning them a color. An then, use the AcColor enum for the color index value.

 

 

AcadAcCmColor col = new AcadAcCmColor();
col.ColorIndex = (AcColor)3; // or AcColor.acGreen;
PressTable.SetCellContentColor(0, 0, col);

 

But if you can use the .NET API instead of the COM API, you can simply do:

 

table.Cells[0, 0].ContentColor = Color.FromColorIndex(ColorMethod.ByAci, 3);

 



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report