I'm not able to find the type System.Drawing.PointF at the browse option at the type of the Properties Settings.settings. Why it is not listed there?
How to reproduce: Go to yours Projects Properties folder and click at Settings.settigs. At the type, select Browse, navigate to System.Drawing \ System.Drawing. You can see that there will be no PointF listed.
It might be the fact PointF
does not have a TypeConverterAttribute
but Point
does. The way the settings provider works it needs a way to convert a string in to a object so the DefaultSettingValueAttribute
can set the default value.
A workaround I have used in the past is break apart the class and dynamically construct it. In your settings file create two float settings called MyPointFX
and MyPointFY
. then click "View Code" at the top of the settings page, in the new file add the following code
public PointF MyPointF
{
get
{
return new PointF(MyPointFX, MyPointFY);
}
set
{
MyPointFX = value.X;
MyPointFY = value.Y;
}
}
You will then be able to access MyPointF
and behind the scences it will read and write the settings to the two variables MyPointFX
and MyPointFY
.