472,119 Members | 2,032 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,119 software developers and data experts.

Listbox flickers on form resize

Hi,
I have added a simple listbox in windows form under c# 2.0. It contains
a collection of approx 10 strings as list items. Now when i resize the
form whole listbox flickers.

Please tell me any feasible solution, i need to use a checked listbox
which also has same flickering problem on resize.

Thanks & Regards

Nirdesh Dabas
ni***********@gmail.com

Nov 7 '06 #1
8 6210
Nirdesh,

When does the control flicker. I created a test application with listbox
containing 100 strings and I don't see any flickering. Either I don't
reproduce your case correctly or you have something esle going on in your
application. Can you post simple, but compilable sample that demonstrates
your problem.
--
Stoitcho Goutsev (100)

<ni***********@gmail.comwrote in message
news:11**********************@e3g2000cwe.googlegro ups.com...
Hi,
I have added a simple listbox in windows form under c# 2.0. It contains
a collection of approx 10 strings as list items. Now when i resize the
form whole listbox flickers.

Please tell me any feasible solution, i need to use a checked listbox
which also has same flickering problem on resize.

Thanks & Regards

Nirdesh Dabas
ni***********@gmail.com

Nov 7 '06 #2
hi,
You might have kept a listbox on a form. Thats fine. Please run the
application and try to resize the form. When you resize the form all
the contents of the listbox reloads and gives ample amount of
flickering.
Is there any solution to this problem.
Thanks & Regards
Nirdesh

Stoitcho Goutsev (100) wrote:
Nirdesh,

When does the control flicker. I created a test application with listbox
containing 100 strings and I don't see any flickering. Either I don't
reproduce your case correctly or you have something esle going on in your
application. Can you post simple, but compilable sample that demonstrates
your problem.
--
Stoitcho Goutsev (100)

<ni***********@gmail.comwrote in message
news:11**********************@e3g2000cwe.googlegro ups.com...
Hi,
I have added a simple listbox in windows form under c# 2.0. It contains
a collection of approx 10 strings as list items. Now when i resize the
form whole listbox flickers.

Please tell me any feasible solution, i need to use a checked listbox
which also has same flickering problem on resize.

Thanks & Regards

Nirdesh Dabas
ni***********@gmail.com
Nov 8 '06 #3
Hi,

you may register to the form events ResizeBegin and -End. In
ResizeBegin event handler
call form.SuspendLayout and in ResizeEnd event handler call
form.ResumeLayout.
This is not tested but maybe it helps you.

Nov 8 '06 #4
PROBLEM STILL EXISTS
I can use

[DllImport("user32.dll")]

public static extern bool LockWindowUpdate(IntPtr hWndLock);

to lock the update at ResizeBegin and ResizeEnd but it stops the
redrawing of control and if i resize the form to minimum and stretch it
back i will find that the control i not painted and gives unwanted
image. I found similar flickering issue in listbox & CheckedListBox.

Even BeginUpdate and EndUpdate did not worked as it shows empty list
while resizing.

And your stated form events ResizeBegin and -End form.SuspendLayout
using form.ResumeLayout do not work for listbox and checkedlistbox. :(

Roman Wagner wrote:
Hi,

you may register to the form events ResizeBegin and -End. In
ResizeBegin event handler
call form.SuspendLayout and in ResizeEnd event handler call
form.ResumeLayout.
This is not tested but maybe it helps you.
Nov 8 '06 #5
What I did I anchored the control so it resizes when the form resizes. I
resized the form and as a matter of fact I can see some hardly noticable
flickering on the elements on the top, but nothing so drastic, but yes there
is some filickering. I find it strange that on my test only the first
element in the lisbox flickers - not the first visible, but the first in the
list. There are some thinks that looks like reduce the flicker, but doesn't
get rid of it completely:
1. Set IntegralHeight to *false* it looks like there is some problem and the
control height changes without visible reason as the list box resizes.
2. Try to double buffer the control. I'd expect this to remove the
flickering, but it looks like it only reduces it a bit. To do that you need
to inherit from the control and in the constructor to set DoubleBuffered
protected property to *true*.

If this doesn't give you good result trye using ListView. I haven't tried,
but as a more complex control it may behave better.
--
HTH
Stoitcho Goutsev (100)

This flickering can be removed if I inherit from the listbox and make it
double buffered.
<ni***********@gmail.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
hi,
You might have kept a listbox on a form. Thats fine. Please run the
application and try to resize the form. When you resize the form all
the contents of the listbox reloads and gives ample amount of
flickering.
Is there any solution to this problem.
Thanks & Regards
Nirdesh

Stoitcho Goutsev (100) wrote:
>Nirdesh,

When does the control flicker. I created a test application with listbox
containing 100 strings and I don't see any flickering. Either I don't
reproduce your case correctly or you have something esle going on in your
application. Can you post simple, but compilable sample that demonstrates
your problem.
--
Stoitcho Goutsev (100)

<ni***********@gmail.comwrote in message
news:11**********************@e3g2000cwe.googlegr oups.com...
Hi,
I have added a simple listbox in windows form under c# 2.0. It contains
a collection of approx 10 strings as list items. Now when i resize the
form whole listbox flickers.

Please tell me any feasible solution, i need to use a checked listbox
which also has same flickering problem on resize.

Thanks & Regards

Nirdesh Dabas
ni***********@gmail.com

Nov 8 '06 #6
Hi thanks for the reply,
The problem i stated is specific to tabcontrol. Even i noticed it late
.. when i dock fill
tabcontrol on a form and put a listbox in docked tabcontrol. THEN AT
RESIZE of the
form, listbox as well as the tabcontrol flickers badly.
Please tell any possible solution

Stoitcho Goutsev (100) wrote:
What I did I anchored the control so it resizes when the form resizes. I
resized the form and as a matter of fact I can see some hardly noticable
flickering on the elements on the top, but nothing so drastic, but yes there
is some filickering. I find it strange that on my test only the first
element in the lisbox flickers - not the first visible, but the first in the
list. There are some thinks that looks like reduce the flicker, but doesn't
get rid of it completely:
1. Set IntegralHeight to *false* it looks like there is some problem and the
control height changes without visible reason as the list box resizes.
2. Try to double buffer the control. I'd expect this to remove the
flickering, but it looks like it only reduces it a bit. To do that you need
to inherit from the control and in the constructor to set DoubleBuffered
protected property to *true*.

If this doesn't give you good result trye using ListView. I haven't tried,
but as a more complex control it may behave better.
--
HTH
Stoitcho Goutsev (100)

This flickering can be removed if I inherit from the listbox and make it
double buffered.
<ni***********@gmail.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
hi,
You might have kept a listbox on a form. Thats fine. Please run the
application and try to resize the form. When you resize the form all
the contents of the listbox reloads and gives ample amount of
flickering.
Is there any solution to this problem.
Thanks & Regards
Nirdesh

Stoitcho Goutsev (100) wrote:
Nirdesh,

When does the control flicker. I created a test application with listbox
containing 100 strings and I don't see any flickering. Either I don't
reproduce your case correctly or you have something esle going on in your
application. Can you post simple, but compilable sample that demonstrates
your problem.
--
Stoitcho Goutsev (100)

<ni***********@gmail.comwrote in message
news:11**********************@e3g2000cwe.googlegro ups.com...
Hi,
I have added a simple listbox in windows form under c# 2.0. It contains
a collection of approx 10 strings as list items. Now when i resize the
form whole listbox flickers.

Please tell me any feasible solution, i need to use a checked listbox
which also has same flickering problem on resize.

Thanks & Regards

Nirdesh Dabas
ni***********@gmail.com
Nov 8 '06 #7

Stoitcho Goutsev (100) wrote:
What I did I anchored the control so it resizes when the form resizes. I
resized the form and as a matter of fact I can see some hardly noticable
flickering on the elements on the top, but nothing so drastic, but yes there
is some filickering. I find it strange that on my test only the first
element in the lisbox flickers - not the first visible, but the first in the
list. There are some thinks that looks like reduce the flicker, but doesn't
get rid of it completely:
1. Set IntegralHeight to *false* it looks like there is some problem and the
control height changes without visible reason as the list box resizes.
2. Try to double buffer the control. I'd expect this to remove the
flickering, but it looks like it only reduces it a bit. To do that you need
to inherit from the control and in the constructor to set DoubleBuffered
protected property to *true*.

If this doesn't give you good result trye using ListView. I haven't tried,
but as a more complex control it may behave better.
--
HTH
Stoitcho Goutsev (100)

This flickering can be removed if I inherit from the listbox and make it
double buffered.
<ni***********@gmail.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
hi,
You might have kept a listbox on a form. Thats fine. Please run the
application and try to resize the form. When you resize the form all
the contents of the listbox reloads and gives ample amount of
flickering.
Is there any solution to this problem.
Thanks & Regards
Nirdesh

Stoitcho Goutsev (100) wrote:
Nirdesh,

When does the control flicker. I created a test application with listbox
containing 100 strings and I don't see any flickering. Either I don't
reproduce your case correctly or you have something esle going on in your
application. Can you post simple, but compilable sample that demonstrates
your problem.
--
Stoitcho Goutsev (100)

<ni***********@gmail.comwrote in message
news:11**********************@e3g2000cwe.googlegro ups.com...
Hi,
I have added a simple listbox in windows form under c# 2.0. It contains
a collection of approx 10 strings as list items. Now when i resize the
form whole listbox flickers.

Please tell me any feasible solution, i need to use a checked listbox
which also has same flickering problem on resize.

Thanks & Regards

Nirdesh Dabas
ni***********@gmail.com
Nov 8 '06 #8
The problem i stated is specific to tabcontrol. Sorry i stated it
inappropriately earlier . when i dock fill
tabcontrol on a form and put a listbox there. THEN AT RESIZE of the
form, listbox as well as the tabcontrol flickers badly.
Please tell any possible solution

Stoitcho Goutsev (100) wrote:
What I did I anchored the control so it resizes when the form resizes. I
resized the form and as a matter of fact I can see some hardly noticable
flickering on the elements on the top, but nothing so drastic, but yes there
is some filickering. I find it strange that on my test only the first
element in the lisbox flickers - not the first visible, but the first in the
list. There are some thinks that looks like reduce the flicker, but doesn't
get rid of it completely:
1. Set IntegralHeight to *false* it looks like there is some problem and the
control height changes without visible reason as the list box resizes.
2. Try to double buffer the control. I'd expect this to remove the
flickering, but it looks like it only reduces it a bit. To do that you need
to inherit from the control and in the constructor to set DoubleBuffered
protected property to *true*.

If this doesn't give you good result trye using ListView. I haven't tried,
but as a more complex control it may behave better.
--
HTH
Stoitcho Goutsev (100)

This flickering can be removed if I inherit from the listbox and make it
double buffered.
<ni***********@gmail.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
hi,
You might have kept a listbox on a form. Thats fine. Please run the
application and try to resize the form. When you resize the form all
the contents of the listbox reloads and gives ample amount of
flickering.
Is there any solution to this problem.
Thanks & Regards
Nirdesh

Stoitcho Goutsev (100) wrote:
Nirdesh,

When does the control flicker. I created a test application with listbox
containing 100 strings and I don't see any flickering. Either I don't
reproduce your case correctly or you have something esle going on in your
application. Can you post simple, but compilable sample that demonstrates
your problem.
--
Stoitcho Goutsev (100)

<ni***********@gmail.comwrote in message
news:11**********************@e3g2000cwe.googlegro ups.com...
Hi,
I have added a simple listbox in windows form under c# 2.0. It contains
a collection of approx 10 strings as list items. Now when i resize the
form whole listbox flickers.

Please tell me any feasible solution, i need to use a checked listbox
which also has same flickering problem on resize.

Thanks & Regards

Nirdesh Dabas
ni***********@gmail.com
Nov 8 '06 #9

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Ray | last post: by
2 posts views Thread by Robin Senior | last post: by
8 posts views Thread by gv | last post: by
8 posts views Thread by Steve Schroeder | last post: by
2 posts views Thread by dan heskett | last post: by
3 posts views Thread by Reg Verrin | last post: by
11 posts views Thread by Andrus | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.