Am Mon, 25 Sep 2006 08:32:02 -0700 schrieb zofcentr:
> I am traying t ocreate similar property as Font in TextBox. I have created
> custom class with two private strings fields and coresponding properties. I
[quoted text clipped - 3 lines]
> After compilation and placing this control on form a see property but I
> can;t edit value of this property like in Font property.
To create a property with automatically assigned font UI-TypeEditor, you
have to create a public property in your custom class with type of font,
not string.
public Font MyFont
{
get {return this.m_myFont; }
set {this.m_myFont = value; }
}
Visual Studio is using the pre-created FontEditor UI-TypeEditor from the
System.Drawing.Design assembly. You have to implement your property like
mentioned. Or you have to implement a custom FontEditor UI-TypeEditor. If
you do that, you have to derive from UITypeEditor or FontEditor class.
Bye
Frank Loizzi
Dortmund, Germany
zofcentr - 27 Sep 2006 07:20 GMT
Hello Frank,
I don't want to create Font type property but Custom type property which is
serialized by designer like Font property or Size property. For this
properties desinger creates creates code which sets value of property wich
new created object eg. this.Size = new Size(10,10);
I wont my own class which will be serialized by designer like mentioned.
Thanks in advance
zofcentr
> Am Mon, 25 Sep 2006 08:32:02 -0700 schrieb zofcentr:
>
[quoted text clipped - 25 lines]
> Frank Loizzi
> Dortmund, Germany
Frank Loizzi - 27 Sep 2006 09:14 GMT
Am Tue, 26 Sep 2006 23:20:01 -0700 schrieb zofcentr:
> Hello Frank,
> I don't want to create Font type property but Custom type property which is
> serialized by designer like Font property or Size property.
Add this above the public property:
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
That's all you have to do.
Bye
Frank Loizzi
Dortmund, Germany
zofcentr - 02 Oct 2006 11:47 GMT
I have this attribut applied to property. But this does not help. I see
property in properties window but I cannot edit it. I can't even expand it
like font property to see object details.
> Am Tue, 26 Sep 2006 23:20:01 -0700 schrieb zofcentr:
>
[quoted text clipped - 12 lines]
> Frank Loizzi
> Dortmund, Germany
Frank Hileman - 02 Oct 2006 23:05 GMT
Create a custom TypeConverter, and when an InstanceDescriptor type is
requested, create an InstanceDescriptor describing how to serialize your
object. Associate the TypeConverter with your class with an attribute. Read
more here:
http://msdn.microsoft.com/library/en-us/dndotnet/html/vsnetpropbrow.asp
Regards,
Frank Hileman
check out VG.net: http://www.vgdotnet.com
Animated vector graphics system
Integrated Visual Studio graphics editor
>I have this attribut applied to property. But this does not help. I see
> property in properties window but I cannot edit it. I can't even expand it
[quoted text clipped - 17 lines]
>> Frank Loizzi
>> Dortmund, Germany
zofcentr - 04 Oct 2006 11:23 GMT
Thanks Frank,
This is what I was looking for.
Do YOU know maybe how to change behavior of designer serialization.
Normaly serializer creates code like that :
myComponent.CustomProperty = new CustomPropertyData(.....);
I would like to avoid creating complex constructor for every comlex property
object and have a code like below :
myComponent.CustomProperty = new CustomPropertyData();<- default constructor
myComponent.CustomProperty.FirstName = "John";
myComponent.CustomProperty.LastName = "Smith";
Thanks in advance
zofcentr
> Create a custom TypeConverter, and when an InstanceDescriptor type is
> requested, create an InstanceDescriptor describing how to serialize your
[quoted text clipped - 30 lines]
> >> Frank Loizzi
> >> Dortmund, Germany
Frank Hileman - 15 Oct 2006 18:54 GMT
Hi,
The third parameter to the InstanceDescriptor constructor is a boolean
called isComplete. Set that to false and the code generator will create a
local variable, then use the usual DefaultValue and ShouldSerialize logic to
determine if the property values must be serialized.
Regards,
Frank Hileman
check out VG.net: http://www.vgdotnet.com
Animated vector graphics system
Integrated Visual Studio graphics editor
> Thanks Frank,
> This is what I was looking for.
[quoted text clipped - 51 lines]
>> >> Frank Loizzi
>> >> Dortmund, Germany
zofcentr - 19 Oct 2006 08:14 GMT
Thanks Frank,
Ia ma really grateful for help.
Best regrads
zofcentr
> Hi,
>
[quoted text clipped - 65 lines]
> >> >> Frank Loizzi
> >> >> Dortmund, Germany