Click here to Skip to main content
15,920,896 members
Home / Discussions / C#
   

C#

 
GeneralRe: c++ client for c# server Pin
Heath Stewart19-Apr-04 3:17
protectorHeath Stewart19-Apr-04 3:17 
GeneralRe: c++ client for c# server Pin
rana7419-Apr-04 18:12
rana7419-Apr-04 18:12 
GeneralRe: c++ client for c# server Pin
Heath Stewart20-Apr-04 3:17
protectorHeath Stewart20-Apr-04 3:17 
GeneralConvert from string to Color Pin
Member 74394419-Apr-04 1:49
Member 74394419-Apr-04 1:49 
GeneralRe: Convert from string to Color Pin
Heath Stewart19-Apr-04 3:22
protectorHeath Stewart19-Apr-04 3:22 
GeneralRe: Convert from string to Color Pin
Member 74394419-Apr-04 3:40
Member 74394419-Apr-04 3:40 
GeneralRe: Convert from string to Color Pin
Heath Stewart19-Apr-04 4:01
protectorHeath Stewart19-Apr-04 4:01 
GeneralConvert from string to Color Pin
Member 74394419-Apr-04 1:44
Member 74394419-Apr-04 1:44 
I'm trying to convert a string written in a config file to a System.Drawing.Color and I have tried lots of different solutions but nothing have worked. This is the last shot a had on it:

------------------------------------------------------
app.config

<add key="ColorOpen" value="0,181,0">

------------------------------------------------------
private SolidBrush GetClosed()
{
string strClosed = System.Configuration.ConfigurationSettings.AppSettings["ColorClosed"];
string[] parts =strClosed.Split(',');

int rValue = int.Parse(parts[0]);
int gValue = int.Parse(parts[1]);
int bValue = int.Parse(parts[2]);
Color colorClosed = Color.FromArgb( rValue, gValue, bValue );

SolidBrush redBrush = new SolidBrush(colorClosed);
return redBrush;
}

------------------------------------------------------

I have also tried this:

SolidBrush redBrush = new SolidBrush((Color)TypeDescriptor.GetConverter(typeof(Color)).ConvertFromString(System.Configuration.ConfigurationSettings.AppSettings["ColorClosed"]));

---------------------------------------------------------

and this:

string strOpen = System.Configuration.ConfigurationSettings.AppSettings["ColorOpen"].ToString();

Color colorOpen = (Color)TypeDescriptor.GetConverter(typeof(Color)).ConvertFromString(strOpen);

SolidBrush greenBrush = new SolidBrush(colorOpen);

-----------------------------------------------------------

Please help me!! I'm going creazy over this!

/Anze
GeneralRe: Convert from string to Color Pin
Mike Ellison19-Apr-04 4:07
Mike Ellison19-Apr-04 4:07 
QuestionCan Fill? Pin
wokankan19-Apr-04 1:33
wokankan19-Apr-04 1:33 
AnswerRe: Can Fill? Pin
mhmoud rawas19-Apr-04 2:11
mhmoud rawas19-Apr-04 2:11 
GeneralRe: Can Fill? Pin
wokankan19-Apr-04 2:45
wokankan19-Apr-04 2:45 
GeneralRe: Can Fill? Pin
Heath Stewart19-Apr-04 3:23
protectorHeath Stewart19-Apr-04 3:23 
AnswerRe: Can Fill? Pin
Heath Stewart19-Apr-04 3:26
protectorHeath Stewart19-Apr-04 3:26 
GeneralRe: Can Fill? Pin
wokankan19-Apr-04 4:21
wokankan19-Apr-04 4:21 
GeneralNavigating tabs with MDI Application Pin
Jon G19-Apr-04 1:02
Jon G19-Apr-04 1:02 
GeneralRe: Navigating tabs with MDI Application Pin
Dave Kreskowiak19-Apr-04 1:31
mveDave Kreskowiak19-Apr-04 1:31 
GeneralRe: Navigating tabs with MDI Application Pin
Jon G19-Apr-04 1:35
Jon G19-Apr-04 1:35 
GeneralRe: Navigating tabs with MDI Application Pin
Heath Stewart19-Apr-04 3:28
protectorHeath Stewart19-Apr-04 3:28 
GeneralIf and or Pin
Appelz19-Apr-04 0:12
Appelz19-Apr-04 0:12 
GeneralRe: If and or Pin
Colin Angus Mackay19-Apr-04 0:25
Colin Angus Mackay19-Apr-04 0:25 
GeneralHave a writable datagrid using an mdb Pin
Gian18-Apr-04 23:19
Gian18-Apr-04 23:19 
GeneralRe: Have a writable datagrid using an mdb Pin
Mazdak19-Apr-04 0:30
Mazdak19-Apr-04 0:30 
GeneralRe: Have a writable datagrid using an mdb Pin
Heath Stewart19-Apr-04 3:38
protectorHeath Stewart19-Apr-04 3:38 
QuestionHow to include documentation into assmblies? Pin
occcy18-Apr-04 22:22
occcy18-Apr-04 22:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.