Page 1 of 1

CalcIncrement

Posted: Wed Oct 18, 2006 7:07 pm
by 9792387
Using: VB 2005 (Express), TeeChart.NET 2.0.2456.16162

I am try to set up my application so the user can hit the . or / keys to scroll the bottom axis left or right an amount equal to one minor tick mark. My bottom axis has date and time info. Here is my code:

Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As Boolean
'If TChart1.Focused Or Commander1.Focused Or LeftAutoScaleCheckBox.Focused Then
If TChart1.Focused Then
Select Case (keyData)
Case Keys.OemQuestion
TChart1.Axes.Bottom.Scroll(-TChart1.Axes.Bottom.CalcIncrement / TChart1.Axes.Bottom.MinorTickCount, False)
Case Keys.OemPeriod
TChart1.Axes.Bottom.Scroll(TChart1.Axes.Bottom.CalcIncrement / TChart1.Axes.Bottom.MinorTickCount, False)
End Select
End If
Return MyBase.ProcessCmdKey(msg, keyData)
End Function

It works OK on the first keystroke, but on the second or third I get an Unhandled Exception error with the following details:

************** Exception Text **************
System.ArgumentException: Parameter is not valid.
at System.Drawing.Graphics.MeasureCharacterRanges(String text, Font font, RectangleF layoutRect, StringFormat stringFormat)
at Steema.TeeChart.Drawing.Graphics3DGdiPlus.MeasureDisplayStringWidth(String text, Font font)
at Steema.TeeChart.Drawing.Graphics3DGdiPlus.MeasureString(ChartFont f, String text)
at Steema.TeeChart.Drawing.Graphics3D.TextWidth(String text)
at Steema.TeeChart.Chart.MultiLineTextWidth(String s, Int32& numLines)
at Steema.TeeChart.AxisLabels.InternalLabelSize(Double value, Boolean isWidth)
at Steema.TeeChart.AxisLabels.LabelWidth(Double value)
at Steema.TeeChart.Axis.get_CalcIncrement()
at Flocis_Visualizer.ChartForm.ProcessCmdKey(Message& msg, Keys keyData) in C:\Documents and Settings\jay\My Documents\Visual Studio 2005\Projects\Flocis Visualizer\Flocis Visualizer\ChartForm.vb:line 45
at System.Windows.Forms.Control.ProcessCmdKey(Message& msg, Keys keyData)
at System.Windows.Forms.Control.PreProcessMessage(Message& msg)
at System.Windows.Forms.Control.PreProcessControlMessageInternal(Control target, Message& msg)
at System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG& msg)

If I click the mouse on the chart control before each keystroke, I don't get the error. (Note: I added some additional code and I can see that the chart control is retaining focus, even when I haven't clicked it first.)

Am I doing something incorrectly? Or, is there another way to accomplish this without having to click on the chart before each keystroke?

Jay

Posted: Thu Oct 19, 2006 8:04 am
by narcis
Hi Jay,

Could you please send us an example we can run "as-is" to reproduce the problem here? You can post your files at news://www.steema.net/steema.public.attachments newsgroup.

Thanks in advance.

BTW: Also notice that there's a newer version availble at the client area.

CalcIncrement

Posted: Thu Oct 19, 2006 3:24 pm
by 9792387
OK, I posted it there with the same subject.

Jay

Posted: Fri Oct 20, 2006 8:34 am
by narcis
Hi Jay,

Thanks for the example. I could easily reproduce the problem here with the latest TeeChart for .NET v2 maintenance release. However, using our current TeeChart for .NET v2 sources it works fine. We expect to have a new release out next week. Could you please wait for it to be out and test if it works at your end?

We will announce the release in this forum.

Thanks for your patience and collaboration.

CalcIncrement

Posted: Thu Oct 26, 2006 3:25 pm
by 9792387
I tested with the new version (2.0.2489.20951), and it works fine. Thank you.

Jay