} /* Paint */ protected override void OnDoubleClick(DataGridViewCellEventArgs e) { if (DataGridView == null) { return; } if (e.ColumnIndex >= DataGridView.Columns.Count) { return; } ThumbNailImageColumn tnic = ((ThumbNailImageColumn)(this.DataGridView.Columns[e.ColumnIndex])); IWin32Window parent = tnic.Parent; if (parent.GetType() != typeof(PicesCommander)) { return; } PicesCommander pc = (PicesCommander)parent; if (pc == null) { return; } pc.ThumbnailDataGridView_CellContentDoubleClick(DataGridView, e); } /* OnDoubleClick */
private void DefineThumbnailGridViewRowAndColumns() { int width = ThumbnailDataGridView.Width; int height = ThumbnailDataGridView.Height; int deltaHeight = height - thumbnailGridViewLastHeight; int deltaWidth = width - thumbnailGridViewLastWidth; thumbnailGridViewLastHeight = ThumbnailDataGridView.Height; thumbnailGridViewLastWidth = ThumbnailDataGridView.Width; int requiredHeight = thumbNailHeight; int requiredWidth = thumbNailWidth; int numCols = (int)Math.Floor((float)(width - 15) / (float)requiredWidth); if (numCols < 1) { numCols = 1; } int numRows = (int)Math.Floor((float)height / (float)requiredHeight); if (numRows < 1) { numRows = 1; } ThumbnailDataGridView.Rows.Clear(); ThumbnailDataGridView.Columns.Clear(); //ThumbnailDataGridView.ColumnCount = numCols; for (int colIDX = 0; colIDX < numCols; colIDX++) { //DataGridViewImageColumn dgvic = new DataGridViewImageColumn (); ThumbNailImageColumn dgvic = new ThumbNailImageColumn(this); dgvic.Name = "ThumbCol" + colIDX; dgvic.HeaderText = ""; dgvic.Width = thumbNailWidth; ThumbnailDataGridView.Columns.Add(dgvic); } { // Define Row Info DataGridViewCellStyle dgvcs = new DataGridViewCellStyle(); dgvcs.Alignment = DataGridViewContentAlignment.MiddleCenter; ThumbnailDataGridView.RowsDefaultCellStyle = dgvcs; ThumbnailDataGridView.RowCount = 0; } } /* DefineThumbnailGridViewRowAndColumns */