By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,665 Members | 1,372 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,665 IT Pros & Developers. It's quick & easy.

Listbox flickers on form resize

P: n/a
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
Share this Question
Share on Google+
8 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a

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

P: n/a
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.