Answer the question
In order to leave comments, you need to log in
Swears at SelectedIndex. Where to find "SelectedIndexChanged" property for ToolStripMenuItem?
Can't find SelectedIndexChanged property. Swears at SelectedIndex
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp3
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
Point p = new Point(0, menuStrip1.Height);
dataGridView1.Location = p;
dataGridView1.Width = ClientSize.Width;
dataGridView1.Height = ClientSize.Height - menuStrip1.Height;
}
public Form2(double start, double finish, int step_count)
{
InitializeComponent();
double step = (finish - start) / step_count;
Point p = new Point(0, menuStrip1.Height);
dataGridView1.Location = p;
dataGridView1.Width = ClientSize.Width;
dataGridView1.Height = ClientSize.Height - menuStrip1.Height;
for (int i = 0; i < step_count; i++)
{
dataGridView1.Rows.Add(start, Math.Sinh(start));
start += step;
}
Font font = new Font("Arial", 14, FontStyle.Bold);
dataGridView1.Font = font;
}
private void границыToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void видToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void границыToolStripMenuItem_SelectedIndexChanged(object sender, EventArgs e)
{
switch (границыToolStripMenuItem.SelectedIndex) //ошибка
{
case 0: dataGridView1.GridColor = Color.Black; break;
case 1: dataGridView1.GridColor = Color.Red; break;
case 2: dataGridView1.GridColor = Color.Blue; break;
case 3: dataGridView1.GridColor = Color.Yellow; break;
}
}
private void выбратьЦветToolStripMenuItem_Click(object sender, EventArgs e)
{
switch (выбратьЦветToolStripMenuItem.SelectedIndex) //ошибка
{
case 0: dataGridView1.ForeColor = Color.Black; break;
case 1: dataGridView1.ForeColor = Color.Red; break;
case 2: dataGridView1.ForeColor = Color.Blue; break;
case 3: dataGridView1.ForeColor = Color.Yellow; break;
}
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question