[Mono-devel-list] Re: SystemBrushes and SystemPens - resending
Miguel de Icaza
miguel at ximian.com
Wed Jan 7 22:35:34 EST 2004
Hello,
> 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
> modified SystemPens also.Additionally, I have added support for
> "FromSystemColor(Color)" method and few other missing properties in both
> of the classes.
You are correct.
> 1. I have noticed that SystemColors vary with theme on Windows.
> Therefore, I don't think current implementation of SystemColors is going
> to give us proper values, as it has hardcoded values. May be we should
> look at some option of getting these values from desktop or we can use
> values of windows classic theme(?).
Yes, we should file a bug report about this. This information should
come at some point from the theme information, but we should not bother
too much with this now, we can do that later.
> I don't know how can I achieve this behavior on Mono. Please give me
> some idea to get the same behavior.
Have an internal flag on the Pen, `is_system', and on the setters, you
do something like:
class Pen {
Color Color {
get { ... }
set { if (is_system) throw Exception (); else ... }
}
}
Miguel
More information about the Mono-devel-list
mailing list