Datagrid/form's Zorder

G

Guest

The presence of the Datagrid on the form, causing the form to cease
being "TopMost" (ie getting 'behind' another form whose TopMost is
also set to true) seems to be a known bug. The workaround of deriving
from the DataGrid, overriding the onLayout method, and accessing the
Handle before setting the form's TopMost to true seems to work in most
cases.
ie
protected override void OnLayout(LayoutEventArgs levent)
{
base.OnLayout (levent);
IntPtr trash = Handle;
(Parent as Form).TopMost = true;
}

However, it does not work when the onLayout is called as a result of
resetting the Datagrid's DataSource property (ie setting it to null
before setting it back to what it was). On resets of the DataSource,
the form gets behind the other form momentarilly, before getting in
front again, causing this very annoying flash to happen.

Also, when the grid is scrolled, it gets behind the other form. How
can these be avoided ? Any help would be greatly appreciated.

Thanks,
 

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