Discussion:
Why can't I set PointF Property of a UserControl in design-time?
(too old to reply)
syryu
2008-02-20 06:46:01 UTC
Permalink
Hello!
I'm using Visual Studio 2005 Professional Edition, especially Visual Basic.
What I'm trying to do is to make a UserControl using "Windows Control
Library" project.
I'm adding some properties in the class, but I found out that when I add a
property of type "PointF", I cannot seem to change the value in designer. It
looks like as if it is read-only when it's not. Strange thing is, when the
property is "Point" type, then it's ok. Is there any work-around of this
problem or am I misunderstanding something?
Andrew L
2008-02-22 20:20:48 UTC
Permalink
Hi,

Most likely, this problem appears because the PointF struct doesn't have
TypeConverter attrubute (the Point class uses PointConverter). Most likely
you may write you're own TypeConverter (descendant from the PointConverter
or TypeConverter) and add attribute to your property.

PointF pf;
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
EditorBrowsable(EditorBrowsableState.Advanced),
TypeConverter(typeof(PointConverter))]
public PointF Pf {
get { return pf; }
set { pf = value; }
}

Thanks,
Andrew
Post by syryu
Hello!
I'm using Visual Studio 2005 Professional Edition, especially Visual Basic.
What I'm trying to do is to make a UserControl using "Windows Control
Library" project.
I'm adding some properties in the class, but I found out that when I add a
property of type "PointF", I cannot seem to change the value in designer. It
looks like as if it is read-only when it's not. Strange thing is, when the
property is "Point" type, then it's ok. Is there any work-around of this
problem or am I misunderstanding something?
Loading...