Using the TeeChart for .Net Examples demo for version 4.0.201027960.
if you go to Welcome !\New in Series\Marks on Bar
and change the Sont Size: to 0 an unhandled exception is thrown
Unhandled exception inDemo application
Re: Unhandled exception inDemo application
Hello Captell,
It is not a bug of TeeChart code, is exception of WinForms. It appears because, value of '0' is not valid for variable 'emSize'. 'emSize' should be greater than 0 and less than or equal to System.Single.MaxValue. See next code, that reproduce exception, using simple code without TeeChart.Net component.
Thanks,
It is not a bug of TeeChart code, is exception of WinForms. It appears because, value of '0' is not valid for variable 'emSize'. 'emSize' should be greater than 0 and less than or equal to System.Single.MaxValue. See next code, that reproduce exception, using simple code without TeeChart.Net component.
Code: Select all
public Form1()
{
InitializeComponent();
Initialize();
}
private void Initialize()
{
ComboBox ComboBox1 = new ComboBox();
this.Controls.Add(ComboBox1);
ComboBox1.Items.AddRange(new object[] { "bigger","smaller"});
ComboBox1.SelectedIndex = 0;
//ComboBox1.
label1.Text = "Test 1";
ComboBox1.SelectedIndexChanged +=new EventHandler(ComboBox1_SelectedIndexChanged);
}
private void ComboBox1_SelectedIndexChanged(System.Object sender,System.EventArgs e)
{
// Cast the sender object back to a ComboBox.
ComboBox ComboBox1 = (ComboBox)sender;
// Retrieve the selected item.
string selectedString = (string)ComboBox1.SelectedItem;
// Convert it to lowercase.
selectedString = selectedString.ToLower();
// Declare the current size.
float currentSize;
// Switch on the selected item.
switch (selectedString)
{
// If Bigger is selected, get the current size from the
// Size property and increase it. Reset the font to the
// new size, using the current unit.
case "bigger":
currentSize = label1.Font.Size;
currentSize += 2.0F;
label1.Font = new Font(label1.Font.Name, currentSize,
label1.Font.Style, label1.Font.Unit);
// If Smaller is selected, get the current size, in points,
// and decrease it by 1. Reset the font with the new size
// in points.
break;
case "smaller":
currentSize = label1.Font.SizeInPoints;
currentSize = 0;
label1.Font = new Font(label1.Font.Name, currentSize,
label1.Font.Style);
break;
}
}
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: Unhandled exception inDemo application
I understand that, I only point it out because it looks bad for tchart demo to be craching. It is a bug in tchart code in that your code in the demo should be handeling the exception properly.
Re: Unhandled exception inDemo application
Hello Capell.
I inform you that this is already solved for next version of TeeChart.Net.
Thanks,
I inform you that this is already solved for next version of TeeChart.Net.
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |