Exemple #1
0
        public static void Fill(Grid a, string[] data)
        {
            object[] temp = new object[data.Length];
            data.CopyTo(temp, 0);

            MakeGrid.Fill(a, temp, Color.Snow, a.FixedRows);
        }
Exemple #2
0
        public static void Fill(Grid a, string[] data, int index)
        {
            object[] temp = new object[data.Length];
            data.CopyTo(temp, 0);

            MakeGrid.Fill(a, temp, Color.Snow, index);
        }
Exemple #3
0
        public static void Fill(Grid a, int[,] data)
        {
            object[,] temp = new object[data.GetLongLength(0), data.GetLongLength(1)];

            for (int i = 0; i < data.GetLongLength(0); i++)
            {
                for (int j = 0; j < data.GetLongLength(1); j++)
                {
                    temp[i, j] = data[i, j];
                }
            }

            MakeGrid.Fill(a, temp, Color.Snow);
        }
        public static double[,] getOpen(Grid a)
        {
            string         TampunganData        = null;
            OpenFileDialog bukaFileInputAnggota = new OpenFileDialog();

            bukaFileInputAnggota.Title       = "Buka File";
            bukaFileInputAnggota.Filter      = "CSV Text File|*.csv|All Files (*.*)|*.*";
            bukaFileInputAnggota.FilterIndex = 1;
            bukaFileInputAnggota.Multiselect = false;
            DialogResult result = bukaFileInputAnggota.ShowDialog();

            if (result == DialogResult.OK)
            {
                //string file = Path.GetFileName(bukaFileInputAnggota.FileName);
                //string path = Path.GetDirectoryName(file);

                System.IO.StreamReader sr = new System.IO.StreamReader(bukaFileInputAnggota.FileName);
                TampunganData = sr.ReadToEnd();

                string[] u = TampunganData.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);

                int hitcount = (u[0].Split(',')).Count();
                double[,] temp = new double[u.Length, hitcount];

                for (int i = 0; i < u.Length; i++)
                {
                    string[] Temp1 = (u[i].Split(','));

                    for (int j = 0; j < hitcount; j++)
                    {
                        temp[i, j] = double.Parse(Temp1[j]);
                    }
                }
                MakeGrid.Build(a, temp.GetLength(0), 2, new[] { "X", "Y" });
                MakeGrid.Fill(a, temp);

                return(MakeGrid.Return(a));
            }

            return(null);
        }