Click here to Skip to main content
15,844,011 members
Home / Discussions / C#
   

C#

 
GeneralRe: Searching for a file in multiple directories? Pin
OriginalGriff10-Mar-13 1:00
mveOriginalGriff10-Mar-13 1:00 
GeneralRe: Searching for a file in multiple directories? Pin
Goaty6510910-Mar-13 1:34
Goaty6510910-Mar-13 1:34 
GeneralRe: Searching for a file in multiple directories? Pin
OriginalGriff10-Mar-13 1:55
mveOriginalGriff10-Mar-13 1:55 
GeneralRe: Searching for a file in multiple directories? Pin
Goaty6510910-Mar-13 2:03
Goaty6510910-Mar-13 2:03 
GeneralRe: Searching for a file in multiple directories? Pin
OriginalGriff10-Mar-13 2:12
mveOriginalGriff10-Mar-13 2:12 
GeneralRe: Searching for a file in multiple directories? Pin
Goaty6510910-Mar-13 2:16
Goaty6510910-Mar-13 2:16 
GeneralRe: Searching for a file in multiple directories? Pin
OriginalGriff10-Mar-13 2:23
mveOriginalGriff10-Mar-13 2:23 
QuestionSuggestions: textbox background and foreground colours. Pin
Septimus Hedgehog9-Mar-13 11:58
Septimus Hedgehog9-Mar-13 11:58 
We have a Winforms form containing a textbox. The idea is that as you enter a string of hex characters these are trapped and are used to change the background colour of the texbox dynamically. So, if you enter ff0000 that would change the background colour to red. The user keystrokes are intercepted with the KeyPress and KeyDown to filter specific characters such as not allowing G, Y that sort of thing. All of this works okay and the texbox's text changed event correctly changes the colour.

The text in the textbox is mostly visible. If I set the foreground colour of the text to black there's no problem if you set the background colour to red (ff0000), blue (ff) but when you set it to black (0) or just-a-bit-away-from-black (1) you obviously can't see the text. If I set the forecolour of the text to white you get the same problem at the other end of the colour "spectrum". I thought of using grey as that's sort of midway but if you set the background colour to (808080) or near to then, well, you can see the problem! Smile | :)

The idea I hit upon and which works relatively okay is to invert the bits of the RGB and set the foreground colour to that. So, depending on what's entered you might have a background colour of slightly-purpley-reddish-orangey-blue and the text might look like whitish-green-yellow-tinged-magenta-with-a-touch-of-russet-but-not-too-much.

It works upto a point if you don't mind your foreground colour looking like it's injected pure LSD but I'm wondering if there's a more optimal solution or suggestion you'd recommend? In other words, is there a good solution so that no matter what the background colour is set to, the foreground colour of the text within it can be displayed with a best fit contrast?
If there is one thing more dangerous than getting between a bear and her cubs it's getting between my wife and her chocolate.

AnswerRe: Suggestions: textbox background and foreground colours. Pin
Ravi Bhavnani9-Mar-13 14:01
professionalRavi Bhavnani9-Mar-13 14:01 
GeneralRe: Suggestions: textbox background and foreground colours. Pin
Septimus Hedgehog10-Mar-13 0:02
Septimus Hedgehog10-Mar-13 0:02 
QuestionIf statement Pin
Sottyoru9-Mar-13 8:07
Sottyoru9-Mar-13 8:07 
AnswerRe: If statement Pin
PIEBALDconsult9-Mar-13 8:58
mvePIEBALDconsult9-Mar-13 8:58 
AnswerRe: If statement Pin
dusty_dex9-Mar-13 11:29
dusty_dex9-Mar-13 11:29 
GeneralRe: If statement Pin
PIEBALDconsult9-Mar-13 11:57
mvePIEBALDconsult9-Mar-13 11:57 
GeneralRe: If statement Pin
dusty_dex10-Mar-13 7:05
dusty_dex10-Mar-13 7:05 
AnswerRe: If statement Pin
ali_heidari_10-Mar-13 1:10
ali_heidari_10-Mar-13 1:10 
GeneralRe: If statement Pin
jschell10-Mar-13 7:19
jschell10-Mar-13 7:19 
GeneralRe: If statement Pin
ali_heidari_10-Mar-13 7:23
ali_heidari_10-Mar-13 7:23 
QuestionAbout Regex Pin
Sottyoru9-Mar-13 5:50
Sottyoru9-Mar-13 5:50 
AnswerRe: About Regex Pin
PIEBALDconsult9-Mar-13 6:09
mvePIEBALDconsult9-Mar-13 6:09 
GeneralRe: About Regex Pin
Sottyoru9-Mar-13 8:08
Sottyoru9-Mar-13 8:08 
AnswerRe: About Regex Pin
Ravi Bhavnani9-Mar-13 14:05
professionalRavi Bhavnani9-Mar-13 14:05 
QuestionSuggssion Please Pin
M VSubrahmanyam9-Mar-13 4:42
M VSubrahmanyam9-Mar-13 4:42 
AnswerRe: Suggssion Please PinPopular
OriginalGriff9-Mar-13 4:59
mveOriginalGriff9-Mar-13 4:59 
GeneralRe: Suggssion Please Pin
NotPolitcallyCorrect9-Mar-13 10:09
NotPolitcallyCorrect9-Mar-13 10:09 

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.