We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

raise mouse hover

Thread ID:





45518 Jun 22,2006 11:53 AM Jun 23,2006 03:59 AM Windows Forms 2
Tags: GridControl
Colin Bolton
Asked On June 22, 2006 11:53 AM

I am using a custom cell type implemented with the GridGenericControlCellModel.GridGenericControlCellRenderer. My control is grabbing a lot of mouse events (for reasons that are too boring to go into). BUT I would like to able to cache the most recent MouseEventArgs from the mouse move event in my control and then raise an event when the mouse hovers (caught in the WndProc method override) to the cell renderer which in turn can call RaiseMouseHover for the current cell which _should_ I think show the tooltip. As you can probably guess the tooltip doesn''t show, any ideas?? Or better ways of doing this?? Cheers Colin Code snippets: In my control void XXX::WndProc(System::Windows::Forms::Message %p_message) { __super::WndProc(p_message); if(p_message.Msg ==WM_MOUSEHOVER) { //raise the event... mouseHover(this,cached_mouse_move); } } void ComboMenuStrip::OnMouseMove(System::Windows::Forms::MouseEventArgs^ e) { cached_mouse_move=e; } In the cell renderer: void Renderer::Init() { xxx_control_instance->mouseHover +=gcnew ToolTipEventHandler(this,&yyy::showTooltip); } void yyy::showTooltip(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ event_args) { GridCurrentCell^ curr_cell = this->Grid->CurrentCell; this->RaiseMouseHover(curr_cell->RowIndex,curr_cell->ColIndex,event_args); }

Administrator [Syncfusion]
Replied On June 22, 2006 02:00 PM

Is your goal to show a tooltip? If so, you can probably do this by adding a ToolTip control to your control class and setting its properties directly somewhere. Here is some C# code that does this in a WndProc override. public class MyMonthCalendar : MonthCalendar { private ToolTip tip = new ToolTip(); protected override void WndProc(ref Message m) { base.WndProc (ref m); if(m.Msg == 0x200)// (WM_MOUSEMOVE { if(tip.GetToolTip(this).Length == 0) { tip.SetToolTip(this, "ToolTip"); Console.WriteLine("set"); } } else if(m.Msg == 0x2a3)// (WM_MOUSELEAVE) { tip.RemoveAll(); Console.WriteLine("unset"); } } }

Colin Bolton
Replied On June 23, 2006 03:59 AM

Genius, thanks very much. I was so hung up on getting the cell tooltip to appear via the event that I hadn''t thought of putting a tooltip on the control! Cheers! Colin


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.