473,387 Members | 1,892 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.

setting Control.Region takes too much time

Hi

I have a customcontrol that has a boolean state variable.
The control is placed over a picturebox.

Depending on the value i assign a new Region to the control.
The region is simple and contructed from a graphicpath containing 1 ellipse.
(size no more then 100 pixels)

if (state)
this.Region=new Region(pathA);
else
this.Region=new Region(pathB);
This construction takes 300ms to execute on a 600Mhz Mainboard.

Can someone explain why ?

Whats the workaround ?

Johan

Mar 21 '07 #1
3 1998
Hello Sagaert,
>This construction takes 300ms to execute on a 600Mhz Mainboard.
So? I don't think this functionality has been created with the idea in
mind that you'd change the region around in a busy loop, and for
initialization purposes I don't see how 300ms are much of a problem. Of
course it's not fast... see below.
>Can someone explain why ?
One reason is probably that rather slow machine - 600MHz is not a lot
these days. I'm tempted to use a lot stronger words :-)
Oliver Sturm
--
http://www.sturmnet.org/blog
Mar 22 '07 #2
Hi

I removed the underlaying control with the backgroundimage set and replaced
it by a simple picturebox and now the regionchange only takes about 10ms

So it seems setting the region involves some repainting of the background
control.

"Oliver Sturm" <ol****@sturmnet.orgwrote in message
news:xn****************@msnews.microsoft.com...
Hello Sagaert,
This construction takes 300ms to execute on a 600Mhz Mainboard.

So? I don't think this functionality has been created with the idea in
mind that you'd change the region around in a busy loop, and for
initialization purposes I don't see how 300ms are much of a problem. Of
course it's not fast... see below.
Can someone explain why ?

One reason is probably that rather slow machine - 600MHz is not a lot
these days. I'm tempted to use a lot stronger words :-)
Oliver Sturm
--
http://www.sturmnet.org/blog

Mar 23 '07 #3
Hello Sagaert,
>I removed the underlaying control with the backgroundimage set and replaced
it by a simple picturebox and now the regionchange only takes about 10ms

So it seems setting the region involves some repainting of the background
control.
Ah, that's interesting - I'm sure it does involve repainting, but
apparently that control you had in there before took a while longer to do
that than you should expect even on that machine :-) Good to hear you
figured it out.
Oliver Sturm
--
http://www.sturmnet.org/blog
Mar 23 '07 #4

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

Similar topics

5
by: Alien | last post by:
I have a hex editor-type class that extends UserControl and paints its data to a PictureBox. Basically the problem is that repainting it takes usually between 60 and 80ms, which may seem pretty...
9
by: Guy | last post by:
I have extended the datetimepicker control to incorporate a ReadOnly property. I have used the new keyword to implement my own version of the value property, so that if readonly == true then it...
0
by: Chris Millar | last post by:
I have a user control that i wish to extend to change the date when the user selects the numeric up down button. The code explains itself, hope someone can help. any ideas appreaciated.. ...
0
by: jb_in_marietta | last post by:
All, I have written a very simple custom composite control that includes a control of type System.Web.UI.WebControls.Table. The control renders fine in run time, but for some reason, it does...
1
by: Kris van der Mast | last post by:
Hi, been a while since I posted a question myself instead of trying to help others out. I'm refactoring an existing web app that uses dynamic loading of user controls and a lot of...
8
by: David Lozzi | last post by:
Howdy, I have a user control that is a report to display data. On the page the control is inserted in, I have filter options to filter the report. When I try to do something like this, nothing...
20
by: BB | last post by:
Hello all, I am trying to override OnPaint in a custom textbox control (so I can drawstring a caption, etc.). In the code below, I get the "painting the form" message as expected, but not the...
0
by: Brian Young | last post by:
Hi all. I'm using the Property Grid control in a control to manage a windows service we have developed here. The windows service runs a set of other jobs that need to be managed. The control...
0
by: ChopStickr | last post by:
I have a custom control that is embedded (using the object tag) in an html document. The control takes a path to a local client ini file. Reads the file. Executes the program specified in...
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: 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
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
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.