Click here to Skip to main content
15,878,959 members
Home / Discussions / C#
   

C#

 
GeneralRe: Searching for a file in multiple directories? Pin
OriginalGriff10-Mar-13 0:00
mveOriginalGriff10-Mar-13 0:00 
GeneralRe: Searching for a file in multiple directories? Pin
Goaty6510910-Mar-13 0:34
Goaty6510910-Mar-13 0:34 
GeneralRe: Searching for a file in multiple directories? Pin
OriginalGriff10-Mar-13 0:55
mveOriginalGriff10-Mar-13 0:55 
GeneralRe: Searching for a file in multiple directories? Pin
Goaty6510910-Mar-13 1:03
Goaty6510910-Mar-13 1:03 
GeneralRe: Searching for a file in multiple directories? Pin
OriginalGriff10-Mar-13 1:12
mveOriginalGriff10-Mar-13 1:12 
GeneralRe: Searching for a file in multiple directories? Pin
Goaty6510910-Mar-13 1:16
Goaty6510910-Mar-13 1:16 
GeneralRe: Searching for a file in multiple directories? Pin
OriginalGriff10-Mar-13 1:23
mveOriginalGriff10-Mar-13 1:23 
QuestionSuggestions: textbox background and foreground colours. Pin
Septimus Hedgehog9-Mar-13 10:58
Septimus Hedgehog9-Mar-13 10: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 13:01
professionalRavi Bhavnani9-Mar-13 13:01 
GeneralRe: Suggestions: textbox background and foreground colours. Pin
Septimus Hedgehog9-Mar-13 23:02
Septimus Hedgehog9-Mar-13 23:02 
QuestionIf statement Pin
Sottyoru9-Mar-13 7:07
Sottyoru9-Mar-13 7:07 
AnswerRe: If statement Pin
PIEBALDconsult9-Mar-13 7:58
mvePIEBALDconsult9-Mar-13 7:58 
AnswerRe: If statement Pin
dusty_dex9-Mar-13 10:29
dusty_dex9-Mar-13 10:29 
GeneralRe: If statement Pin
PIEBALDconsult9-Mar-13 10:57
mvePIEBALDconsult9-Mar-13 10:57 
GeneralRe: If statement Pin
dusty_dex10-Mar-13 6:05
dusty_dex10-Mar-13 6:05 
AnswerRe: If statement Pin
ali_heidari_10-Mar-13 0:10
ali_heidari_10-Mar-13 0:10 
GeneralRe: If statement Pin
jschell10-Mar-13 6:19
jschell10-Mar-13 6:19 
GeneralRe: If statement Pin
ali_heidari_10-Mar-13 6:23
ali_heidari_10-Mar-13 6:23 
QuestionAbout Regex Pin
Sottyoru9-Mar-13 4:50
Sottyoru9-Mar-13 4:50 
AnswerRe: About Regex Pin
PIEBALDconsult9-Mar-13 5:09
mvePIEBALDconsult9-Mar-13 5:09 
GeneralRe: About Regex Pin
Sottyoru9-Mar-13 7:08
Sottyoru9-Mar-13 7:08 
AnswerRe: About Regex Pin
Ravi Bhavnani9-Mar-13 13:05
professionalRavi Bhavnani9-Mar-13 13:05 
QuestionSuggssion Please Pin
M VSubrahmanyam9-Mar-13 3:42
M VSubrahmanyam9-Mar-13 3:42 
AnswerRe: Suggssion Please PinPopular
OriginalGriff9-Mar-13 3:59
mveOriginalGriff9-Mar-13 3:59 
GeneralRe: Suggssion Please Pin
NotPolitcallyCorrect9-Mar-13 9:09
NotPolitcallyCorrect9-Mar-13 9: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.