Hi,

I have a very simple form containing a TabControl with 2 TabPages.
The
Dock property for TabControl is set to Fill. TabPage1 contains a
TreeView with some nodes. Tabpage2 is currently blank.


The problem is when i resize the Form, lot of flickering happens. (I
have set the windows appearance to Show the contents of window while
resizing).


Any help in this regard is appreciated.


Thanks,
Ankit!!

Re: TabControl flicker issue by Mick

Mick
Fri Dec 07 14:33:22 PST 2007

You could Inherit TabControl and set it's DoubleBuffered property to true.

Alternatively, use one of my TabControls instead.

On my downloads page you will find two tabcontrols.
http://www.dotnetrix.co.uk/controls.html

The first one (TabControlEx) is written for framework 1.1 and works well so
long as you don't want a mirrored TabControl.

The second one was written specifically for framework 2.0 and has no
problems with mirroring. This doesn't have all the features of TabControlEx,
but it's an improvement on the standard TabControl.

--
Mick Doherty
http://www.dotnetrix.co.uk/nothing.html


<aagarwal8@gmail.com> wrote in message
news:0cfcc604-2613-49b7-8593-7242fe46c18b@d27g2000prf.googlegroups.com...
> Hi,
>
> I have a very simple form containing a TabControl with 2 TabPages.
> The
> Dock property for TabControl is set to Fill. TabPage1 contains a
> TreeView with some nodes. Tabpage2 is currently blank.
>
>
> The problem is when i resize the Form, lot of flickering happens. (I
> have set the windows appearance to Show the contents of window while
> resizing).
>
>
> Any help in this regard is appreciated.
>
>
> Thanks,
> Ankit!!
>
>



Re: TabControl flicker issue by aagarwal8

aagarwal8
Mon Dec 10 03:16:39 PST 2007

Hi Mick,

I downloaded the control but the flickering issue still persists.

The contents of the TreeView flicker a lot when i resize the form (on
which i have docked the TabControl)

Any suggestions?

Regards,
Ankit!!

Re: TabControl flicker issue by Mick

Mick
Mon Dec 10 08:30:46 PST 2007

Hi Ankit,

If you're going to be using Windows XP or Vista then you may have a simple
solution as described by Hans Passant in the following thread:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2044742&SiteID=1

Other than that you'll probably have to use some sort of hack like the
following:

\\\
private void Form1_ResizeBegin(object sender, EventArgs e)
{
if (this.tabControl1.SelectedTab == this.tabPage1)
{
this.treeView1.Dock = DockStyle.None;
this.treeView1.Anchor = AnchorStyles.Left | AnchorStyles.Top |
AnchorStyles.Right | AnchorStyles.Bottom;
this.Controls.Add(this.treeView1);
this.treeView1.Location =
this.tabControl1.PointToScreen(Point.Empty);
Rectangle rc = this.tabControl1.DisplayRectangle;
rc.Width -= this.tabControl1.Margin.Horizontal;
rc.Height -= this.tabControl1.Margin.Vertical;
rc.Offset(this.tabControl1.Location);
rc.Offset(this.tabControl1.Margin.Left,
this.tabControl1.Margin.Top);
this.treeView1.SetBounds(rc.Left,rc.Top,rc.Width,rc.Height);
this.treeView1.BringToFront();
}
}

private void Form1_ResizeEnd(object sender, EventArgs e)
{
if (!this.tabPage1.Controls.Contains(this.treeView1))
{
this.tabPage1.Controls.Add(this.treeView1);
this.treeView1.Dock = DockStyle.Fill;
}
}

///

--
Mick Doherty
http://www.dotnetrix.co.uk/nothing.html


<aagarwal8@gmail.com> wrote in message
news:e350667f-8e83-43ba-ad91-3c0b5e26c117@s8g2000prg.googlegroups.com...
> Hi Mick,
>
> I downloaded the control but the flickering issue still persists.
>
> The contents of the TreeView flicker a lot when i resize the form (on
> which i have docked the TabControl)
>
> Any suggestions?
>
> Regards,
> Ankit!!



Re: TabControl flicker issue by aagarwal8

aagarwal8
Mon Dec 10 23:58:14 PST 2007

Thanks a bunch Mick...

Your hack solved my problem. Now the only issue left is that when
resizing the form, TabPage headers still flicker; but i guess i can
live with it.

Thanks once again!

Regards
Ankit!!

Re: TabControl flicker issue by aagarwal8

aagarwal8
Tue Dec 11 01:18:41 PST 2007

By overriding the CreateParams property for the Form, i was able to
get rid of the flickering completely.


protected override CreateParams CreateParams {
get {
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x02000000;
return cp;
}
}


Regards,
Ankit!!

Re: TabControl flicker issue by Mick

Mick
Tue Dec 11 02:42:00 PST 2007

<aagarwal8@gmail.com> wrote in message
news:e84bf792-3440-4475-874c-5efd39747a8d@t1g2000pra.googlegroups.com...
> protected override CreateParams CreateParams {
> get {
> CreateParams cp = base.CreateParams;
> cp.ExStyle |= 0x02000000;
> return cp;
> }
> }

Be aware that this Style Flag (WS_EX_COMPOSITED) is only available in WinXP
and Vista. It will have no effect in previous OS's.

--
Mick Doherty
http://www.dotnetrix.co.uk/nothing.html



Re: TabControl flicker issue by Mick

Mick
Tue Dec 11 02:46:19 PST 2007

Hi Ankit,

<aagarwal8@gmail.com> wrote in message
news:b278c1d9-53d2-422e-abff-16093e46f593@s12g2000prg.googlegroups.com...
> Thanks a bunch Mick...
>
> Your hack solved my problem. Now the only issue left is that when
> resizing the form, TabPage headers still flicker; but i guess i can
> live with it.

The tabs in the TabControl you downloaded from my site shouldn't flicker,
but if the standard TabControl will do what you want, then it's best to use
that.

--
Mick Doherty
http://www.dotnetrix.co.uk/nothing.html