Home > Net >  C # a button control error serialization
C # a button control error serialization

Time:09-27

To serialize button controls, hint hint System. C # Windows. The form. The button is not marked as serializable, but turned to define the window of the button is not serialized tag, strives for the great god

CodePudding user response:

Button to serialize? Don't understand,

CodePudding user response:

 
[Serializable]Public class SerializableButton: Button, ISerializable
{
Public SerializableButton () {}
Public SerializableButton (SerializationInfo info, StreamingContext context)
{
Width=(int) info. GetDouble (" Width ");
Height=(int) info. GetDouble (" Height ");
}
Public void GetObjectData (SerializationInfo info, StreamingContext context)
{
Info. AddValue (" Width ", Width);
Info. AddValue (" Height ", Height);
}
}

CodePudding user response:

Don't button Winform controls such as seriation, because Winform controls using the Windows operating system resource, can't save,

Although not serial control, but you can save controls the size of the position, color, etc.,

CodePudding user response:

https://bbs.csdn.net/topics/395259664
  •  Tags:  
  • C#
  • Related