private void toolVisual_Click(object sender, EventArgs e) { if (gridMark.SelectedRows == null) { Core.Utility.Msg("Hãy chọn dòng mà bạn muốn hiển thị bài làm trực quan"); return; } DataGridViewRow row = gridMark.SelectedRows[0]; gridMark.FirstDisplayedCell = row.Cells[0]; // tránh người dùng thay đổi khi đã vào chế độ visualizer //row.Frozen = true; FormKeyVisualize visualizer = new FormKeyVisualize(); Hashtable tag = visualizer.Tag as Hashtable; MarkRowInfo rowtag = (MarkRowInfo)row.Tag; tag.Add(FormKeyVisualize.TagKeys.Answer, (string)row.Cells["colDetail"].Value); tag.Add(FormKeyVisualize.TagKeys.Questions, _keys.questions); tag.Add(FormKeyVisualize.TagKeys.Column, -1); visualizer.rowIndex = rowtag.GridIndex; visualizer.FormClosing += new FormClosingEventHandler(visualizer_FormClosing); visualizer.MdiParent = this.MdiParent; visualizer.Top = this.Top; visualizer.Left = this.Left + this.Width; visualizer.StartPosition = FormStartPosition.Manual; visualizer.Show(); }
private void btnVisual_Click(object sender, EventArgs e) { if (gridProblems.SelectedCells.Count == 0) { return; } DataGridViewCell cell = gridProblems[1, gridProblems.SelectedCells[0].RowIndex]; //if (cell.ColumnIndex == 1) { this.Enabled = false; FormKeyVisualize visualizer = new FormKeyVisualize(); Hashtable tag = visualizer.Tag as Hashtable; tag.Add(FormKeyVisualize.TagKeys.Answer, cell.Value == null ? "" : (string)cell.Value); tag.Add(FormKeyVisualize.TagKeys.Questions, (int)numQuestions.Value); tag.Add(FormKeyVisualize.TagKeys.Column, cell.ColumnIndex); tag.Add(FormKeyVisualize.TagKeys.Row, cell.RowIndex); visualizer.FormClosing += new FormClosingEventHandler(visualizer_FormClosing); visualizer.MdiParent = this.MdiParent; visualizer.Top = this.Top; visualizer.Left = this.Left + this.Width; visualizer.StartPosition = FormStartPosition.Manual; visualizer.Show(); } }