In OnStateChange I have:
[COLOR=#0000ff][COLOR=#0000ff]switch[/COLOR]([COLOR=#080808]State[/COLOR]) { // ...irrelevant usual crud removed. [COLOR=#0000ff] case[/COLOR] [COLOR=#080808]State[/COLOR].[COLOR=#080808]DataLoaded[/COLOR]: [COLOR=#080808] ChartControl[/COLOR].[COLOR=#080808]MouseUp[/COLOR] += [COLOR=#080808]ChartControl_OnMouseUp[/COLOR]; [COLOR=#0000ff] break[/COLOR]; [COLOR=#0000ff] case[/COLOR] [COLOR=#080808]State[/COLOR].[COLOR=#080808]Terminated[/COLOR]: [COLOR=#080808] ChartControl[/COLOR].[COLOR=#080808]MouseUp[/COLOR] -= [COLOR=#080808]ChartControl_OnMouseUp[/COLOR]; [COLOR=#0000ff] break[/COLOR]; } [/COLOR]
[COLOR=#0000ff]private[/COLOR] [COLOR=#0000ff]void[/COLOR] [COLOR=#080808]ChartControl_OnMouseUp[/COLOR]([COLOR=#0000ff]object[/COLOR] [COLOR=#080808]sender[/COLOR], [COLOR=#080808]MouseButtonEventArgs[/COLOR] [COLOR=#080808]e[/COLOR]) { [COLOR=#0000ff]if[/COLOR]([COLOR=#080808]Keyboard[/COLOR].[COLOR=#080808]IsKeyDown[/COLOR]([COLOR=#080808]Key[/COLOR].[COLOR=#080808]LeftCtrl[/COLOR]) && [COLOR=#080808] Keyboard[/COLOR].[COLOR=#080808]IsKeyDown[/COLOR]([COLOR=#080808]Key[/COLOR].[COLOR=#080808]LeftShift[/COLOR])) [COLOR=#080808] MessageBox[/COLOR].[COLOR=#080808]Show[/COLOR]([COLOR=#080808]ChartControl[/COLOR].[COLOR=#080808]GetTimeByX[/COLOR]( ([COLOR=#0000ff]int[/COLOR])[COLOR=#080808]e[/COLOR].[COLOR=#080808]GetPosition[/COLOR]([COLOR=#080808]ChartPanel[/COLOR] [COLOR=#0000ff]as [/COLOR][COLOR=#080808]IInputElement[/COLOR]).[COLOR=#080808]X[/COLOR]).[COLOR=#080808]ToString[/COLOR]());
Soooo, what I am trying to do is just get the accurate chart time from the mouse position at the time of mouse up so I can do some calcs and display a MessageBox with the calc result.
Is there a better way than what I am doing? Actually, what I would really love is an Bar.OnClick event that I can handle and know what bar is displayed in the x coordinate of the mouse. In checking the docs this doesn't appear to exist. I'm kind of surprised. This would seem to be something that people would regularly what to do ... namely, catch mouse events on bars. Is there a way to do this without a lot of gymnastics?
What I'd really love even more is a way to add info to the little box that comes up when you mousewheel click on a bar. That's probably asking too much but ...
Thanks ... Ed
Comment