想达到的效果:主窗口上面是一个容器panel,里面有3个下拉框,左边是一个toolStrip菜单栏,剩余部分是一个panel1(用来显示五个子窗口),如第一个图;按完第一个按钮,在主窗口的panel1上显示第一个子窗口(Win1)的内容,效果如图二;
下面是主窗口用的部分程序
public static string a; public static string b;public static string c;Win1 w1; w1 = new Win1();string a = comboBox1.Text; string b = comboBox2.Text; string c = comboBox3.Text;
private void toolStripButton1_Click(object sender, EventArgs e)
{
this.panel1.Controls.Clear(); // 清空原有的控件
w1.TopLevel = false; // 非顶级窗口
w1.FormBorderStyle = FormBorderStyle.None; // 不显示标题栏
//w1.Dock = System.Windows.Forms.DockStyle.Fill; // 填充panel
w1.WindowState = FormWindowState.Maximized;
this.panel1.Controls.Add(w1); // 添加w1窗体
//w1.Show(this);
w1.Show();
flag = true;
}
private void button1_Click(object sender, EventArgs e)
{
if (flag == true && flag1 == true && flag2 == true)
{
w1.Creatchart1();
}
}
下面是Win1的其中的一个chart的程序
private void Creatchart1()
{
string e = Form1.a;
string f = Form1.b;
string g = Form1.c;
string wax = e + f + g;
string dbPath = @"D:\历年高考分数.db";
string sq = @"Data Source=" + dbPath;
m = new SQLiteConnection(sq);
m.Open();
SQLiteDataAdapter mAdapter = new SQLiteDataAdapter("select " + wax + ",yxlc from 表2", m);
DataSet ds = new DataSet();
mAdapter.Fill(ds);
DataTable dt = ds.Tables[0];
Series Series1 = new Series();
chart1.DataSource = dt;
Series1.IsValueShownAsLabel = false;//是否显示图例
chart1.Series.Add(Series1);
chart1.Series["Series1"].ChartType = SeriesChartType.Spline;//形状
chart1.Series[0].XValueMember = "yxlc";//X轴数据成员列
chart1.Series[0].YValueMembers = wax;
chart1.Series[0].IsValueShownAsLabel = true;//显示坐标
chart1.DataBind();
chart1.BringToFront();
m.Close();
}
启动时在mAdapter.Fill(ds);处显示其他信息: SQL logic error near ",": syntax error
,应该怎么改