Hi,

This is my first message to this group. I've already search the web,
google, this group, found some clues to my problem but found no
solution or workaround. So please let me explain my problem:

I'm developing an application, which has custom UserControls
containing DataGridView controls being put inside TabPages of a
TabControl at runtime (I hope this made sense). Well, those are being
added dinamically at runtime simply because VisualStudio keeps
deleting my controls due to a bug in the designer. This is a issue,
but the problem I'm facing now is other. Please check those images:

http://www.comp.ufscar.br/~cesarsouza/archive/CSharp/bug/

The first image is of my application, windowed, in normal mode, with
the DataGridView loaded. Then, the window is maximized in the second
image, and you can notice the grid didn't resize itself. Now, the
third image reveals that the 'gap' produced is indeed not being redraw
at all.

The DataGridView is anchored on the four directions inside the
UserControl, which is set to DockStyles.Fill inside the tab page. An
interesting thing is, everything happens normally _before_ the data
has been loaded and the data is bound. The same occurs backwards, i.e.
If I load the data when the window is maximized and then resize it,
the DataGridView gets bigger than its container control and becomes
corrupted.

I'm pretty sure this is a bug in the framework (I'm using 2.0) dealing
with DataGridViews being put inside TabPages. If someone has already
face this problem, please let me know.

If nothing else works, I would like to know how I could force a
complete redraw, or a re-bind after I completed a resize move. Just
calling dataGridView.Refresh(), Invalidate, Redraw, or whatever seems
to have no effect.

Thanks in advance,

Cesar Souza

Re: DataGridView & TabPages by cesarsouza

cesarsouza
Thu Feb 21 14:11:32 CST 2008

Nevermind, the problem was caused by a misplaced SuspendLayout just
before the databinding proccess. However, the designer continues
deleting my controls...


On Feb 21, 12:31=A0pm, "C=E9sar Roberto de Souza" <cesarso...@gmail.com>
wrote:
> Hi,
>
> This is my first message to this group. I've already search the web,
> google, this group, found some clues to my problem but found no
> solution or workaround. So please let me explain my problem:
>
> I'm developing an application, which has custom UserControls
> containing DataGridView controls being put inside TabPages of a
> TabControl at runtime (I hope this made sense). Well, those are being
> added dinamically at runtime simply because VisualStudio keeps
> deleting my controls due to a bug in the designer. This is a issue,
> but the problem I'm facing now is other. Please check those images:
>
> http://www.comp.ufscar.br/~cesarsouza/archive/CSharp/bug/
>
> The first image is of my application, windowed, in normal mode, with
> the DataGridView loaded. Then, the window is maximized in the second
> image, and you can notice the grid didn't resize itself. Now, the
> third image reveals that the 'gap' produced is indeed not being redraw
> at all.
>
> The DataGridView is anchored on the four directions inside the
> UserControl, which is set to DockStyles.Fill inside the tab page. An
> interesting thing is, everything happens normally _before_ the data
> has been loaded and the data is bound. The same occurs backwards, i.e.
> If I load the data when the window is maximized and then resize it,
> the DataGridView gets bigger than its container control and becomes
> corrupted.
>
> I'm pretty sure this is a bug in the framework (I'm using 2.0) dealing
> with DataGridViews being put inside TabPages. If someone has already
> face this problem, please let me know.
>
> If nothing else works, I would like to know how I could force a
> complete redraw, or a re-bind after I completed a resize move. Just
> calling dataGridView.Refresh(), Invalidate, Redraw, or whatever seems
> to have no effect.
>
> Thanks in advance,
>
> Cesar Souza