本文整理匯總了C#中System.Windows.Forms.DataObject.GetImage方法的典型用法代碼示例。如果您正苦於以下問題:C# DataObject.GetImage方法的具體用法?C# DataObject.GetImage怎麽用?C# DataObject.GetImage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Forms.DataObject
的用法示例。
在下文中一共展示了DataObject.GetImage方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: 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");
}
示例2: LoadDataObject
public bool LoadDataObject(object Src)
{
try
{
DataObject d = new DataObject(Src);
if (d.ContainsImage())
{
if (LoadImage(d.GetImage()))
return true;
}
if (d.ContainsFileDropList())
{
foreach (string FName in d.GetFileDropList())
{
try
{
if (LoadImage(FName))
return true;
}
catch
{
}
}
}
if (d.ContainsText())
{
string FName = d.GetText().Trim();
if ((FName.IndexOf("http://") == 0) ||
(FName.IndexOf("https://") == 0))
{
if (LoadImageFromUrl(FName))
return true;
}
else
{
if (File.Exists(FName))
{
if (LoadImage(FName))
return true;
}
}
}
}
catch (Exception Ex)
{
MessageBox.Show(Ex.ToString());
}
return false;
}