开发者

Component doesn't get serialized

开发者 https://www.devze.com 2023-02-16 22:11 出处:网络
I create a control with a property with type of (DataGridView开发者_JAVA技巧ColumnColection). For setting this component at design time, I create a custom designer. At design time every thing is ok.

I create a control with a property with type of (DataGridView开发者_JAVA技巧ColumnColection). For setting this component at design time, I create a custom designer. At design time every thing is ok. I can create columns, change details and so on but at run time all of my setting will disappear. I guess that problem is in the code serialization. My setting dosen't get serialized in initializecomponent method.

You can download some parts of my project from here:

http://rapidshare.com/files/452543887/Training.zip

In student form properties you can see a property(MasterColumns), this property controls datagridview columns at design time correctly, but in run time... you can see.. Please Help Me


You need to use the DesignerSerializationVisibility attribute. Here is a C++ example :-

private: int fullWidth;
    public:
        [Browsable(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility::Visible)]
        property int FullWidth
        {
            int get() { return this->fullWidth; }
            void set(int width) {
                this->fullWidth = width;
            }
        }
0

精彩评论

暂无评论...
验证码 换一张
取 消