473,398 Members | 2,380 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,398 software developers and data experts.

Custom Control GDI+ Question

For the drawing on my control would it be better to allocate all the
pens / brushes needed during painting as member variables instead of
a whole bunch of

using( Pen p = ... )
{

}

type blocks in my paint handler functions.

It seems like it would be faster. And the memory requirements of a
solid color pen/brush must be small. The only downside I can think of
is that somewhere the user of the control would need to call
dispose().

Any advice, thoughts?
Nov 16 '05 #1
2 1272
If you profile cached brushes versus throwaway brushes, you will probably
find it makes no difference. Most of the drawing time is in the actual
rendering. If you do cache, make sure you override Dispose.

Regards,
Frank Hileman

check out VG.net: www.vgdotnet.com
Animated vector graphics system
Integrated Visual Studio .NET graphics editor

"Phill" <wa********@yahoo.com> wrote in message
news:ac**************************@posting.google.c om...
For the drawing on my control would it be better to allocate all the
pens / brushes needed during painting as member variables instead of
a whole bunch of

using( Pen p = ... )
{

}

type blocks in my paint handler functions.

It seems like it would be faster. And the memory requirements of a
solid color pen/brush must be small. The only downside I can think of
is that somewhere the user of the control would need to call
dispose().

Any advice, thoughts?

Nov 16 '05 #2
Well I saw your website and think I ought to take your word for it :) Thanx.
Nov 16 '05 #3

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...
1
by: Gerben van Loon | last post by:
Hi, I've drawn my own control using GDI+. But the control is bigger than a normal form could display, so I want to add scrollbars. Saw somewhere that you have to inherit from...
11
by: Sagaert Johan | last post by:
I have made a custom control that draws a rectangle when the mouse is down, and does nothing when the mouse is up. I set/reset a flag in MouseDown/Mouse up and use this to do the drawing in the...
4
by: | last post by:
Please, help. I created my contol, ButtonX, which subclasses System.Forms.Windows.Button class. I am doing my own paiting, by overriding OnPaint and OnPaintBackground (without calling base...
1
by: David Sobey | last post by:
Hi I'm making a custom component using GDI+, a calendar grid thingy. I paint the grid and numbers in my overrided OnPaint. However, when i go to paint other things at other times in other...
1
by: Kuba Florczyk | last post by:
Hi I've got some problem doing double buffer. Here is my problem: I've got custom control on which i paint some data (chat messages, lets call it ChatControl), this control is puted on a...
1
by: Keith Smith | last post by:
I wrote a custom control that inherits its structure from a textBox. Is it possible for me to add my own property so that the end-user can change it when he is using the control in his app? I...
2
by: Jon Turner | last post by:
When developing a custom control, lets say I have a property named "WidgetType" and this property can consist of 3 types "WidgetStandard, WidgetEnhanced, WidgetSimple". How does my control notify...
3
by: Arnold the Aardvark | last post by:
I am creating a custom draw tree view based on CTreeCtrl. When the control is re-sized the background is blanked completely, resulting in a horrible flicker. I've seen various suggestions...
4
by: Nathan Baker | last post by:
Hey, I am trying to subclass a button to create a control similar to the Firefox/IE dropdown button. My first step is to draw the 'down arrow' on the button. I overrided the OnPaint method...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
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...
0
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,...

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.