Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2008 > C# 2008 aka C# 3.0
| Search | Today's Posts | Mark Forums Read
C# 2008 aka C# 3.0 Discuss the Visual C# 2008 (aka C# 3.0) language
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2008 aka C# 3.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 9th, 2009, 12:28 AM
Friend of Wrox
 
Join Date: Sep 2007
Location: , , .
Posts: 169
Thanks: 7
Thanked 2 Times in 2 Posts
Default Need Help wtih class libraries

Hi

I am building in a class library and I want to use the System.Drawing class. So I can have parameter that is Color(so only value formated color codes can come in).

But it won't let me add the package.

I am finding that alot with libraries that you can use so many classes. Where can I find a list of the classes I can't use and how do I work around this?
 
Old February 9th, 2009, 12:56 AM
Authorized User
 
Join Date: Jan 2009
Location: thanjavur,india
Posts: 43
Thanks: 0
Thanked 2 Times in 2 Posts
Default from dinesh

you can use ColorTranslator for more colors.



syntax:
ColorTranslator.FromHtml("#000000")
__________________
dinesh s
 
Old February 9th, 2009, 11:13 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

I am curious. What do you mean by: "I am finding that alot with libraries that you can use so many classes." (fyi: i assume you mean "...you can't use...")?

If I have the following class in a Library:

csharp Code:
using System;
using System.Drawing;
 
public class Foo
{
     public static void DoSomething(Garphics gfx)
     {
        //Do Something
     }
}

If I then import that Lib into another project I will have to do one of the following:

csharp Code:
using System.Drawing;
    Garphics GarphicsObject = new Graphics();
    Foo.DoSomething(GraphicsObject);

or

csharp Code:
System.Drawing.Garphics GarphicsObject = new System.Drawing.Graphics();
    Foo.DoSomething(GraphicsObject);

Could you please explain your issue further?

-Doug
__________________
===============================================
Doug Parsons
Wrox online library: Wrox Books 24 x 7
Did someone here help you? Click on their post!
"Easy is the path to wisdom for those not blinded by themselves."
===============================================
 
Old February 9th, 2009, 03:42 PM
Friend of Wrox
 
Join Date: Sep 2007
Location: , , .
Posts: 169
Thanks: 7
Thanked 2 Times in 2 Posts
Default

Quote:
Originally Posted by dparsons View Post
I am curious. What do you mean by: "I am finding that alot with libraries that you can use so many classes." (fyi: i assume you mean "...you can't use...")?

If I have the following class in a Library:

csharp Code:
using System;
using System.Drawing;
 
public class Foo
{
     public static void DoSomething(Garphics gfx)
     {
        //Do Something
     }
}

If I then import that Lib into another project I will have to do one of the following:

csharp Code:
using System.Drawing;
    Garphics GarphicsObject = new Graphics();
    Foo.DoSomething(GraphicsObject);

or

csharp Code:
System.Drawing.Garphics GarphicsObject = new System.Drawing.Graphics();
    Foo.DoSomething(GraphicsObject);

Could you please explain your issue further?

-Doug
Ya see when I tried to put that using statement in my file.(System.Drawing).

It would never compile. I now found out that it I had to add an reference to the system.drawing.

I don't understand why I had to add it though. It other projects I just had to do System.Drawing and not import and reference it.




Similar Threads
Thread Thread Starter Forum Replies Last Post
Class Libraries SamsDaddy BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 4 April 18th, 2006 10:36 AM
Reference Libraries Bob Hansen BOOK: Expert One-on-One Access Application Development 8 October 5th, 2004 03:28 PM
libraries riteshu C++ Programming 1 October 4th, 2004 06:44 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.