serializing graphics objects for sending to the clipboard

  • Thread starter Thread starter Lon
  • Start date Start date
L

Lon

Hello,

Does anyone have any thoughts on copying graphics objects
to the system clipboard? Specifically, I have a simple
class that contains a GraphicsPath, a Pen, and Brush
object. I'd like to be able to copy an instance of this
class to the system clipboard and retrieve it later.
Unfortunately, none of these data types are serializable
so I need to come up with another approach. Any thoughts
will be appreciated.

Thanks.
 
Hi,

You shouldn't paste any of these objects to the clipboard. Instead, create a
serializable descriptor object that would store, say, the pen's color and
width, the brush's color and pattern and the collection of points for the
path. You can always re-create the pen, the brush and the path from these
data and you'll avoid any problems with resource leaks you could have had
otherwise.
 
Back
Top