473,395 Members | 1,688 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,395 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 21 '05 #1
3 1347
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 21 '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 21 '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 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

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...
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...
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 ...
1
by: | last post by:
I'm creating a user control where the size always needs to be divisible by three. In the resize event within the custom control I'm having no problem maintaining the height to be the same as the...
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: 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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.