Form1.cs 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Runtime.InteropServices;
  7. using System.Text;
  8. using System.Text.RegularExpressions;
  9. using System.Windows.Forms;
  10. using System.Windows.Forms.DataVisualization.Charting;
  11. using UAS_MES.CustomControl.DataGrid_View;
  12. using UAS_MES.DataOperate;
  13. using UAS_MES.PublicForm;
  14. using UAS_MES.PublicMethod;
  15. namespace UAS_MES
  16. {
  17. public partial class Form1 : Form
  18. {
  19. public Form1()
  20. {
  21. InitializeComponent();
  22. }
  23. [DllImport("kernel32.dll")]
  24. public static extern bool d(int freq, int duration);
  25. private void button3_Click(object sender, EventArgs e)
  26. {
  27. d(800, 600);
  28. }
  29. private void Form1_Load(object sender, EventArgs e)
  30. {
  31. DataGridViewCheckBoxColumn checkboxCol = new DataGridViewCheckBoxColumn();
  32. checkboxCol.Name = "全选";
  33. //创建复选框列头单元格
  34. DataGridViewCheckBoxHeaderCell ch = new DataGridViewCheckBoxHeaderCell(TestDGV, checkboxCol);
  35. //设置复选框那列的单元格为复选框
  36. checkboxCol.HeaderCell = ch;
  37. this.TestDGV.Columns.Add(checkboxCol);
  38. blurSearch1.TableName = "Make";
  39. blurSearch1.Field = "ma_code";
  40. DataHelper dh = new DataHelper();
  41. ViewChart((DataTable)dh.ExecuteSql("select nvl(ms_nextstepcode ,'已完工')ms_nextstepcode ,count(*) from makeserial left join makecraftdetail on ms_makecode=mcd_macode and ms_nextstepcode =mcd_nextstepcode where ms_makecode='MB17050022' group by ms_nextstepcode", "select"), "TExt");
  42. }
  43. private void ViewChart(DataTable _dt, string _title)
  44. {
  45. List<string> xData = new List<string>();
  46. List<int> yData = new List<int>();
  47. for (int i = 0; i < _dt.Rows.Count; i++)
  48. {
  49. xData.Add(_dt.Rows[i]["ms_nextstepcode"].ToString());
  50. yData.Add(int.Parse(_dt.Rows[i]["count(*)"].ToString()));
  51. }
  52. ct_coll.Series[0]["PieLineColor"] = "Red";//绘制黑色的连线。
  53. this.ct_coll.Series[0].ToolTip = "#VAL{D}件";//鼠标移动到上面显示的文字
  54. this.ct_coll.Series[0].BackSecondaryColor = Color.DarkCyan;
  55. this.ct_coll.Series[0].BorderColor = Color.DarkOliveGreen;
  56. this.ct_coll.Series[0].LabelBackColor = Color.Transparent;
  57. ct_coll.ChartAreas[0].Area3DStyle.Enable3D = true;
  58. ct_coll.Series[0].Points.DataBindXY(xData, yData);
  59. }
  60. }
  61. }