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

Picture Resize Event

P: n/a
Z D
Hello,

BACKGROUND:
==============
I've created a Windows User Control that contains an Image Control (among
other controls).

The user control handles the picture resize event. Whenever the parent that
holds my user control is resized, I resize my image so that it uses the
maximum available space. Note: It takes about 2 seconds to regenerate the
newly sized image (lots of complex stuff going on).
THE PROBLEM:
==============
If the user has "Show contents while dragging window" feature enabled in
windows then while they are resizing resizing the parent form the picture
resize event keeps firing for every pixel the mouse is moved. This is a big
problem because the UI just freezes while its waiting for the resize to
occur (takes over 2 seconds!).

My question is: How do I go about fixing this? Is there a picture resize
completed event? That would be perfect, but unfortunately I cant find one.

I've even tried to detect if the mouse is down in the resize event and if it
is then I dont do a refresh. Problem is that when they stop resizing and
release the mouse button then the ressize event isn't fired one last time so
my picture size is not changed.

Note: if the user does not have "show window contents while dragging..."
enabled then things work fine as the picture resize is called only once when
the resize is completed. Is there any way to get the same thing to work
when "show contenets while dragging..." is enabled?

Any suggestions would be greatly appreciated.

Thanks
Nov 16 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi Z D

Why don't you try implementing a timeout based solution - when the resize
starts, don't actually kick off resize code until a certain amount of time
has elapsed. Then if the next resize event comes in sooner, you don't have to
start the recalculation of the image. You could experiment with different
timeouts, but probably 100ms or so would be OK to catch the situation you are
describing, and will still make the user feel in control.

HTH

Nigel Armstrong

"Z D" wrote:
Hello,

BACKGROUND:
==============
I've created a Windows User Control that contains an Image Control (among
other controls).

The user control handles the picture resize event. Whenever the parent that
holds my user control is resized, I resize my image so that it uses the
maximum available space. Note: It takes about 2 seconds to regenerate the
newly sized image (lots of complex stuff going on).
THE PROBLEM:
==============
If the user has "Show contents while dragging window" feature enabled in
windows then while they are resizing resizing the parent form the picture
resize event keeps firing for every pixel the mouse is moved. This is a big
problem because the UI just freezes while its waiting for the resize to
occur (takes over 2 seconds!).

My question is: How do I go about fixing this? Is there a picture resize
completed event? That would be perfect, but unfortunately I cant find one.

I've even tried to detect if the mouse is down in the resize event and if it
is then I dont do a refresh. Problem is that when they stop resizing and
release the mouse button then the ressize event isn't fired one last time so
my picture size is not changed.

Note: if the user does not have "show window contents while dragging..."
enabled then things work fine as the picture resize is called only once when
the resize is completed. Is there any way to get the same thing to work
when "show contenets while dragging..." is enabled?

Any suggestions would be greatly appreciated.

Thanks

Nov 16 '05 #2

P: n/a
Z D
Hi Nigel,

Thanks for your suggestion, I was playing around with that idea but I was
hoping I wouldnt have to resort to it! :)

-ZD
"Nigel Armstrong" <Ni************@discussions.microsoft.com> wrote in
message news:F0**********************************@microsof t.com...
Hi Z D

Why don't you try implementing a timeout based solution - when the resize
starts, don't actually kick off resize code until a certain amount of time
has elapsed. Then if the next resize event comes in sooner, you don't have
to
start the recalculation of the image. You could experiment with different
timeouts, but probably 100ms or so would be OK to catch the situation you
are
describing, and will still make the user feel in control.

HTH

Nigel Armstrong

"Z D" wrote:
Hello,

BACKGROUND:
==============
I've created a Windows User Control that contains an Image Control (among
other controls).

The user control handles the picture resize event. Whenever the parent
that
holds my user control is resized, I resize my image so that it uses the
maximum available space. Note: It takes about 2 seconds to regenerate
the
newly sized image (lots of complex stuff going on).
THE PROBLEM:
==============
If the user has "Show contents while dragging window" feature enabled in
windows then while they are resizing resizing the parent form the picture
resize event keeps firing for every pixel the mouse is moved. This is a
big
problem because the UI just freezes while its waiting for the resize to
occur (takes over 2 seconds!).

My question is: How do I go about fixing this? Is there a picture resize
completed event? That would be perfect, but unfortunately I cant find
one.

I've even tried to detect if the mouse is down in the resize event and if
it
is then I dont do a refresh. Problem is that when they stop resizing and
release the mouse button then the ressize event isn't fired one last time
so
my picture size is not changed.

Note: if the user does not have "show window contents while dragging..."
enabled then things work fine as the picture resize is called only once
when
the resize is completed. Is there any way to get the same thing to work
when "show contenets while dragging..." is enabled?

Any suggestions would be greatly appreciated.

Thanks

Nov 16 '05 #3

P: n/a
....just a quick thought as I'm not on my Windows machine right now.
Could you move the code to the MouseUp event of the form?

- Peder -
Z D wrote:
Hi Nigel,

Thanks for your suggestion, I was playing around with that idea but I was
hoping I wouldnt have to resort to it! :)

-ZD
"Nigel Armstrong" <Ni************@discussions.microsoft.com> wrote in
message news:F0**********************************@microsof t.com...
Hi Z D

Why don't you try implementing a timeout based solution - when the resize
starts, don't actually kick off resize code until a certain amount of time
has elapsed. Then if the next resize event comes in sooner, you don't have
to
start the recalculation of the image. You could experiment with different
timeouts, but probably 100ms or so would be OK to catch the situation you
are
describing, and will still make the user feel in control.

HTH

Nigel Armstrong

"Z D" wrote:

Hello,

BACKGROUND:
==============
I've created a Windows User Control that contains an Image Control (among
other controls).

The user control handles the picture resize event. Whenever the parent
that
holds my user control is resized, I resize my image so that it uses the
maximum available space. Note: It takes about 2 seconds to regenerate
the
newly sized image (lots of complex stuff going on).
THE PROBLEM:
==============
If the user has "Show contents while dragging window" feature enabled in
windows then while they are resizing resizing the parent form the picture
resize event keeps firing for every pixel the mouse is moved. This is a
big
problem because the UI just freezes while its waiting for the resize to
occur (takes over 2 seconds!).

My question is: How do I go about fixing this? Is there a picture resize
completed event? That would be perfect, but unfortunately I cant find
one.

I've even tried to detect if the mouse is down in the resize event and if
it
is then I dont do a refresh. Problem is that when they stop resizing and
release the mouse button then the ressize event isn't fired one last time
so
my picture size is not changed.

Note: if the user does not have "show window contents while dragging..."
enabled then things work fine as the picture resize is called only once
when
the resize is completed. Is there any way to get the same thing to work
when "show contenets while dragging..." is enabled?

Any suggestions would be greatly appreciated.

Thanks


Nov 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.