public void generateColHeaders(HeaderInfo [] colHeaders) { int locationY = 33; foreach (HeaderInfo header in colHeaders) { //ComboBox string comboboxName = header.colNum + "ComboBox"; ComboBox newCombo = new ComboBox(); newCombo.Name = comboboxName; newCombo.Width = 116; newCombo.Height = 21; newCombo.Location = new Point(194, locationY); newCombo.Items.Add("Sum"); newCombo.Items.Add("Mean"); newCombo.Items.Add("Nearest timestamp"); panelMain.Controls.Add(newCombo); //Label string labelName = header.colNum + "Label"; Label newLabel = new Label(); newLabel.Name = labelName; newLabel.Text = header.headerText; newLabel.Location = new Point(3, locationY + 3); panelMain.Controls.Add(newLabel); locationY += 27; } }
private void ColAggType(int dateTimeColNum) { ColHeaders = new HeaderInfo[dataViewer.Columns.Count - 1]; int index = 0; foreach (DataGridViewCell dCell in dataViewer.Rows[0].Cells) { if (dCell.ColumnIndex != dateTimeColNum) { HeaderInfo header = new HeaderInfo(); header.headerText = dCell.Value.ToString(); header.colNum = dCell.ColumnIndex; ColHeaders[index] = header; index++; } } if (index > 0) { FrmColAggType ColAggType = new FrmColAggType(); ColAggType.generateColHeaders(ColHeaders); ColAggType.ShowDialog(); if (ColAggType.exitByCancel == false) { for (int i = 0; i < ColHeaders.Length; i++) { ColHeaders[i].aggType = ColAggType.retrieveAggType(ColHeaders[i].colNum); } } } }
public myFile(string chemin) { byte[] tablignes = new byte[4]; byte[] tabcolonnes = new byte[4]; this.BITMAPFILEHEADER = new byte[14]; this.BITMAPINFOHEADER = new byte[40]; this.FILE = File.ReadAllBytes(chemin); fichier = new byte[FILE.Length]; this.BITMAPIMAGE = new byte[this.FILE.Length - 54]; for (int i = 0; i < 14; i++) { this.BITMAPFILEHEADER[i] = this.FILE[i]; } for (int i = 14; i < 54; i++) { this.BITMAPINFOHEADER[i - 14] = this.FILE[i]; } for (int i = 54; i < FILE.Length; i++) { this.BITMAPIMAGE[i - 54] = this.FILE[i]; } HdIf = new HeaderInfo(this.BITMAPINFOHEADER); FlHd = new FileHeader(this.BITMAPFILEHEADER); //FichierImage(BITMAPFILEHEADER, BITMAPINFOHEADER, BITMAPIMAGE); //Console.WriteLine("lignes"); for (int i = 4; i < 8; i++) //Range la taille de colonnes de l'image dans un tableau { tabcolonnes[i - 4] = this.BITMAPINFOHEADER[i]; //Console.WriteLine(this.BITMAPINFOHEADER[i]); } //Array.Reverse(tabcolonnes); //Inverse un tableau //Console.WriteLine("Colonnes"); for (int i = 8; i < 12; i++) //Range la taille de lignes de l'image dans un tableau { tablignes[i - 8] = this.BITMAPINFOHEADER[i]; //Console.WriteLine(this.BITMAPINFOHEADER[i]); } //Array.Reverse(tablignes); this.colonnes = BitConverter.ToInt32(tabcolonnes, 0); //Convertit le tableau de bytes en un entier. this.lignes = BitConverter.ToInt32(tablignes, 0); //Console.WriteLine(" "); //Console.WriteLine(this.colonnes); //Console.WriteLine(this.lignes); this.MATIMAGE = new byte[this.lignes, this.colonnes, 3]; //int ligne = 0; //int colonne = 0; int j = 0; for (int ligne = 0; ligne < this.lignes; ligne++) { for (int colonne = 0; colonne < this.colonnes; colonne++) { for (int i = 0; i < 3; i++) { this.MATIMAGE[ligne, colonne, i] = this.BITMAPIMAGE[j]; j++; } } } }