zoukankan      html  css  js  c++  java
  • winform 图标表chart

    先链接数据库新建一个LinQ

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    
    namespace WindowsFormsApplication16
    {
        public partial class Form1 : Form
        {
            private DataClasses1DataContext Context;
            public Form1()
            {
                InitializeComponent();
                Context = new DataClasses1DataContext();
    
            }
    
            private void Form1_Load(object sender, EventArgs e)
            {
                List<Car> list = Context.Car.Take(5).ToList();
                //为图表指定数据源
                chart1.DataSource = list;
                chart1.Series["Series1"].XValueMember = "Name";
                chart1.Series["Series1"].YValueMembers = "Oil";
                chart1.Series["Series2"].XValueMember = "Name";
                chart1.Series["Series2"].YValueMembers = "powers";
                chart1.Series["Series2"].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.FastLine;
            }
        }
    }
  • 相关阅读:
    命令基础
    绑定在表单验证上的应用
    绑定和绑定的各种使用场景
    双向数据绑定
    事件
    委托应用及泛型委托和多播委托
    委托
    LINQ
    反射重要属性方法
    反射基本内容
  • 原文地址:https://www.cnblogs.com/dlexia/p/4649042.html
Copyright © 2011-2022 走看看