ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  PreviewKeyDown f1 problem
Posted by Brian Kim on Mar-24-2019 15:12
The window changes to a minimal size.

        private void chartViewer_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            if (e.KeyCode == Keys.F1)  <--------------
            {
                chartViewer.MouseUsage = WinChartMouseUsage.ZoomIn;
            }
            if (e.KeyCode == Keys.F2)
            {
                chartViewer.MouseUsage = WinChartMouseUsage.ZoomOut;
            }
            if (e.KeyCode == Keys.F3)
            {
                chartViewer.MouseUsage = WinChartMouseUsage.ScrollOnDrag;
            }
        }

  Re: PreviewKeyDown f1 problem
Posted by Peter Kwan on Mar-26-2019 04:47
Attachments:
Hi Brian,

I have just tried myself by adding your code to the "Zooming and Scrolling with Track Line (1)" sample code for testing. In my case, it works normally. After pressing F1, I can use the mouse to zoom in. The window does not change size.

For your case, is it possible your Form is also handling the F1 key? Your code is only previewing the key. It is also possible for the Form to preview the key or to handle the KeyUp or KeyDown events.

If the above still cannot solve the problem, is it possible to provide a simple example that can reproduce the problem, so I can try it and trouble-shoot the issue?

Regards
Peter Kwan
frmzoomscrolltrack_f1.zip
frmzoomscrolltrack_f1.zip

8.84 Kb

  Re: PreviewKeyDown f1 problem
Posted by Peter Kwan on Mar-26-2019 04:48
Hi Brian,

I forgot to mention that in my last message, I have attached the modified sample code with the PreviewKeyDown handler for your reference. It works normally in my case.

Regards
Peter Kwan

  Re: PreviewKeyDown f1 problem
Posted by Brian Kim on Mar-27-2019 11:44
Thank you, the problem has been resolved


var chartViewer = sender as WinChartViewer; <------------- insert