[Mono-devel-list] SystemBrushes and SystemPens

Ravindra Kumar rkumar at novell.com
Wed Jan 7 03:42:26 EST 2004


Hi,

As I was going through S.D code I came across following statement in
.NET docs,
*************
SystemColors class:
	Remarks: Better performance is achieved through the use of the
SystemPens object or 
	SystemBrushes object rather than creating a new pen or brush
based on a value from 
	the SystemColors object. For example, use SystemBrushes.Control
because it is a 
	brush that already exists, whereas new
SolidBrush(SystemColors.Control) creates a 
	new brush.
**************
Given this remark, I think the current implementation of SystemBrushes
is not correct as we are creating objects whenever a property is
requested. Please find attached my patch for correcting the same. I have
made it similar to SystemPens. Also, I have added support for
"FromSystemColor(Color)" method in both of the classes and few other
missing properties in SystemBrushes.

Please comment on my changes, if I can commit.

Thanks
Ravi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SystemBrushes.patch
Type: application/octet-stream
Size: 5714 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20040107/d8391374/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SystemPens.patch
Type: application/octet-stream
Size: 606 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20040107/d8391374/attachment-0001.obj 


More information about the Mono-devel-list mailing list