.NET
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
FromColor
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
94 Views, 7 Replies
09-08-2005 02:45 PM
I'm executing the following statement (or trying to at least):
Autodesk.AutoCAD.Colors.Color acadColor =
Autodesk.AutoCAD.Colors.Color.FromColor( System.Drawing.Color.Yellow );
This throws an exception with the message "eInvalidInput"
Any ideas why this command is throwing an expection?
Autodesk.AutoCAD.Colors.Color acadColor =
Autodesk.AutoCAD.Colors.Color.FromColor( System.Drawing.Color.Yellow );
This throws an exception with the message "eInvalidInput"
Any ideas why this command is throwing an expection?
Re: FromColor
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
09-09-2005 04:27 AM in reply to:
davidgarner
I use the FromRgb:
Dim color As Autodesk.AutoCAD.Colors.Color
color = Autodesk.AutoCAD.Colors.Color.FromRgb(255, 255, 255)
Dim color As Autodesk.AutoCAD.Colors.Color
color = Autodesk.AutoCAD.Colors.Color.FromRgb(255, 255, 255)
Re: FromColor
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
09-09-2005 09:11 AM in reply to:
davidgarner
Thanks Mikko
Yes, the FromRgb method works fine.
But, what is wrong with the Autodesk.AutoCAD.Colors.Color.FromColor( System.Drawing.Color) method.
My code is passes a System.Drawing.Color enumeration and I don't want to have to convert it to RGB.
it makes for really ugly code
Autodesk.AutoCAC.Colors.Color.FromRgb( System.Drawing.Color.Yellow.R, System.Drawing.Color.Yellow.G, System.Drawing.Color.Yellow.B )
Yes, the FromRgb method works fine.
But, what is wrong with the Autodesk.AutoCAD.Colors.Color.FromColor( System.Drawing.Color) method.
My code is passes a System.Drawing.Color enumeration and I don't want to have to convert it to RGB.
it makes for really ugly code
Autodesk.AutoCAC.Colors.Color.FromRgb( System.Drawing.Color.Yellow.R, System.Drawing.Color.Yellow.G, System.Drawing.Color.Yellow.B )
Re: FromColor
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
09-09-2005 10:01 AM in reply to:
davidgarner
I'd use numeric numbers.
Autodesk.AutoCAD.Colors.Color.FromRgb(255, 255, 0)
Autodesk.AutoCAD.Colors.Color.FromRgb(255, 255, 0)
Re: FromColor
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
09-09-2005 10:23 AM in reply to:
davidgarner
Pehaps I havn't made myself clear.
I'm trying to find out why the FromColor method throws an exception when passed a System.Drawing.Color enumerated value.
My code recieves as a parameter a System.Drawing.Color (not three RGB values). While I can use the System.Drawing.Color.R and .B and .G properties and the FromRgb method, it is much clearer code to use the variable that is passed.
So, once again I'll ask, what am I doing wrong that is causing the FromColor method to throw an exception?
I'm trying to find out why the FromColor method throws an exception when passed a System.Drawing.Color enumerated value.
My code recieves as a parameter a System.Drawing.Color (not three RGB values). While I can use the System.Drawing.Color.R and .B and .G properties and the FromRgb method, it is much clearer code to use the variable that is passed.
So, once again I'll ask, what am I doing wrong that is causing the FromColor method to throw an exception?
Re: FromColor
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
09-09-2005 11:41 AM in reply to:
davidgarner
Hmm, I get that same error using FromColor. FromColorIndex works. I have no idea how to use FromColor. Might look at that at another time.
Autodesk.AutoCAD.Colors.Color.FromColorIndex(Color Method.ByAci, 2)
Autodesk.AutoCAD.Colors.Color.FromColorIndex(Color
*Tony Tanzillo
Re: FromColor
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
09-09-2005 02:02 PM in reply to:
davidgarner
Because its broken.
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com
wrote in message news:4951971@discussion.autodesk.com...
Pehaps I havn't made myself clear.
I'm trying to find out why the FromColor method throws an exception when passed a System.Drawing.Color enumerated value.
My code recieves as a parameter a System.Drawing.Color (not three RGB values). While I can use the System.Drawing.Color.R and .B and .G properties and the FromRgb method, it is much clearer code to use the variable that is passed.
So, once again I'll ask, what am I doing wrong that is causing the FromColor method to throw an exception?
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com
Pehaps I havn't made myself clear.
I'm trying to find out why the FromColor method throws an exception when passed a System.Drawing.Color enumerated value.
My code recieves as a parameter a System.Drawing.Color (not three RGB values). While I can use the System.Drawing.Color.R and .B and .G properties and the FromRgb method, it is much clearer code to use the variable that is passed.
So, once again I'll ask, what am I doing wrong that is causing the FromColor method to throw an exception?
*Albert Szilvasy
Re: FromColor
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
09-11-2005 11:13 AM in reply to:
davidgarner
Indeed this is a bug. I'll make sure that it gets fixed.
Albert
"Tony Tanzillo" wrote in message
news:4952333@discussion.autodesk.com...
Because its broken.
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com
wrote in message news:4951971@discussion.autodesk.com...
Pehaps I havn't made myself clear.
I'm trying to find out why the FromColor method throws an exception when
passed a System.Drawing.Color enumerated value.
My code recieves as a parameter a System.Drawing.Color (not three RGB
values). While I can use the System.Drawing.Color.R and .B and .G
properties and the FromRgb method, it is much clearer code to use the
variable that is passed.
So, once again I'll ask, what am I doing wrong that is causing the FromColor
method to throw an exception?
Albert
"Tony Tanzillo"
news:4952333@discussion.autodesk.com...
Because its broken.
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com
Pehaps I havn't made myself clear.
I'm trying to find out why the FromColor method throws an exception when
passed a System.Drawing.Color enumerated value.
My code recieves as a parameter a System.Drawing.Color (not three RGB
values). While I can use the System.Drawing.Color.R and .B and .G
properties and the FromRgb method, it is much clearer code to use the
variable that is passed.
So, once again I'll ask, what am I doing wrong that is causing the FromColor
method to throw an exception?
