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

C#

 
GeneralRe: Architecture for Software extension Pin
madmaxime121-Oct-08 1:24
madmaxime121-Oct-08 1:24 
GeneralRe: Architecture for Software extension Pin
Pete O'Hanlon21-Oct-08 1:24
mvePete O'Hanlon21-Oct-08 1:24 
QuestionMulticore/multithread Pin
invader8220-Oct-08 23:25
invader8220-Oct-08 23:25 
AnswerRe: Multicore/multithread Pin
Simon P Stevens20-Oct-08 23:32
Simon P Stevens20-Oct-08 23:32 
QuestionOLE Server in C# Pin
VasDemidov20-Oct-08 23:01
VasDemidov20-Oct-08 23:01 
AnswerRe: OLE Server in C# Pin
Abdallah Gomah5-Apr-10 18:26
Abdallah Gomah5-Apr-10 18:26 
QuestionHow can I programmatically generate OnDrawItem events for a ComboBox? Pin
arnold_w20-Oct-08 22:50
arnold_w20-Oct-08 22:50 
AnswerRe: How can I programmatically generate OnDrawItem events for a ComboBox? Pin
Simon P Stevens20-Oct-08 22:57
Simon P Stevens20-Oct-08 22:57 
arnold_w wrote:
I have a regular System.Windows.Forms.ComboBox. This control listens to OnDrawItem(DrawItemEventArgs ea) events.


I think you have misunderstood events. The combo box triggers DrawItem events. Your code listens to them.

You can attach a listener using the += construct, like this
private void CreateComboBox()
 {
     ComboBox cbox = new ComboBox();
     this.Controls.Add(cbox);

     cbox.DrawItem += new DrawItemEventHandler(cbox_DrawItem);
 }

 void cbox_DrawItem(object sender, DrawItemEventArgs e)
 {
     // Do your stuff here.
 }

Be careful not to attach listeners multiple times. Once attached, the listener will continue to respond to the event every time it is triggered until you detach it, or the object is destroyed.

Simon

GeneralRe: How can I programmatically generate OnDrawItem events for a ComboBox? Pin
arnold_w20-Oct-08 23:15
arnold_w20-Oct-08 23:15 
GeneralRe: How can I programmatically generate OnDrawItem events for a ComboBox? Pin
leppie20-Oct-08 23:25
leppie20-Oct-08 23:25 
GeneralRe: How can I programmatically generate OnDrawItem events for a ComboBox? Pin
Simon P Stevens20-Oct-08 23:36
Simon P Stevens20-Oct-08 23:36 
GeneralRe: How can I programmatically generate OnDrawItem events for a ComboBox? Pin
arnold_w21-Oct-08 0:09
arnold_w21-Oct-08 0:09 
GeneralRe: How can I programmatically generate OnDrawItem events for a ComboBox? Pin
Simon P Stevens21-Oct-08 0:22
Simon P Stevens21-Oct-08 0:22 
GeneralRe: How can I programmatically generate OnDrawItem events for a ComboBox? Pin
arnold_w21-Oct-08 0:26
arnold_w21-Oct-08 0:26 
GeneralRe: How can I programmatically generate OnDrawItem events for a ComboBox? Pin
leppie21-Oct-08 0:30
leppie21-Oct-08 0:30 
GeneralRe: How can I programmatically generate OnDrawItem events for a ComboBox? Pin
arnold_w21-Oct-08 0:48
arnold_w21-Oct-08 0:48 
GeneralRe: How can I programmatically generate OnDrawItem events for a ComboBox? Pin
leppie21-Oct-08 0:51
leppie21-Oct-08 0:51 
GeneralRe: How can I programmatically generate OnDrawItem events for a ComboBox? Pin
arnold_w21-Oct-08 0:58
arnold_w21-Oct-08 0:58 
GeneralRe: How can I programmatically generate OnDrawItem events for a ComboBox? Pin
Simon P Stevens21-Oct-08 0:58
Simon P Stevens21-Oct-08 0:58 
GeneralRe: How can I programmatically generate OnDrawItem events for a ComboBox? Pin
arnold_w21-Oct-08 1:01
arnold_w21-Oct-08 1:01 
GeneralRe: How can I programmatically generate OnDrawItem events for a ComboBox? Pin
Simon P Stevens21-Oct-08 1:07
Simon P Stevens21-Oct-08 1:07 
GeneralRe: How can I programmatically generate OnDrawItem events for a ComboBox? Pin
leppie21-Oct-08 3:20
leppie21-Oct-08 3:20 
QuestionKilling a Process Pin
Vimalsoft(Pty) Ltd20-Oct-08 22:38
professionalVimalsoft(Pty) Ltd20-Oct-08 22:38 
AnswerRe: Killing a Process Pin
Simon P Stevens20-Oct-08 22:51
Simon P Stevens20-Oct-08 22:51 
AnswerRe: Killing a Process Pin
Vimalsoft(Pty) Ltd21-Oct-08 20:03
professionalVimalsoft(Pty) Ltd21-Oct-08 20:03 

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.