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

C#

 
GeneralRe: Directory Picker Pin
bertcox19-Apr-04 4:03
bertcox19-Apr-04 4:03 
Generalc++ client for c# server Pin
rana7419-Apr-04 2:04
rana7419-Apr-04 2:04 
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 
Ok, a better explenation:
I have made a user control that simple draws a circle and will fill that circle with a color defined in the config file. Then I want to drag this user control out on my main form but when I do this the following error occurs:
"An exception occured while trying to create an instance of xxxx. The excepiton was "ColorConverter cannot convert from (null)"."
The config file is named app.config is in the same directory as the user control and contains

add key="ColorClosed" value="#FF0000"

Now my code looks like this in the user control:

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

The method that draws the circle looks like this;

private void CircleControl_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
Graphics dc = this.CreateGraphics();

dc.DrawEllipse(blackPen, 0, 0, 40, 40);

if(_status == Switch.Open)
{
dc.DrawRectangle(blackPen, 0, 15, 40, 10);
dc.FillRectangle(greenBrush, 0, 15, 40, 10);
}
else if(_status == Switch.Closed)
{
dc.DrawRectangle(blackPen, 15, 0, 10, 40);
dc.FillRectangle(redBrush, 15, 0, 10, 40);
}
else if(_status == Switch.Intermediate)
{
dc.FillEllipse(yellowBrush, 0, 0, 40, 40);
}
else
{
}
}
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 
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 

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.