private void buttonAdd_Click(object sender, System.EventArgs e) { // zadna funkce if (textFce.Text.Length == 0) { MessageBox.Show("Write function y=f(x)", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (numFrom.Value > numTo.Value) { MessageBox.Show("To value must be greather than From value", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (numStep.Value > (numTo.Value - numFrom.Value) * 2) { MessageBox.Show("To value must be greather than From value", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (numStep.Value == 0) { MessageBox.Show("Step value is ZERO. Why?", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } try { m_list = SLMath.SLCalculator.EvaluateFce(textFce.Text, (double)numFrom.Value, (double)numTo.Value, (double)numStep.Value); m_list.Title = textFce.Text; } catch { m_list = null; } Close(); }
private void menuDeriv_Click(object sender, System.EventArgs e) { int idx = listBox.SelectedIndex; if (idx != -1) { if (MessageBox.Show("Do you want detivate selected valuelist?", "Question?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { SLMath.SLValueList val = SLMath.SLCalculator.DerivateFce((SLMath.SLValueList)listBox.Items[idx]); val.Title = "Derivation:" + ((SLMath.SLValueList)listBox.Items[idx]).Title; DataList.Add(val); listBox.BeginUpdate(); listBox.Items.Add(val); listBox.EndUpdate(); listBox.Invalidate(); } } }
private void listBox_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e) { SLMath.SLValueList list = (SLMath.SLValueList)listBox.Items[e.Index]; Rectangle rect = new Rectangle(e.Bounds.Left, e.Bounds.Top + 1, e.Bounds.Width - 2, e.Bounds.Height - 2); Pen pen = Pens.Navy; Brush brush; brush = new SolidBrush(Color.Black); e.Graphics.FillRectangle(new SolidBrush(Color.White), e.Bounds); if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) { e.Graphics.DrawRectangle(pen, rect); } Pen lpen = new Pen(list.ColorLine, 2); e.Graphics.DrawLine(lpen, rect.Left + 4, rect.Top + 8, rect.Left + 10, rect.Top + 8); e.Graphics.DrawString(list.Title, listBox.Font, brush, new Point(rect.Left + 12, rect.Top + 1)); }
// Kresleni Bezierovy krivky public void DrawBezier(Graphics g, SLMath.SLValueList ValueList) { }