本文整理匯總了C#中System.Windows.Forms.DataObject.ContainsAudio方法的典型用法代碼示例。如果您正苦於以下問題:C# DataObject.ContainsAudio方法的具體用法?C# DataObject.ContainsAudio怎麽用?C# DataObject.ContainsAudio使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Forms.DataObject
的用法示例。
在下文中一共展示了DataObject.ContainsAudio方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: TestAudio
public void TestAudio ()
{
DataObject d = new DataObject ();
byte[] b = new byte[] { 1, 2, 3 };
d.SetAudio (b);
Assert.AreEqual (true, d.ContainsAudio (), "A1");
Assert.AreEqual (false, d.ContainsFileDropList (), "A2");
Assert.AreEqual (false, d.ContainsImage (), "A3");
Assert.AreEqual (false, d.ContainsText (), "A4");
Assert.AreEqual (false, d.ContainsText (TextDataFormat.CommaSeparatedValue), "A5");
Assert.AreEqual (b.Length, d.GetAudioStream ().Length, "A6");
}
示例2: TestImage
public void TestImage ()
{
DataObject d = new DataObject ();
Image i = new Bitmap (16, 16);
d.SetImage (i);
Assert.AreEqual (false, d.ContainsAudio (), "A1");
Assert.AreEqual (false, d.ContainsFileDropList (), "A2");
Assert.AreEqual (true, d.ContainsImage (), "A3");
Assert.AreEqual (false, d.ContainsText (), "A4");
Assert.AreEqual (false, d.ContainsText (TextDataFormat.CommaSeparatedValue), "A5");
Assert.AreSame (i, d.GetImage (), "A6");
}
示例3: TestText
public void TestText ()
{
DataObject d = new DataObject ();
d.SetText ("yo");
Assert.AreEqual (false, d.ContainsAudio (), "A1");
Assert.AreEqual (false, d.ContainsFileDropList (), "A2");
Assert.AreEqual (false, d.ContainsImage (), "A3");
Assert.AreEqual (true, d.ContainsText (), "A4");
Assert.AreEqual (false, d.ContainsText (TextDataFormat.CommaSeparatedValue), "A5");
Assert.AreEqual ("yo", d.GetText (), "A6");
Assert.AreEqual ("yo", d.GetData (DataFormats.StringFormat), "A6-1");
d.SetText ("<html></html>", TextDataFormat.Html);
Assert.AreEqual (true, d.ContainsText (), "A7");
Assert.AreEqual (false, d.ContainsText (TextDataFormat.CommaSeparatedValue), "A8");
Assert.AreEqual (true, d.ContainsText (TextDataFormat.Html), "A9");
Assert.AreEqual (false, d.ContainsText (TextDataFormat.Rtf), "A10");
Assert.AreEqual (true, d.ContainsText (TextDataFormat.Text), "A11");
Assert.AreEqual (true, d.ContainsText (TextDataFormat.UnicodeText), "A12");
// directly put a string
d.SetData ("yo");
Assert.AreEqual (true, d.ContainsText (TextDataFormat.Text), "A13");
Assert.AreEqual (true, d.ContainsText (TextDataFormat.UnicodeText), "A14");
Assert.AreEqual ("yo", d.GetData (DataFormats.StringFormat), "A15");
Assert.AreEqual ("yo", d.GetData (DataFormats.Text), "A16");
Assert.AreEqual ("yo", d.GetData (DataFormats.UnicodeText), "A17");
}
示例4: TestFileDrop
public void TestFileDrop ()
{
DataObject d = new DataObject ();
StringCollection sc = new StringCollection ();
sc.AddRange (new string[] {"A", "B", "C"});
d.SetFileDropList (sc);
Assert.AreEqual (false, d.ContainsAudio (), "A1");
Assert.AreEqual (true, d.ContainsFileDropList (), "A2");
Assert.AreEqual (false, d.ContainsImage (), "A3");
Assert.AreEqual (false, d.ContainsText (), "A4");
Assert.AreEqual (false, d.ContainsText (TextDataFormat.CommaSeparatedValue), "A5");
Assert.AreEqual (sc.Count, d.GetFileDropList ().Count, "A6");
}