Click here to Skip to main content
15,178,967 members
Home / Discussions / C#
   

C#

 
GeneralRe: Office Development problems Pin
Jegan Thiyagesan27-Feb-13 12:57
MemberJegan Thiyagesan27-Feb-13 12:57 
QuestionTab Delimited file to sql database Pin
gavindon26-Feb-13 11:03
Membergavindon26-Feb-13 11:03 
AnswerRe: Tab Delimited file to sql database Pin
Matt T Heffron26-Feb-13 11:27
professionalMatt T Heffron26-Feb-13 11:27 
GeneralRe: Tab Delimited file to sql database Pin
gavindon26-Feb-13 12:25
Membergavindon26-Feb-13 12:25 
QuestionListbox colours. Pin
Septimus Hedgehog26-Feb-13 8:35
MemberSeptimus Hedgehog26-Feb-13 8:35 
AnswerRe: Listbox colours. Pin
Alan N26-Feb-13 9:40
MemberAlan N26-Feb-13 9:40 
AnswerRe: Listbox colours. Pin
Dave Kreskowiak26-Feb-13 10:05
mveDave Kreskowiak26-Feb-13 10:05 
GeneralRe: Listbox colours. Pin
Septimus Hedgehog26-Feb-13 23:59
MemberSeptimus Hedgehog26-Feb-13 23:59 
Guys,

I found the answer which I'll share. As I said, the treeview displayed the node in the right text colour and background colour. The same ARGB value applied to owner drawing in the listbox did not. The problem was the alpha component. The treeview seems to be more forgiving and accepts alpha values of 0 and 255 as one and the same. The listbox renders alpha values of 0 as fully transparent and 255 as fully opaque which is perhaps the correct result. For a listbox then, I need to force the alpha value to 255. Here is a sample code snippet:

const int anyArgbValueHere = 16744703;
Color argb = Color.FromArgb(anyArgbValueHere);
Color correctedArgb = Color.FromArgb(255, argb.R, argb.G, argb.B); // Same colour but with alpha forced.

When I paint the listbox it now works fine. Obviously, it would be better to have a method that does the conversion as you'd need to handle cases where the colour's IsEmpty property is true.

So, alpha was the problem and not a fault with my owner drawing.
"I do not have to forgive my enemies, I have had them all shot." — Ramón Maria Narváez (1800-68).
"I don't need to shoot my enemies, I don't have any." - Me (2012).

GeneralRe: Listbox colours. Pin
Dave Kreskowiak27-Feb-13 2:01
mveDave Kreskowiak27-Feb-13 2:01 
GeneralRe: Listbox colours. Pin
Septimus Hedgehog27-Feb-13 6:39
MemberSeptimus Hedgehog27-Feb-13 6:39 
Questioncan floats be multiplied and come up with a fraction? Pin
notahack26-Feb-13 7:01
Membernotahack26-Feb-13 7:01 
AnswerRe: can floats be multiplied and come up with a fraction? Pin
Richard Deeming26-Feb-13 7:15
mveRichard Deeming26-Feb-13 7:15 
AnswerRe: can floats be multiplied and come up with a fraction? Pin
Richard MacCutchan26-Feb-13 7:26
mveRichard MacCutchan26-Feb-13 7:26 
AnswerRe: can floats be multiplied and come up with a fraction? Pin
notahack26-Feb-13 7:35
Membernotahack26-Feb-13 7:35 
GeneralRe: can floats be multiplied and come up with a fraction? Pin
Richard Deeming26-Feb-13 8:39
mveRichard Deeming26-Feb-13 8:39 
GeneralRe: can floats be multiplied and come up with a fraction? Pin
notahack26-Feb-13 8:44
Membernotahack26-Feb-13 8:44 
GeneralRe: can floats be multiplied and come up with a fraction? Pin
Richard Deeming26-Feb-13 9:03
mveRichard Deeming26-Feb-13 9:03 
GeneralRe: can floats be multiplied and come up with a fraction? Pin
notahack26-Feb-13 9:13
Membernotahack26-Feb-13 9:13 
GeneralRe: can floats be multiplied and come up with a fraction? Pin
Dave Kreskowiak26-Feb-13 10:03
mveDave Kreskowiak26-Feb-13 10:03 
GeneralRe: can floats be multiplied and come up with a fraction? Pin
Dave Kreskowiak26-Feb-13 9:58
mveDave Kreskowiak26-Feb-13 9:58 
QuestionC# EF5 List<ENum> Persisting ? Pin
Khorne26-Feb-13 5:01
MemberKhorne26-Feb-13 5:01 
AnswerRe: C# EF5 List<ENum> Persisting ? Pin
Ssyxz26-Feb-13 16:14
MemberSsyxz26-Feb-13 16:14 
GeneralRe: C# EF5 List<ENum> Persisting ? Pin
Khorne26-Feb-13 21:41
MemberKhorne26-Feb-13 21:41 
AnswerRe: C# EF5 List<ENum> Persisting ? Pin
Jegan Thiyagesan27-Feb-13 7:42
MemberJegan Thiyagesan27-Feb-13 7:42 
QuestionNeed code Pin
jelintaric25-Feb-13 23:41
Memberjelintaric25-Feb-13 23:41 

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.