Help need with DataGridView

G

Guest

Hi,

I am using DataGridview in my application. In that i am able to display
images. when i click the any cell of the datagrid i wanted to open a new
Frameless window(which contains some checkboxes and lables) on top of that
cell. but i am not able to display that form on top of that cell. i am using
the code like this

Point aPoint = dataGridview1.GetCellDisplayRectangle(e.ColumnIndex,
e.RowIndex, true).Location;
aForm = new Form();
// aForm.Location = new Point(600,200);
aForm.StartPosition = FormStartPosition.CenterParent;
aForm.Location = new Point(dataGridview1.Location.X + aPoint.X ,
aPoint.Y);
aForm.Size = new Size(115, 54);
aForm.ControlBox = false;
aForm.FormBorderStyle = FormBorderStyle.None;
aForm.BackColor = Color.Blue;
aForm.TopMost = true;
aForm.Deactivate += new EventHandler(aForm_Deactivate);
aForm.AutoSizeMode = AutoSizeMode.GrowAndShrink;

Can u please tell me how to display that frameless dialog on top of that
cell, i am not able to display the form on top.. it is displaying some where..

Thanks in advance
 
C

ClayB

I think you need to move the point into screen coordinates and set the
StartPosition to manual.

DataGridViewCell cc = this.dataGridView1.CurrentCell;

Point pt =
this.dataGridView1.GetCellDisplayRectangle(cc.ColumnIndex,
cc.RowIndex, true).Location;
pt = dataGridView1.PointToScreen(pt);
Form f = new Form();
f.StartPosition = FormStartPosition.Manual;
f.Location = pt;
f.Size = new Size(cc.OwningColumn.Width, cc.OwningRow.Height);
f.Show();

======================
Clay Burch
Syncfusion, Inc.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top