添加到datagridview的自定义树视图控件未显示在前面。 尝试使用treeView1.BringToFront();但结果相同。
private void dataGridViewProblem_CellEnter(object sender, DataGridViewCellEventArgs e)
{
if (treeView1 != null)
{
treeView1.Visible = false;
}
if (e.RowIndex != -1 && e.ColumnIndex == dataGridViewProblem.Columns["Category"].Index)
{
dataGridViewProblem.Controls.Add(treeView1);
// It returns the retangular area that represents the Display area for a cell
Rectangle oRectangle = dataGridViewProblem.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, true);
//Setting area for DateTimePicker Control
treeView1.Size = new Size(oRectangle.Width, treeView1.Height);
// Setting Location
treeView1.Location = new Point(oRectangle.X, oRectangle.Y + oRectangle.Height);
treeView1.BringToFront();
treeView1.Visible = true;
}
}