dimanche 19 avril 2015

MouseEnter Event Handler for RichTextBox

I'd like to add a MouseEnter event handler to my RichTextBox which I have in a tabcontrol. The following code gets the currently selected RichTextBox:



private RichTextBox GetRichTextBox()
{
RichTextBox rtb = null;
TabPage tp = tabControl1.SelectedTab;

if (tp != null)
{
rtb = tp.Controls[0] as RichTextBox;
}

return rtb;
}


The next code is what I use to create the new tab with the RichTextBox:



TabPage tp = new TabPage("New Document");
RichTextBox rtb = new RichTextBox();
rtb.Dock = DockStyle.Fill;

tp.Controls.Add(rtb);
tabControl1.TabPages.Add(tp);


I am not sure how to go about creating the Mouse Enter Event Handler for the RichTextBox that is created. Any help with this would be greatly appreciated.


Aucun commentaire:

Enregistrer un commentaire