Excessive CPU usage while dragging picturebox-having form

K

kimiraikkonen

Hi,
On my system which is 2.4GHZ P4 CPU, 1GB memory + 64MB DDR graphic
card, if i create a simple picturebox docked on a form sized about
500x350 or less or more, doesn't matter, and also if i place a normal
sized picture on the control, while dragging the form having with
picturebox + image, it costs about %90-%100 CPU while dragging form
around the screen. And screen is shown as very noticeably sluttering
and distorted etc. Note that i use .NET 2.0 with VB.NET 2005.

Why? Is it because of .NET's or picturebox's high-level system
requirements?

Thanks.
 
M

Michel Posseth [MCP]

Well we had before a discussion about perfomance were i could not reproduce
the behavior however then i had a superior system to yours
at this moment i am working on a old test system.

wich is a + - 5 years old AMD XP 2400 + , with 512 MB shared memory (
Nvidia N-Force 2 mobo ) the onboard videocard ( slightly bether as a GF 2
MX 400) is using 64 MB , it is running on a genuine Windows XP Home with
SP 2 and a 40 GB IBM De(ath)sk[star] ( :) ) harddisk UDMA 133 .

And again i can drag whatever i want and yes indeed it eats some CPU cycles
( cost of redrawing the form ) however it is not disturbing to me while this
is a heavy loaded system .

Are you sure your computer hardware and software is in good state ??
 
K

kimiraikkonen

Well we had before a discussion about perfomance were i could not reproduce
the behavior however then i had a superior system to yours
at this moment i am working on a old test system.

wich is a + - 5 years old AMD XP 2400 + , with 512 MB shared memory (
Nvidia N-Force 2 mobo ) the onboard videocard ( slightly bether as a GF 2
MX 400) is using 64 MB , it is running on a genuine Windows XP Home with
SP 2 and a 40 GB IBM De(ath)sk[star] ( :) ) harddisk UDMA 133 .

And again i can drag whatever i want and yes indeed it eats some CPU cycles
( cost of redrawing the form ) however it is not disturbing to me while this
is a heavy loaded system .

Are you sure your computer hardware and software is in good state ??


Yes, current system which is P4 2.4GHZ, 1GB memory, 64 MB Geforce4
MX440 etc. and your old system isn't superior to this spec i suppose.

Open a large picture such as 5-7 megapixels and load it into
picturebox, i bet you'll feel like a torture while dragging.
Open task manager somewhere, then follow the CPU usage while dragging
picturebox-based form around the screen with your old system.

Usually it depends on the picture size, but picture size doesn't have
effect on cpu usage "so much" if you don't load a very tiny picture
(eg: avatar).

No such problems in 3rd party image viewing softwares such as ACDSee
or XnView.

Thanks
 
M

Michel Posseth [MCP]

Well


Just made a BMP of 7 megabytes , loaded this in a picturebox control With
Visual studio 2005 on my development system
tryed it first there

Start the prog , it is showing me the picture of 7 mb in the picturebox on a
form , i move it around as an idiot and one of my CPU climbs to 23% max
i have no redraw problems at all at this system everything looks smooth

i compiled this executable , transfered it to my test system and tested it
there ( compiled executbale in release mode ) and okay it isn`t smooth as
on my highend system repaint seems to hog the system and indeed it eats
some more cpu ( with peaks to 80 % ) , but it is still not so disturbing as
you describe it
and remember i am dragging this form as an idiot around my screen :)


What sort of picture did you use ? , i used a screen dump of my system of
7 mb big in BMP

just created a new project in VS 2005 , threw a picturbeox control on the
empty form

Public Class Form1

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load

Me.PictureBox1.Load("C:\test.bmp")

End Sub

End Class

And loaded my 7 MB BMP screendump , and it seems to work fine here even on
my lowspec system ( ofcourse for what i would expect of that system )

Strange .......... believe me i am as surprised as you must be ... maybe
someone else could also test this just for verification



michel





kimiraikkonen said:
Well we had before a discussion about perfomance were i could not
reproduce
the behavior however then i had a superior system to yours
at this moment i am working on a old test system.

wich is a + - 5 years old AMD XP 2400 + , with 512 MB shared memory (
Nvidia N-Force 2 mobo ) the onboard videocard ( slightly bether as a GF
2
MX 400) is using 64 MB , it is running on a genuine Windows XP Home
with
SP 2 and a 40 GB IBM De(ath)sk[star] ( :) ) harddisk UDMA 133 .

And again i can drag whatever i want and yes indeed it eats some CPU
cycles
( cost of redrawing the form ) however it is not disturbing to me while
this
is a heavy loaded system .

Are you sure your computer hardware and software is in good state ??


Yes, current system which is P4 2.4GHZ, 1GB memory, 64 MB Geforce4
MX440 etc. and your old system isn't superior to this spec i suppose.

Open a large picture such as 5-7 megapixels and load it into
picturebox, i bet you'll feel like a torture while dragging.
Open task manager somewhere, then follow the CPU usage while dragging
picturebox-based form around the screen with your old system.

Usually it depends on the picture size, but picture size doesn't have
effect on cpu usage "so much" if you don't load a very tiny picture
(eg: avatar).

No such problems in 3rd party image viewing softwares such as ACDSee
or XnView.

Thanks
 
K

kimiraikkonen

Are you doing anything in the form.move event handler?







- Show quoted text -

No handler, just dragging form from title bar having with a
picturebox. Usually you can test with one of your large digital photos
such as large amount of megapixel ones. Then set the form's size
approximately near to the photo(picturebox).
Then simply drag the form around the screen. Sluttering and excessive
(%80+, with faster moving %100 ) CPU usage occurs using this simple
code:

Picturebox1.image = Image.FromFile(<path>)
 
F

Family Tree Mike

I don't think I can provide any help. I do see the CPU load go to ~60% on my
system (AMD Athlon 64 X2 Dual Cor 4400+). I don't see any stuttering though.
I do see stuttering if I add a handler for the Move event, and force a
redraw of the Picture. This would be silly to do of course and did not
expect you to be doing that, but had to ask.
 
K

kimiraikkonen

I don't think I can provide any help. I do see the CPU load go to ~60% on my
system (AMD Athlon 64 X2 Dual Cor 4400+). I don't see any stuttering though.
I do see stuttering if I add a handler for the Move event, and force a
redraw of the Picture. This would be silly to do of course and did not
expect you to be doing that, but had to ask.

Also, besides moving picturebox-based form also if you draw rectangles
to make some selection like to save an selected rectangular area in a
screen capturing project, CPU is used excessively. No problem in such
3rd party apps, i think it's about hardcore CPU requirement of .NET
framework for such controls and events (picturebox or else based on
GUI).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top