473,387 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Picture Resize Event

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
3 3226
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
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
....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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Skevmeister | last post by:
Hi Guys, Ok, so I have now figured out how to create and watermark and resize and resample images for my website, but now I want to trap the "save picture as" event so that I can create another...
4
by: Rob Richardson | last post by:
Greetings! I have a form with a listview, a menu, and a few text boxes, labels and command buttons. I want to resize the listview when the form is resized to that the widths of the spaces...
3
by: Z D | last post by:
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...
14
by: hamil | last post by:
I am trying to display an image in a picture box. The image is a group 4 fax black and white image of a piece of sheet music. The original resolution is 300 X 300 dpi. I want to have the picture...
0
by: Patrick Lioi | last post by:
We have form that is used as the base class of all of our forms, let's call it BaseApplicationForm. We have another form, say ChildApplicationForm that inherits from BaseApplicationForm. The...
8
by: Lad | last post by:
Is it possible to change a picture resolution with Python? Let's say I have a picture with a resolution of 96 dpi and I would like to increase to 256dpi or higher. Thank you for your reply. LL
5
by: arashkey | last post by:
Before this topic I save the picture with this code Dim savePath As String = Server.MapPath("picture\") If (f1.HasFile) Then pnlUpload.Visible = False ...
44
by: badvoc | last post by:
Hi to all, Firstly I must state my knowledge of php is limited but I am a quick learner. I have taken on the task of finishing a friends website due to his untimely passing and have hit a problem...
1
by: MaryKJolly | last post by:
i want to display a picture in a picture/image box. when i have tried it, only a part of the picture is displayed in the picture box. how can i resize the picture in order to get the full view of the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.