473,769 Members | 5,836 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2023
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****@sturmne t.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
15126
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 fast but is not good enough when you have to repaint very frequently. For example, when you scroll the control or select blocks of text quickly. I have it paint its graphics to an offscreen Graphics instance, which I then transfer to the...
9
3975
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 will not set the value of the control and will leave the checked status of the checkbox to false when a user selects a new date. this works fine when using the control on a win2k machine but if we use it on a win XP box and call
0
1924
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.. Chris. code :
0
2011
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 not render properly in design time. In design time it renders something like this:
1
2325
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 response.redirects to the same page. Because I hate the overhead by doing this I'm searching for a cleaner option. But I'm having troubles (off course or I wouldn't be posting this).
8
2266
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 happens. dim filt as string ... build filter string... UserControl.ReportFilter = filt
20
2574
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 "painting the control". It also has no effect to explicitly call txtTest.Invalidate or txtTest.Refresh. Am I missing something simple here? Any push in the right direction is appreciated.
0
5569
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 is used to view the state of the running jobs and schedule new jobs. The control also runs in the context of Internet Explorer (we do this so the administrators of the jobs can always receive the latest control). The property grid is used to...
0
1974
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 the ini on the client's PC. After the program has ended the control looks in a client side temp folder (specified by the ini file) for an image created by the executed program. If the image is there, then the control moves the file to a public folder...
0
9579
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10199
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10032
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9979
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8861
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7393
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5293
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5433
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2810
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.