Click here to Skip to main content
15,881,588 members
Home / Discussions / C#
   

C#

 
AnswerRe: C# web page interaction Pin
Richard Deeming12-Jan-23 22:11
mveRichard Deeming12-Jan-23 22:11 
QuestionWhy isn't my semi-editable ComboBox drawing the text in gray when the dropdown list isn't showing? Pin
arnold_w10-Jan-23 2:25
arnold_w10-Jan-23 2:25 
AnswerRe: Why isn't my semi-editable ComboBox drawing the text in gray when the dropdown list isn't showing? Pin
OriginalGriff10-Jan-23 3:46
mveOriginalGriff10-Jan-23 3:46 
GeneralRe: Why isn't my semi-editable ComboBox drawing the text in gray when the dropdown list isn't showing? Pin
arnold_w10-Jan-23 4:06
arnold_w10-Jan-23 4:06 
GeneralRe: Why isn't my semi-editable ComboBox drawing the text in gray when the dropdown list isn't showing? Pin
Ralf Meier10-Jan-23 4:55
mveRalf Meier10-Jan-23 4:55 
GeneralRe: Why isn't my semi-editable ComboBox drawing the text in gray when the dropdown list isn't showing? Pin
arnold_w10-Jan-23 5:21
arnold_w10-Jan-23 5:21 
GeneralRe: Why isn't my semi-editable ComboBox drawing the text in gray when the dropdown list isn't showing? Pin
Ralf Meier10-Jan-23 6:14
mveRalf Meier10-Jan-23 6:14 
AnswerRe: Why isn't my semi-editable ComboBox drawing the text in gray when the dropdown list isn't showing? Pin
Pete O'Hanlon12-Jan-23 0:03
mvePete O'Hanlon12-Jan-23 0:03 
So, the DrawItem event is used to draw the items that appear in the dropdown list and not the actual selected value. The colour of the selected text is set by ForeColor. It seems to me that the simple solution would be to change the ForeColor, depending on whether the selection was enabled or not. Something like this:
C#
private void comboBox_TextChanged(object sender, EventArgs e)
{
  bool enableItem = (SelectedIndex < 0) ? false : comboBox.Items[SelectedIndex]).enabled;
  comboBox.ForeColor = enableItem ? Color.Black : Color.Gray;
}


GeneralRe: Why isn't my semi-editable ComboBox drawing the text in gray when the dropdown list isn't showing? Pin
arnold_w12-Jan-23 2:29
arnold_w12-Jan-23 2:29 
GeneralRe: Why isn't my semi-editable ComboBox drawing the text in gray when the dropdown list isn't showing? Pin
Pete O'Hanlon12-Jan-23 2:55
mvePete O'Hanlon12-Jan-23 2:55 
Questionproblem using ... "nested" DLL's ... a DLL referenced inside another DLL ? Pin
BillWoodruff8-Jan-23 21:30
professionalBillWoodruff8-Jan-23 21:30 
AnswerRe: problem using ... "nested" DLL's ... a DLL referenced inside another DLL ? Pin
Richard Deeming8-Jan-23 22:09
mveRichard Deeming8-Jan-23 22:09 
GeneralRe: problem using ... "nested" DLL's ... a DLL referenced inside another DLL ? Pin
BillWoodruff9-Jan-23 0:31
professionalBillWoodruff9-Jan-23 0:31 
GeneralRe: problem using ... "nested" DLL's ... a DLL referenced inside another DLL ? Pin
Richard Deeming9-Jan-23 0:45
mveRichard Deeming9-Jan-23 0:45 
GeneralRe: problem using ... "nested" DLL's ... a DLL referenced inside another DLL ? Pin
BillWoodruff9-Jan-23 2:10
professionalBillWoodruff9-Jan-23 2:10 
GeneralRe: problem using ... "nested" DLL's ... a DLL referenced inside another DLL ? Pin
Richard Deeming9-Jan-23 2:26
mveRichard Deeming9-Jan-23 2:26 
GeneralRe: problem using ... "nested" DLL's ... a DLL referenced inside another DLL ? Pin
BillWoodruff9-Jan-23 2:42
professionalBillWoodruff9-Jan-23 2:42 
AnswerRe: problem using ... "nested" DLL's ... a DLL referenced inside another DLL ? Pin
OriginalGriff8-Jan-23 22:19
mveOriginalGriff8-Jan-23 22:19 
GeneralRe: problem using ... "nested" DLL's ... a DLL referenced inside another DLL ? Pin
BillWoodruff9-Jan-23 0:38
professionalBillWoodruff9-Jan-23 0:38 
AnswerRe: problem using ... "nested" DLL's ... a DLL referenced inside another DLL ? Pin
BillWoodruff9-Jan-23 2:55
professionalBillWoodruff9-Jan-23 2:55 
QuestionInsert data on dynamic textbox windows form C# Pin
Hoang Luc2-Jan-23 17:48
Hoang Luc2-Jan-23 17:48 
AnswerRe: Insert data on dynamic textbox windows form C# Pin
OriginalGriff2-Jan-23 18:50
mveOriginalGriff2-Jan-23 18:50 
SuggestionRe: Insert data on dynamic textbox windows form C# Pin
Richard Deeming4-Jan-23 23:50
mveRichard Deeming4-Jan-23 23:50 
QuestionSecuring a Named Pipe Pin
Richard Andrew x641-Jan-23 6:13
professionalRichard Andrew x641-Jan-23 6:13 
AnswerRe: Securing a Named Pipe Pin
BillWoodruff2-Jan-23 0:46
professionalBillWoodruff2-Jan-23 0:46 

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.