System.Windows.Forms.DataFormats question

  • Thread starter Thread starter New World Order Pigs
  • Start date Start date
N

New World Order Pigs

Under System.Windows.Forms is a class called "DataFormats" that can be used
to programmatically manipulate the clipboard. This has a number of
intriguing properties and yet I can't seem to gather exactly how this can be
used. Is it possible to use this class and its methods to do conversions
between different formats? In other words, can I put RTF text into the Rtf
field and then pull this same info out from the Html field in HTML format?
I don't see much usage of this component and so am having trouble discerning
its potential usage.

Any assistance will be greatly appreciated.
NWOP.
 
It's unlikely this class can convert data formats. As far as I know, it's
primary purpose is to define commonly used and register custom clipboard
data formats. If you need the data on the clipboard to be available, say, as
HTML as well as RTF, I'm afraid it's on you to paste the data in both
formats.
 
Thanks Dmitriy. One reason I was thinking this was the case (i.e. available
in many formats simultaneously) is that there is a sentence describing the
class in .net doc that says "For example, a string of text from winith a
..NET Framework application stored on the Clipboard is available in formats
including Text, StringFormat, RTF, and Unicode Text." Other properties
(fields) in this class include "Html" and so I was under the impression that
this is how this class can be used.

Thanks again and to anybody else weighing in on this.

NWOP.
Dmitriy Lapshin said:
It's unlikely this class can convert data formats. As far as I know, it's
primary purpose is to define commonly used and register custom clipboard
data formats. If you need the data on the clipboard to be available, say, as
HTML as well as RTF, I'm afraid it's on you to paste the data in both
formats.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://www.x-unity.net/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

New World Order Pigs said:
Under System.Windows.Forms is a class called "DataFormats" that can be used
to programmatically manipulate the clipboard. This has a number of
intriguing properties and yet I can't seem to gather exactly how this
can
be
used. Is it possible to use this class and its methods to do conversions
between different formats? In other words, can I put RTF text into the Rtf
field and then pull this same info out from the Html field in HTML format?
I don't see much usage of this component and so am having trouble discerning
its potential usage.

Any assistance will be greatly appreciated.
NWOP.
 
Well, it might be that the Framework takes care of certain types and
provides multi-format support for them. I cannot tell for sure as I haven't
did much Clipboard programming.
 
Back
Top